smproxy.h revision bf2eeab3
1/* $Xorg: smproxy.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ */
2/* $XdotOrg: $ */
3/******************************************************************************
4
5Copyright 1994, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27Author:  Ralph Mor, X Consortium
28******************************************************************************/
29/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.5 2001/07/25 15:05:16 dawes Exp $ */
30
31#ifdef HAVE_CONFIG_H
32# include "config.h"
33#endif
34
35#include <X11/Xosdefs.h>
36#include <X11/Xfuncs.h>
37
38#include <X11/StringDefs.h>
39#include <X11/Intrinsic.h>
40#include <X11/Xatom.h>
41#include <X11/Xlib.h>
42#include <X11/SM/SMlib.h>
43
44#ifndef _POSIX_SOURCE
45#define _POSIX_SOURCE
46#include <stdio.h>
47#undef _POSIX_SOURCE
48#else
49#include <stdio.h>
50#endif
51#include <stdlib.h>
52
53#ifndef X_NOT_POSIX
54#ifdef _POSIX_SOURCE
55#include <limits.h>
56#else
57#define _POSIX_SOURCE
58#include <limits.h>
59#undef _POSIX_SOURCE
60#endif
61#endif /* X_NOT_POSIX */
62#ifndef PATH_MAX
63#include <sys/param.h>
64#ifndef PATH_MAX
65#ifdef MAXPATHLEN
66#define PATH_MAX MAXPATHLEN
67#else
68#define PATH_MAX 1024
69#endif
70#endif
71#endif /* PATH_MAX */
72
73
74typedef struct WinInfo {
75    Window window;
76    SmcConn smc_conn;
77    XtInputId input_id;
78    char *client_id;
79    char **wm_command;
80    int wm_command_count;
81    XClassHint class;
82    char *wm_name;
83    XTextProperty wm_client_machine;
84    struct WinInfo *next;
85
86    unsigned int tested_for_sm_client_id : 1;
87    unsigned int has_save_yourself : 1;
88    unsigned int waiting_for_update : 1;
89    unsigned int got_first_save_yourself : 1;
90
91} WinInfo;
92
93typedef struct ProxyFileEntry
94{
95    struct ProxyFileEntry *next;
96    int tag;
97    char *client_id;
98    XClassHint class;
99    char *wm_name;
100    int wm_command_count;
101    char **wm_command;
102} ProxyFileEntry;
103
104extern int WriteProxyFileEntry ( FILE *proxyFile, WinInfo *theWindow );
105extern int ReadProxyFileEntry ( FILE *proxyFile, ProxyFileEntry **pentry );
106extern void ReadProxyFile ( char *filename );
107extern char * WriteProxyFile ( void );
108extern char * LookupClientID ( WinInfo *theWindow );
109
110extern WinInfo *win_head;
111
112#define SAVEFILE_VERSION 1
113