Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xwin / winglobals.c
CommitLineData
a09e091a
JB
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
42int g_iNumScreens = 0;
43winScreenInfo *g_ScreenInfo = 0;
44
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
65#ifndef RELOCATE_PROJECTROOT
66const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
67#else
68const char *g_pszLogFile = "XWin.log";
69Bool g_fLogFileChanged = FALSE;
70#endif
71int g_iLogVerbose = 2;
72Bool g_fLogInited = FALSE;
73char *g_pszCommandLine = NULL;
74Bool g_fSilentFatalError = FALSE;
75DWORD g_dwCurrentThreadID = 0;
76Bool g_fKeyboardHookLL = FALSE;
77Bool g_fNoHelpMessageBox = FALSE;
78Bool g_fSoftwareCursor = FALSE;
79Bool g_fSilentDupError = FALSE;
80Bool g_fNativeGl = TRUE;
81pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
82
83#ifdef XWIN_CLIPBOARD
84/*
85 * Wrapped DIX functions
86 */
87winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
88winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
89
90/*
91 * Clipboard variables
92 */
93
94Bool g_fUnicodeClipboard = TRUE;
95Bool g_fClipboard = TRUE;
96Bool g_fClipboardLaunched = FALSE;
97Bool g_fClipboardStarted = FALSE;
98pthread_t g_ptClipboardProc;
99HWND g_hwndClipboard = NULL;
100void *g_pClipboardDisplay = NULL;
101Window g_iClipboardWindow = None;
102Atom g_atomLastOwnedSelection = None;
103#endif
104
105/*
106 * Re-initialize global variables that are invalidated
107 * by a server reset.
108 */
109
110void
111winInitializeGlobals(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}