smproxy.h revision bf2eeab3
114c0a534Smrg/* $Xorg: smproxy.h,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $ */
2bf2eeab3Smrg/* $XdotOrg: $ */
314c0a534Smrg/******************************************************************************
414c0a534Smrg
514c0a534SmrgCopyright 1994, 1998  The Open Group
614c0a534Smrg
714c0a534SmrgPermission to use, copy, modify, distribute, and sell this software and its
814c0a534Smrgdocumentation for any purpose is hereby granted without fee, provided that
914c0a534Smrgthe above copyright notice appear in all copies and that both that
1014c0a534Smrgcopyright notice and this permission notice appear in supporting
1114c0a534Smrgdocumentation.
1214c0a534Smrg
1314c0a534SmrgThe above copyright notice and this permission notice shall be included in
1414c0a534Smrgall copies or substantial portions of the Software.
1514c0a534Smrg
1614c0a534SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1714c0a534SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1814c0a534SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1914c0a534SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
2014c0a534SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2114c0a534SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2214c0a534Smrg
2314c0a534SmrgExcept as contained in this notice, the name of The Open Group shall not be
2414c0a534Smrgused in advertising or otherwise to promote the sale, use or other dealings
2514c0a534Smrgin this Software without prior written authorization from The Open Group.
2614c0a534Smrg
2714c0a534SmrgAuthor:  Ralph Mor, X Consortium
2814c0a534Smrg******************************************************************************/
2914c0a534Smrg/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.5 2001/07/25 15:05:16 dawes Exp $ */
3014c0a534Smrg
3114c0a534Smrg#ifdef HAVE_CONFIG_H
3214c0a534Smrg# include "config.h"
3314c0a534Smrg#endif
3414c0a534Smrg
3514c0a534Smrg#include <X11/Xosdefs.h>
3614c0a534Smrg#include <X11/Xfuncs.h>
3714c0a534Smrg
3814c0a534Smrg#include <X11/StringDefs.h>
3914c0a534Smrg#include <X11/Intrinsic.h>
4014c0a534Smrg#include <X11/Xatom.h>
4114c0a534Smrg#include <X11/Xlib.h>
4214c0a534Smrg#include <X11/SM/SMlib.h>
4314c0a534Smrg
4414c0a534Smrg#ifndef _POSIX_SOURCE
4514c0a534Smrg#define _POSIX_SOURCE
4614c0a534Smrg#include <stdio.h>
4714c0a534Smrg#undef _POSIX_SOURCE
4814c0a534Smrg#else
4914c0a534Smrg#include <stdio.h>
5014c0a534Smrg#endif
5114c0a534Smrg#include <stdlib.h>
5214c0a534Smrg
5314c0a534Smrg#ifndef X_NOT_POSIX
5414c0a534Smrg#ifdef _POSIX_SOURCE
5514c0a534Smrg#include <limits.h>
5614c0a534Smrg#else
5714c0a534Smrg#define _POSIX_SOURCE
5814c0a534Smrg#include <limits.h>
5914c0a534Smrg#undef _POSIX_SOURCE
6014c0a534Smrg#endif
6114c0a534Smrg#endif /* X_NOT_POSIX */
6214c0a534Smrg#ifndef PATH_MAX
6314c0a534Smrg#include <sys/param.h>
6414c0a534Smrg#ifndef PATH_MAX
6514c0a534Smrg#ifdef MAXPATHLEN
6614c0a534Smrg#define PATH_MAX MAXPATHLEN
6714c0a534Smrg#else
6814c0a534Smrg#define PATH_MAX 1024
6914c0a534Smrg#endif
7014c0a534Smrg#endif
7114c0a534Smrg#endif /* PATH_MAX */
7214c0a534Smrg
7314c0a534Smrg
7414c0a534Smrgtypedef struct WinInfo {
7514c0a534Smrg    Window window;
7614c0a534Smrg    SmcConn smc_conn;
7714c0a534Smrg    XtInputId input_id;
7814c0a534Smrg    char *client_id;
7914c0a534Smrg    char **wm_command;
8014c0a534Smrg    int wm_command_count;
8114c0a534Smrg    XClassHint class;
8214c0a534Smrg    char *wm_name;
8314c0a534Smrg    XTextProperty wm_client_machine;
8414c0a534Smrg    struct WinInfo *next;
8514c0a534Smrg
8614c0a534Smrg    unsigned int tested_for_sm_client_id : 1;
8714c0a534Smrg    unsigned int has_save_yourself : 1;
8814c0a534Smrg    unsigned int waiting_for_update : 1;
8914c0a534Smrg    unsigned int got_first_save_yourself : 1;
9014c0a534Smrg
9114c0a534Smrg} WinInfo;
9214c0a534Smrg
9314c0a534Smrgtypedef struct ProxyFileEntry
9414c0a534Smrg{
9514c0a534Smrg    struct ProxyFileEntry *next;
9614c0a534Smrg    int tag;
9714c0a534Smrg    char *client_id;
9814c0a534Smrg    XClassHint class;
9914c0a534Smrg    char *wm_name;
10014c0a534Smrg    int wm_command_count;
10114c0a534Smrg    char **wm_command;
10214c0a534Smrg} ProxyFileEntry;
10314c0a534Smrg
10414c0a534Smrgextern int WriteProxyFileEntry ( FILE *proxyFile, WinInfo *theWindow );
10514c0a534Smrgextern int ReadProxyFileEntry ( FILE *proxyFile, ProxyFileEntry **pentry );
10614c0a534Smrgextern void ReadProxyFile ( char *filename );
10714c0a534Smrgextern char * WriteProxyFile ( void );
10814c0a534Smrgextern char * LookupClientID ( WinInfo *theWindow );
10914c0a534Smrg
110bf2eeab3Smrgextern WinInfo *win_head;
11114c0a534Smrg
11214c0a534Smrg#define SAVEFILE_VERSION 1
113