1706f2543Smrg/*
2706f2543Smrg *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
3706f2543Smrg *Copyright (C) Colin Harrison 2005-2008
4706f2543Smrg *
5706f2543Smrg *Permission is hereby granted, free of charge, to any person obtaining
6706f2543Smrg * a copy of this software and associated documentation files (the
7706f2543Smrg *"Software"), to deal in the Software without restriction, including
8706f2543Smrg *without limitation the rights to use, copy, modify, merge, publish,
9706f2543Smrg *distribute, sublicense, and/or sell copies of the Software, and to
10706f2543Smrg *permit persons to whom the Software is furnished to do so, subject to
11706f2543Smrg *the following conditions:
12706f2543Smrg *
13706f2543Smrg *The above copyright notice and this permission notice shall be
14706f2543Smrg *included in all copies or substantial portions of the Software.
15706f2543Smrg *
16706f2543Smrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17706f2543Smrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18706f2543Smrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19706f2543Smrg *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
20706f2543Smrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21706f2543Smrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22706f2543Smrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23706f2543Smrg *
24706f2543Smrg *Except as contained in this notice, the name of Harold L Hunt II
25706f2543Smrg *shall not be used in advertising or otherwise to promote the sale, use
26706f2543Smrg *or other dealings in this Software without prior written authorization
27706f2543Smrg *from Harold L Hunt II.
28706f2543Smrg *
29706f2543Smrg * Authors:	Harold L Hunt II
30706f2543Smrg *              Colin Harrison
31706f2543Smrg */
32706f2543Smrg
33706f2543Smrg#ifdef HAVE_XWIN_CONFIG_H
34706f2543Smrg#include <xwin-config.h>
35706f2543Smrg#endif
36706f2543Smrg#include "win.h"
37706f2543Smrg
38706f2543Smrg
39706f2543Smrg/*
40706f2543Smrg * General global variables
41706f2543Smrg */
42706f2543Smrg
43706f2543Smrgint		g_iNumScreens = 0;
44706f2543SmrgwinScreenInfo * g_ScreenInfo = 0;
45706f2543Smrg#ifdef HAS_DEVWINDOWS
46706f2543Smrgint		g_fdMessageQueue = WIN_FD_INVALID;
47706f2543Smrg#endif
48706f2543SmrgDevPrivateKeyRec g_iScreenPrivateKeyRec;
49706f2543SmrgDevPrivateKeyRec g_iCmapPrivateKeyRec;
50706f2543SmrgDevPrivateKeyRec g_iGCPrivateKeyRec;
51706f2543SmrgDevPrivateKeyRec g_iPixmapPrivateKeyRec;
52706f2543SmrgDevPrivateKeyRec g_iWindowPrivateKeyRec;
53706f2543Smrgunsigned long	g_ulServerGeneration = 0;
54706f2543SmrgDWORD		g_dwEnginesSupported = 0;
55706f2543SmrgHINSTANCE	g_hInstance = 0;
56706f2543SmrgHWND		g_hDlgDepthChange = NULL;
57706f2543SmrgHWND		g_hDlgExit = NULL;
58706f2543SmrgHWND		g_hDlgAbout = NULL;
59706f2543Smrgconst char *	g_pszQueryHost = NULL;
60706f2543SmrgBool		g_fXdmcpEnabled = FALSE;
61706f2543SmrgBool           g_fAuthEnabled = FALSE;
62706f2543SmrgHICON		g_hIconX = NULL;
63706f2543SmrgHICON		g_hSmallIconX = NULL;
64706f2543Smrg#ifndef RELOCATE_PROJECTROOT
65706f2543Smrgconst char *	g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
66706f2543Smrg#else
67706f2543Smrgconst char *	g_pszLogFile = "XWin.log";
68706f2543SmrgBool		g_fLogFileChanged = FALSE;
69706f2543Smrg#endif
70706f2543Smrgint		g_iLogVerbose = 2;
71706f2543SmrgBool		g_fLogInited = FALSE;
72706f2543Smrgchar *		g_pszCommandLine = NULL;
73706f2543SmrgBool		g_fSilentFatalError = FALSE;
74706f2543SmrgDWORD		g_dwCurrentThreadID = 0;
75706f2543SmrgBool		g_fKeyboardHookLL = FALSE;
76706f2543SmrgBool		g_fNoHelpMessageBox = FALSE;
77706f2543SmrgBool		g_fSoftwareCursor = FALSE;
78706f2543SmrgBool		g_fSilentDupError = FALSE;
79706f2543SmrgBool            g_fNativeGl = FALSE;
80706f2543Smrg
81706f2543Smrg/*
82706f2543Smrg * Global variables for dynamically loaded libraries and
83706f2543Smrg * their function pointers
84706f2543Smrg */
85706f2543Smrg
86706f2543SmrgFARPROC		g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
87706f2543Smrg
88706f2543Smrg
89706f2543Smrg#ifdef XWIN_CLIPBOARD
90706f2543Smrg/*
91706f2543Smrg * Wrapped DIX functions
92706f2543Smrg */
93706f2543SmrgwinDispatchProcPtr	winProcEstablishConnectionOrig = NULL;
94706f2543SmrgwinDispatchProcPtr	winProcQueryTreeOrig = NULL;
95706f2543SmrgwinDispatchProcPtr	winProcSetSelectionOwnerOrig = NULL;
96706f2543Smrg
97706f2543Smrg
98706f2543Smrg/*
99706f2543Smrg * Clipboard variables
100706f2543Smrg */
101706f2543Smrg
102706f2543SmrgBool			g_fUnicodeClipboard = TRUE;
103706f2543SmrgBool			g_fClipboard = TRUE;
104706f2543SmrgBool			g_fClipboardLaunched = FALSE;
105706f2543SmrgBool			g_fClipboardStarted = FALSE;
106706f2543Smrgpthread_t		g_ptClipboardProc;
107706f2543SmrgHWND			g_hwndClipboard = NULL;
108706f2543Smrgvoid			*g_pClipboardDisplay = NULL;
109706f2543SmrgWindow			g_iClipboardWindow = None;
110706f2543SmrgAtom			g_atomLastOwnedSelection = None;
111706f2543Smrg#endif
112706f2543Smrg
113706f2543Smrg
114706f2543Smrg/*
115706f2543Smrg * Re-initialize global variables that are invalidated
116706f2543Smrg * by a server reset.
117706f2543Smrg */
118706f2543Smrg
119706f2543Smrgvoid
120706f2543SmrgwinInitializeGlobals (void)
121706f2543Smrg{
122706f2543Smrg  g_dwCurrentThreadID = GetCurrentThreadId ();
123706f2543Smrg#ifdef XWIN_CLIPBOARD
124706f2543Smrg  g_fClipboardLaunched = FALSE;
125706f2543Smrg  g_fClipboardStarted = FALSE;
126706f2543Smrg  g_iClipboardWindow = None;
127706f2543Smrg  g_pClipboardDisplay = NULL;
128706f2543Smrg  g_atomLastOwnedSelection = None;
129706f2543Smrg  g_hwndClipboard = NULL;
130706f2543Smrg#endif
131706f2543Smrg}
132