Cygwin/X: Move duplicate extern variable declarations from various .c files to a new header file

For the global variables defined in winglobals.c, remove duplicate extern
declarations from the beginning of various .c files, and move most of them
into a new header file, winglobals.h

Leave some clipboard related variables alone for the moment, they need treating
more carefully, to avoid mixing client and server type definitions.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2010-10-14 22:38:17 +01:00
parent 04d11abcf2
commit 25801a2556
25 changed files with 94 additions and 213 deletions

View File

@ -52,21 +52,6 @@ int winProcSetSelectionOwner(ClientPtr /* client */);
DeviceIntPtr g_pwinPointer;
DeviceIntPtr g_pwinKeyboard;
/*
* References to external symbols
*/
#ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue;
#endif
extern Bool g_fXdmcpEnabled;
#ifdef XWIN_CLIPBOARD
extern winDispatchProcPtr winProcEstablishConnectionOrig;
extern winDispatchProcPtr winProcQueryTreeOrig;
#endif
/* Called from dix/devices.c */
/*
* All of our keys generate up and down transition notifications,

View File

@ -58,29 +58,9 @@ typedef HRESULT (*SHGETFOLDERPATHPROC)(
);
#endif
/*
* References to external symbols
*/
extern int g_iNumScreens;
extern winScreenInfo * g_ScreenInfo;
extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError;
extern const char * g_pszLogFile;
extern Bool g_fLogFileChanged;
extern int g_iLogVerbose;
Bool g_fLogInited;
extern Bool g_fXdmcpEnabled;
extern Bool g_fAuthEnabled;
#ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue;
#endif
extern const char * g_pszQueryHost;
extern HINSTANCE g_hInstance;
#ifdef XWIN_CLIPBOARD
extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboardLaunched;
@ -91,11 +71,6 @@ extern Bool g_fClipboard;
#endif
extern FARPROC g_fpTrackMouseEvent;
extern Bool g_fNoHelpMessageBox;
extern Bool g_fSilentDupError;
extern Bool g_fNativeGl;
/*
module handle for dynamically loaded comctl32 library
*/

View File

@ -314,9 +314,6 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
/* Typedef for DIX wrapper functions */
typedef int (*winDispatchProcPtr) (ClientPtr);
/*
* GC (graphics context) privates
@ -622,6 +619,8 @@ typedef struct {
* Extern declares for general global variables
*/
#include "winglobals.h"
extern winScreenInfo * g_ScreenInfo;
extern miPointerScreenFuncRec g_winPointerCursorFuncs;
extern DWORD g_dwEvents;
@ -648,14 +647,12 @@ extern const char * g_pszQueryHost;
extern DeviceIntPtr g_pwinPointer;
extern DeviceIntPtr g_pwinKeyboard;
/*
* Extern declares for dynamically loaded libraries and function pointers
* Extern declares for dynamically loaded library function pointers
*/
extern FARPROC g_fpDirectDrawCreate;
extern FARPROC g_fpDirectDrawCreateClipper;
extern FARPROC g_fpTrackMouseEvent;

View File

@ -34,16 +34,6 @@
#include "win.h"
#include "winmsg.h"
/*
* References to external symbols
*/
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
extern HWND g_hDlgAbout;
/* See Porting Layer Definition - p. 6 */
void
winBlockHandler (int nScreen,

View File

@ -41,8 +41,6 @@
#include <servermd.h>
#include "misc.h"
extern Bool g_fSoftwareCursor;
#define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
#if 0

View File

@ -44,21 +44,9 @@
* References to external globals
*/
extern Bool g_fCursor;
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
extern HWND g_hDlgAbout;
extern WINPREFS pref;
#ifdef XWIN_CLIPBOARD
extern Bool g_fClipboardStarted;
#endif
extern Bool g_fSoftwareCursor;
#if defined(XWIN_MULTIWINDOW)
extern HICON g_hIconX;
extern HICON g_hSmallIconX;
#endif
/*
* Local function prototypes
*/

View File

@ -35,13 +35,6 @@
#include <../xfree86/common/xorgVersion.h>
#include "win.h"
/* References to external symbols */
extern char * g_pszCommandLine;
extern const char * g_pszLogFile;
extern Bool g_fSilentFatalError;
extern Bool g_fLogInited;
#ifdef DDXOSVERRORF
/* Prototype */
void

View File

@ -82,6 +82,7 @@ Bool g_fNativeGl = FALSE;
* Global variables for dynamically loaded libraries and
* their function pointers
*/
FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;

88
hw/xwin/winglobals.h Normal file
View File

@ -0,0 +1,88 @@
/*
File: winglobals.h
Purpose: declarations for global variables
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef WINGLOBALS_H
#define WINGLOBALS_H
/*
* References to external symbols
*/
extern int g_iNumScreens;
extern int g_iLastScreen;
extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError;
extern const char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged;
#endif
extern int g_iLogVerbose;
extern Bool g_fLogInited;
extern Bool g_fAuthEnabled;
extern Bool g_fXdmcpEnabled;
extern Bool g_fNoHelpMessageBox;
extern Bool g_fSilentDupError;
extern Bool g_fNativeGl;
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
extern HWND g_hDlgAbout;
extern Bool g_fSoftwareCursor;
extern Bool g_fCursor;
#ifdef XWIN_CLIPBOARD
/* Typedef for DIX wrapper functions */
typedef int (*winDispatchProcPtr) (ClientPtr);
/*
* Wrapped DIX functions
*/
extern winDispatchProcPtr winProcEstablishConnectionOrig;
extern winDispatchProcPtr winProcQueryTreeOrig;
extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
#endif
/* The global X default icons */
#if defined(XWIN_MULTIWINDOW)
extern HICON g_hIconX;
extern HICON g_hSmallIconX;
#endif
#ifdef XWIN_MULTIWINDOW
extern DWORD g_dwCurrentThreadID;
#endif
extern Bool g_fKeyboardHookLL;
extern Bool g_fButton[3];
#ifdef XWIN_MULTIWINDOWEXTWM
extern Bool g_fNoConfigureWindow;
#endif
#endif /* WINGLOBALS_H */

View File

@ -41,13 +41,6 @@
#include "propertyst.h"
#include "windowstr.h"
/*
* External global variables
*/
extern HICON g_hIconX;
extern HICON g_hSmallIconX;
/*
* Prototypes for local functions

View File

@ -39,15 +39,6 @@
#include "dixevents.h"
#include "winmultiwindowclass.h"
/*
* External global variables
*/
extern HICON g_hIconX;
extern HICON g_hSmallIconX;
extern HWND g_hDlgDepthChange;
extern Bool g_fNativeGl;
/*
* Prototypes for local functions
*/

View File

@ -42,15 +42,6 @@
#include "winmsg.h"
#include "inputstr.h"
/*
* External global variables
*/
extern Bool g_fCursor;
extern Bool g_fKeyboardHookLL;
extern Bool g_fSoftwareCursor;
extern Bool g_fButton[3];
extern void winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);

