winglobals.c revision 6747b715
105b261ecSmrg/*
205b261ecSmrg *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
36747b715Smrg *Copyright (C) Colin Harrison 2005-2008
405b261ecSmrg *
505b261ecSmrg *Permission is hereby granted, free of charge, to any person obtaining
605b261ecSmrg * a copy of this software and associated documentation files (the
705b261ecSmrg *"Software"), to deal in the Software without restriction, including
805b261ecSmrg *without limitation the rights to use, copy, modify, merge, publish,
905b261ecSmrg *distribute, sublicense, and/or sell copies of the Software, and to
1005b261ecSmrg *permit persons to whom the Software is furnished to do so, subject to
1105b261ecSmrg *the following conditions:
1205b261ecSmrg *
1305b261ecSmrg *The above copyright notice and this permission notice shall be
1405b261ecSmrg *included in all copies or substantial portions of the Software.
1505b261ecSmrg *
1605b261ecSmrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1705b261ecSmrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1805b261ecSmrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1905b261ecSmrg *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
2005b261ecSmrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2105b261ecSmrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2205b261ecSmrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2305b261ecSmrg *
2405b261ecSmrg *Except as contained in this notice, the name of Harold L Hunt II
2505b261ecSmrg *shall not be used in advertising or otherwise to promote the sale, use
2605b261ecSmrg *or other dealings in this Software without prior written authorization
2705b261ecSmrg *from Harold L Hunt II.
2805b261ecSmrg *
2905b261ecSmrg * Authors:	Harold L Hunt II
306747b715Smrg *              Colin Harrison
3105b261ecSmrg */
3205b261ecSmrg
3305b261ecSmrg#ifdef HAVE_XWIN_CONFIG_H
3405b261ecSmrg#include <xwin-config.h>
3505b261ecSmrg#endif
3605b261ecSmrg#include "win.h"
3705b261ecSmrg
3805b261ecSmrg
3905b261ecSmrg/*
4005b261ecSmrg * General global variables
4105b261ecSmrg */
4205b261ecSmrg
4305b261ecSmrgint		g_iNumScreens = 0;
446747b715SmrgwinScreenInfo * g_ScreenInfo = 0;
4505b261ecSmrg#ifdef HAS_DEVWINDOWS
4605b261ecSmrgint		g_fdMessageQueue = WIN_FD_INVALID;
4705b261ecSmrg#endif
486747b715SmrgDevPrivateKeyRec g_iScreenPrivateKeyRec;
496747b715SmrgDevPrivateKeyRec g_iCmapPrivateKeyRec;
506747b715SmrgDevPrivateKeyRec g_iGCPrivateKeyRec;
516747b715SmrgDevPrivateKeyRec g_iPixmapPrivateKeyRec;
526747b715SmrgDevPrivateKeyRec g_iWindowPrivateKeyRec;
5305b261ecSmrgunsigned long	g_ulServerGeneration = 0;
5405b261ecSmrgDWORD		g_dwEnginesSupported = 0;
5505b261ecSmrgHINSTANCE	g_hInstance = 0;
5605b261ecSmrgHWND		g_hDlgDepthChange = NULL;
5705b261ecSmrgHWND		g_hDlgExit = NULL;
5805b261ecSmrgHWND		g_hDlgAbout = NULL;
5905b261ecSmrgconst char *	g_pszQueryHost = NULL;
6005b261ecSmrgBool		g_fXdmcpEnabled = FALSE;
616747b715SmrgBool           g_fAuthEnabled = FALSE;
6205b261ecSmrgHICON		g_hIconX = NULL;
6305b261ecSmrgHICON		g_hSmallIconX = NULL;
6405b261ecSmrg#ifndef RELOCATE_PROJECTROOT
656747b715Smrgconst char *	g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
6605b261ecSmrg#else
676747b715Smrgconst char *	g_pszLogFile = "XWin.log";
6805b261ecSmrgBool		g_fLogFileChanged = FALSE;
6905b261ecSmrg#endif
7005b261ecSmrgint		g_iLogVerbose = 2;
7105b261ecSmrgBool		g_fLogInited = FALSE;
7205b261ecSmrgchar *		g_pszCommandLine = NULL;
7305b261ecSmrgBool		g_fSilentFatalError = FALSE;
7405b261ecSmrgDWORD		g_dwCurrentThreadID = 0;
7505b261ecSmrgBool		g_fKeyboardHookLL = FALSE;
7605b261ecSmrgHHOOK		g_hhookKeyboardLL = NULL;
7705b261ecSmrgHWND		g_hwndKeyboardFocus = NULL;
7805b261ecSmrgBool		g_fNoHelpMessageBox = FALSE;
7905b261ecSmrgBool		g_fSoftwareCursor = FALSE;
8005b261ecSmrgBool		g_fSilentDupError = FALSE;
816747b715SmrgBool            g_fNativeGl = FALSE;
8205b261ecSmrg
8305b261ecSmrg/*
8405b261ecSmrg * Global variables for dynamically loaded libraries and
8505b261ecSmrg * their function pointers
8605b261ecSmrg */
8705b261ecSmrg
8805b261ecSmrgHMODULE		g_hmodDirectDraw = NULL;
8905b261ecSmrgFARPROC		g_fpDirectDrawCreate = NULL;
9005b261ecSmrgFARPROC		g_fpDirectDrawCreateClipper = NULL;
9105b261ecSmrg
9205b261ecSmrgHMODULE		g_hmodCommonControls = NULL;
9305b261ecSmrgFARPROC		g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
9405b261ecSmrg
9505b261ecSmrg
9605b261ecSmrg#ifdef XWIN_CLIPBOARD
9705b261ecSmrg/*
9805b261ecSmrg * Wrapped DIX functions
9905b261ecSmrg */
10005b261ecSmrgwinDispatchProcPtr	winProcEstablishConnectionOrig = NULL;
10105b261ecSmrgwinDispatchProcPtr	winProcQueryTreeOrig = NULL;
10205b261ecSmrgwinDispatchProcPtr	winProcSetSelectionOwnerOrig = NULL;
10305b261ecSmrg
10405b261ecSmrg
10505b261ecSmrg/*
10605b261ecSmrg * Clipboard variables
10705b261ecSmrg */
10805b261ecSmrg
10905b261ecSmrgBool			g_fUnicodeClipboard = TRUE;
1106747b715SmrgBool			g_fClipboard = TRUE;
11105b261ecSmrgBool			g_fClipboardLaunched = FALSE;
11205b261ecSmrgBool			g_fClipboardStarted = FALSE;
11305b261ecSmrgpthread_t		g_ptClipboardProc;
11405b261ecSmrgHWND			g_hwndClipboard = NULL;
11505b261ecSmrgvoid			*g_pClipboardDisplay = NULL;
11605b261ecSmrgWindow			g_iClipboardWindow = None;
11705b261ecSmrgAtom			g_atomLastOwnedSelection = None;
11805b261ecSmrg#endif
11905b261ecSmrg
12005b261ecSmrg
12105b261ecSmrg/*
12205b261ecSmrg * Re-initialize global variables that are invalidated
12305b261ecSmrg * by a server reset.
12405b261ecSmrg */
12505b261ecSmrg
12605b261ecSmrgvoid
12705b261ecSmrgwinInitializeGlobals (void)
12805b261ecSmrg{
12905b261ecSmrg  g_dwCurrentThreadID = GetCurrentThreadId ();
13005b261ecSmrg  g_hwndKeyboardFocus = NULL;
13105b261ecSmrg#ifdef XWIN_CLIPBOARD
13205b261ecSmrg  g_fClipboardLaunched = FALSE;
13305b261ecSmrg  g_fClipboardStarted = FALSE;
13405b261ecSmrg  g_iClipboardWindow = None;
13505b261ecSmrg  g_pClipboardDisplay = NULL;
13605b261ecSmrg  g_atomLastOwnedSelection = None;
13705b261ecSmrg  g_hwndClipboard = NULL;
13805b261ecSmrg#endif
13905b261ecSmrg}
140