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