winglobals.c revision 6747b715
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; 76HHOOK g_hhookKeyboardLL = NULL; 77HWND g_hwndKeyboardFocus = NULL; 78Bool g_fNoHelpMessageBox = FALSE; 79Bool g_fSoftwareCursor = FALSE; 80Bool g_fSilentDupError = FALSE; 81Bool g_fNativeGl = FALSE; 82 83/* 84 * Global variables for dynamically loaded libraries and 85 * their function pointers 86 */ 87 88HMODULE g_hmodDirectDraw = NULL; 89FARPROC g_fpDirectDrawCreate = NULL; 90FARPROC g_fpDirectDrawCreateClipper = NULL; 91 92HMODULE g_hmodCommonControls = NULL; 93FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; 94 95 96#ifdef XWIN_CLIPBOARD 97/* 98 * Wrapped DIX functions 99 */ 100winDispatchProcPtr winProcEstablishConnectionOrig = NULL; 101winDispatchProcPtr winProcQueryTreeOrig = NULL; 102winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; 103 104 105/* 106 * Clipboard variables 107 */ 108 109Bool g_fUnicodeClipboard = TRUE; 110Bool g_fClipboard = TRUE; 111Bool g_fClipboardLaunched = FALSE; 112Bool g_fClipboardStarted = FALSE; 113pthread_t g_ptClipboardProc; 114HWND g_hwndClipboard = NULL; 115void *g_pClipboardDisplay = NULL; 116Window g_iClipboardWindow = None; 117Atom g_atomLastOwnedSelection = None; 118#endif 119 120 121/* 122 * Re-initialize global variables that are invalidated 123 * by a server reset. 124 */ 125 126void 127winInitializeGlobals (void) 128{ 129 g_dwCurrentThreadID = GetCurrentThreadId (); 130 g_hwndKeyboardFocus = NULL; 131#ifdef XWIN_CLIPBOARD 132 g_fClipboardLaunched = FALSE; 133 g_fClipboardStarted = FALSE; 134 g_iClipboardWindow = None; 135 g_pClipboardDisplay = NULL; 136 g_atomLastOwnedSelection = None; 137 g_hwndClipboard = NULL; 138#endif 139} 140