| 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 | * General global variables |
| 40 | */ |
| 41 | |
| 42 | int g_iNumScreens = 0; |
| 43 | winScreenInfo *g_ScreenInfo = 0; |
| 44 | |
| 45 | #ifdef HAS_DEVWINDOWS |
| 46 | int g_fdMessageQueue = WIN_FD_INVALID; |
| 47 | #endif |
| 48 | DevPrivateKeyRec g_iScreenPrivateKeyRec; |
| 49 | DevPrivateKeyRec g_iCmapPrivateKeyRec; |
| 50 | DevPrivateKeyRec g_iGCPrivateKeyRec; |
| 51 | DevPrivateKeyRec g_iPixmapPrivateKeyRec; |
| 52 | DevPrivateKeyRec g_iWindowPrivateKeyRec; |
| 53 | unsigned long g_ulServerGeneration = 0; |
| 54 | DWORD g_dwEnginesSupported = 0; |
| 55 | HINSTANCE g_hInstance = 0; |
| 56 | HWND g_hDlgDepthChange = NULL; |
| 57 | HWND g_hDlgExit = NULL; |
| 58 | HWND g_hDlgAbout = NULL; |
| 59 | const char *g_pszQueryHost = NULL; |
| 60 | Bool g_fXdmcpEnabled = FALSE; |
| 61 | Bool g_fAuthEnabled = FALSE; |
| 62 | HICON g_hIconX = NULL; |
| 63 | HICON g_hSmallIconX = NULL; |
| 64 | |
| 65 | #ifndef RELOCATE_PROJECTROOT |
| 66 | const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log"; |
| 67 | #else |
| 68 | const char *g_pszLogFile = "XWin.log"; |
| 69 | Bool g_fLogFileChanged = FALSE; |
| 70 | #endif |
| 71 | int g_iLogVerbose = 2; |
| 72 | Bool g_fLogInited = FALSE; |
| 73 | char *g_pszCommandLine = NULL; |
| 74 | Bool g_fSilentFatalError = FALSE; |
| 75 | DWORD g_dwCurrentThreadID = 0; |
| 76 | Bool g_fKeyboardHookLL = FALSE; |
| 77 | Bool g_fNoHelpMessageBox = FALSE; |
| 78 | Bool g_fSoftwareCursor = FALSE; |
| 79 | Bool g_fSilentDupError = FALSE; |
| 80 | Bool g_fNativeGl = TRUE; |
| 81 | pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER; |
| 82 | |
| 83 | #ifdef XWIN_CLIPBOARD |
| 84 | /* |
| 85 | * Wrapped DIX functions |
| 86 | */ |
| 87 | winDispatchProcPtr winProcEstablishConnectionOrig = NULL; |
| 88 | winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; |
| 89 | |
| 90 | /* |
| 91 | * Clipboard variables |
| 92 | */ |
| 93 | |
| 94 | Bool g_fUnicodeClipboard = TRUE; |
| 95 | Bool g_fClipboard = TRUE; |
| 96 | Bool g_fClipboardLaunched = FALSE; |
| 97 | Bool g_fClipboardStarted = FALSE; |
| 98 | pthread_t g_ptClipboardProc; |
| 99 | HWND g_hwndClipboard = NULL; |
| 100 | void *g_pClipboardDisplay = NULL; |
| 101 | Window g_iClipboardWindow = None; |
| 102 | Atom g_atomLastOwnedSelection = None; |
| 103 | #endif |
| 104 | |
| 105 | /* |
| 106 | * Re-initialize global variables that are invalidated |
| 107 | * by a server reset. |
| 108 | */ |
| 109 | |
| 110 | void |
| 111 | winInitializeGlobals(void) |
| 112 | { |
| 113 | g_dwCurrentThreadID = GetCurrentThreadId(); |
| 114 | #ifdef XWIN_CLIPBOARD |
| 115 | g_iClipboardWindow = None; |
| 116 | g_pClipboardDisplay = NULL; |
| 117 | g_atomLastOwnedSelection = None; |
| 118 | g_hwndClipboard = NULL; |
| 119 | #endif |
| 120 | } |