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