View File

@ -34,13 +34,6 @@
#include "win.h"
/*
* External symbols
*/
extern HWND g_hDlgExit;
/*
* Local function prototypes
*/

View File

@ -37,14 +37,6 @@
#include "win.h"
/*
* External symbols
*/
extern const GUID _IID_IDirectDraw2;
extern HWND g_hDlgExit;
/*
* Local function prototypes
*/

View File

@ -49,22 +49,11 @@
/* Where will the custom menu commands start counting from? */
#define STARTMENUID WM_USER
/* External global variables */
#ifdef XWIN_MULTIWINDOW
extern DWORD g_dwCurrentThreadID;
#endif
extern const char *winGetBaseDir(void);
/* From winmultiwindowflex.l, the real parser */
extern void parse_file (FILE *fp);
/* From winprefyacc.y, the pref structure loaded by the parser */
extern WINPREFS pref;
/* The global X default icon */
extern HICON g_hIconX;
extern HICON g_hSmallIconX;
/* Currently in use command ID, incremented each new menu item created */
static int g_cmdid = STARTMENUID;

View File

@ -151,7 +151,8 @@ typedef struct WINPREFS
} WINPREFS;
/* The global pref settings structure loaded by the winprefyacc.y parser */
extern WINPREFS pref;
/* Functions */

View File

@ -40,26 +40,10 @@ from The Open Group.
* References to external symbols
*/
extern int g_iNumScreens;
extern winScreenInfo * g_ScreenInfo;
#ifdef XWIN_CLIPBOARD
extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard;
#endif
extern int g_iLogVerbose;
extern const char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged;
#endif
extern Bool g_fXdmcpEnabled;
extern Bool g_fAuthEnabled;
extern char * g_pszCommandLine;
extern Bool g_fKeyboardHookLL;
extern Bool g_fNoHelpMessageBox;
extern Bool g_fSoftwareCursor;
extern Bool g_fSilentDupError;
extern Bool g_fNativeGl;
/* globals required by callback function for monitor information */
struct GetMonitorInfoData {
int requestedMonitor;

View File

@ -65,14 +65,6 @@ winMWExtWMProcs = {
};
#endif
/*
* References to external symbols
*/
extern Bool g_fSoftwareCursor;
/*
* Prototypes
*/

View File

@ -37,13 +37,6 @@
#include "win.h"
/*
* External symbols
*/
extern HWND g_hDlgExit;
extern const char *g_pszLogFile;
/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.

View File

@ -37,13 +37,6 @@
#include "win.h"
/*
* External symbols
*/
extern HWND g_hDlgExit;
/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.

View File

@ -34,16 +34,6 @@
#include "win.h"
/*
* External symbols
*/
#ifdef XWIN_MULTIWINDOW
extern DWORD g_dwCurrentThreadID;
#endif
extern HWND g_hDlgExit;
/*
* Local function prototypes
*/

View File

@ -35,13 +35,6 @@
#include "winmsg.h"
/*
* References to external symbols
*/
extern int g_iNumScreens;
extern winScreenInfo * g_ScreenInfo;
extern Bool g_fXdmcpEnabled;
/*

View File

@ -36,16 +36,6 @@
#endif
#include "win.h"
/*
* References to external symbols
*/
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
extern HWND g_hDlgAbout;
/* See Porting Layer Definition - p. 7 */
void
winWakeupHandler (int nScreen,

View File

@ -52,14 +52,6 @@
#define RAISE_ON_CLICK_DEFAULT FALSE
/*
* Global variables
*/
extern Bool g_fNoConfigureWindow;
extern Bool g_fSoftwareCursor;
/*
* Local globals
*/

View File

@ -50,17 +50,6 @@ Bool g_fCursor = TRUE;
Bool g_fButton[3] = { FALSE, FALSE, FALSE };
/*
* References to external symbols
*/
extern Bool g_fClipboard;
extern HWND g_hDlgDepthChange;
extern Bool g_fKeyboardHookLL;
extern Bool g_fSoftwareCursor;
extern DWORD g_dwCurrentThreadID;
/*
* Called by winWakeupHandler
* Processes current Windows message