1/* 2 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. 3 *Copyright (C) Colin Harrison 2005-2008 4 * 5 *Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files (the 7 *"Software"), to deal in the Software without restriction, including 8 *without limitation the rights to use, copy, modify, merge, publish, 9 *distribute, sublicense, and/or sell copies of the Software, and to 10 *permit persons to whom the Software is furnished to do so, subject to 11 *the following conditions: 12 * 13 *The above copyright notice and this permission notice shall be 14 *included in all copies or substantial portions of the Software. 15 * 16 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR 20 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 21 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * 24 *Except as contained in this notice, the name of Harold L Hunt II 25 *shall not be used in advertising or otherwise to promote the sale, use 26 *or other dealings in this Software without prior written authorization 27 *from Harold L Hunt II. 28 * 29 * Authors: Harold L Hunt II 30 * Colin Harrison 31 */ 32 33#ifdef HAVE_XWIN_CONFIG_H 34#include <xwin-config.h> 35#endif 36#include "win.h" 37 38 39/* 40 * General global variables 41 */ 42 43int g_iNumScreens = 0; 44winScreenInfo * g_ScreenInfo = 0; 45#ifdef HAS_DEVWINDOWS 46int g_fdMessageQueue = WIN_FD_INVALID; 47#endif 48DevPrivateKeyRec g_iScreenPrivateKeyRec; 49DevPrivateKeyRec g_iCmapPrivateKeyRec; 50DevPrivateKeyRec g_iGCPrivateKeyRec; 51DevPrivateKeyRec g_iPixmapPrivateKeyRec; 52DevPrivateKeyRec g_iWindowPrivateKeyRec; 53unsigned long g_ulServerGeneration = 0; 54DWORD g_dwEnginesSupported = 0; 55HINSTANCE g_hInstance = 0; 56HWND g_hDlgDepthChange = NULL; 57HWND g_hDlgExit = NULL; 58HWND g_hDlgAbout = NULL; 59const char * g_pszQueryHost = NULL; 60Bool g_fXdmcpEnabled = FALSE; 61Bool g_fAuthEnabled = FALSE; 62HICON g_hIconX = NULL; 63HICON g_hSmallIconX = NULL; 64#ifndef RELOCATE_PROJECTROOT 65const char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log"; 66#else 67const char * g_pszLogFile = "XWin.log"; 68Bool g_fLogFileChanged = FALSE; 69#endif 70int g_iLogVerbose = 2; 71Bool g_fLogInited = FALSE; 72char * g_pszCommandLine = NULL; 73Bool g_fSilentFatalError = FALSE; 74DWORD g_dwCurrentThreadID = 0; 75Bool g_fKeyboardHookLL = FALSE; 76Bool g_fNoHelpMessageBox = FALSE; 77Bool g_fSoftwareCursor = FALSE; 78Bool g_fSilentDupError = FALSE; 79Bool g_fNativeGl = FALSE; 80 81/* 82 * Global variables for dynamically loaded libraries and 83 * their function pointers 84 */ 85 86FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; 87 88 89#ifdef XWIN_CLIPBOARD 90/* 91 * Wrapped DIX functions 92 */ 93winDispatchProcPtr winProcEstablishConnectionOrig = NULL; 94winDispatchProcPtr winProcQueryTreeOrig = NULL; 95winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; 96 97 98/* 99 * Clipboard variables 100 */ 101 102Bool g_fUnicodeClipboard = TRUE; 103Bool g_fClipboard = TRUE; 104Bool g_fClipboardLaunched = FALSE; 105Bool g_fClipboardStarted = FALSE; 106pthread_t g_ptClipboardProc; 107HWND g_hwndClipboard = NULL; 108void *g_pClipboardDisplay = NULL; 109Window g_iClipboardWindow = None; 110Atom g_atomLastOwnedSelection = None; 111#endif 112 113 114/* 115 * Re-initialize global variables that are invalidated 116 * by a server reset. 117 */ 118 119void 120winInitializeGlobals (void) 121{ 122 g_dwCurrentThreadID = GetCurrentThreadId (); 123#ifdef XWIN_CLIPBOARD 124 g_fClipboardLaunched = FALSE; 125 g_fClipboardStarted = FALSE; 126 g_iClipboardWindow = None; 127 g_pClipboardDisplay = NULL; 128 g_atomLastOwnedSelection = None; 129 g_hwndClipboard = NULL; 130#endif 131} 132