summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2010-10-14 22:38:17 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2010-10-19 15:02:00 +0100
commit25801a2556ca9b42646023e5a95a3cbf7309e852 (patch)
tree2eba10ed121a48c6de2bf1ade6872b97bec67168
parent04d11abcf2ea2f36d899428e9c885b69e4f779ad (diff)
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>
-rw-r--r--hw/xwin/InitInput.c15
-rw-r--r--hw/xwin/InitOutput.c25
-rw-r--r--hw/xwin/win.h9
-rw-r--r--hw/xwin/winblock.c10
-rw-r--r--hw/xwin/wincursor.c2
-rw-r--r--hw/xwin/windialogs.c12
-rw-r--r--hw/xwin/winerror.c7
-rw-r--r--hw/xwin/winglobals.c1
-rw-r--r--hw/xwin/winglobals.h88
-rw-r--r--hw/xwin/winmultiwindowicons.c7
-rw-r--r--hw/xwin/winmultiwindowwindow.c9
-rw-r--r--hw/xwin/winmultiwindowwndproc.c9
-rw-r--r--hw/xwin/winnativegdi.c7
-rw-r--r--hw/xwin/winpfbdd.c8
-rw-r--r--hw/xwin/winprefs.c11
-rw-r--r--hw/xwin/winprefs.h3
-rw-r--r--hw/xwin/winprocarg.c16
-rw-r--r--hw/xwin/winscrinit.c8
-rw-r--r--hw/xwin/winshaddd.c7
-rw-r--r--hw/xwin/winshadddnl.c7
-rw-r--r--hw/xwin/winshadgdi.c10
-rw-r--r--hw/xwin/winvalargs.c7
-rw-r--r--hw/xwin/winwakeup.c10
-rw-r--r--hw/xwin/winwin32rootlesswndproc.c8
-rw-r--r--hw/xwin/winwndproc.c11
25 files changed, 94 insertions, 213 deletions
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
index 0ffa94092..e9a9b11b4 100644
--- a/hw/xwin/InitInput.c
+++ b/hw/xwin/InitInput.c
@@ -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,
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index ae1d4154b..38a658d77 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -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
*/
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 4d6771ca5..f22a2d576 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -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;
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c
index abea60e0f..e165d5488 100644
--- a/hw/xwin/winblock.c
+++ b/hw/xwin/winblock.c
@@ -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,
diff --git a/hw/xwin/wincursor.c b/hw/xwin/wincursor.c
index 076d4756c..0ed1d1349 100644
--- a/hw/xwin/wincursor.c
+++ b/hw/xwin/wincursor.c
@@ -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
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 270ff788e..22d8cd7f7 100644
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -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
*/
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 01412dd1d..aadfd2858 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -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
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 2b6c8a8ad..2909f371b 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -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;
diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h
new file mode 100644
index 000000000..89926796c
--- /dev/null
+++ b/hw/xwin/winglobals.h
@@ -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 */
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index cb27d2fe3..1ca3f9141 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -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
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 731235042..7efc360a4 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -40,15 +40,6 @@
#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
*/
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index d14ceee9c..b559cd8cf 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -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);
diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c
index 48a467a2c..b8d2d351b 100644
--- a/hw/xwin/winnativegdi.c
+++ b/hw/xwin/winnativegdi.c
@@ -35,13 +35,6 @@
/*
- * External symbols
- */
-
-extern HWND g_hDlgExit;
-
-
-/*
* Local function prototypes
*/
diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index 13fc1058d..7859c6b19 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -38,14 +38,6 @@
/*
- * External symbols
- */
-
-extern const GUID _IID_IDirectDraw2;
-extern HWND g_hDlgExit;
-
-
-/*
* Local function prototypes
*/
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 1996ef0ef..4ccb4ffc2 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -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;
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 4daf47401..33b496df8 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -151,7 +151,8 @@ typedef struct WINPREFS
} WINPREFS;
-
+/* The global pref settings structure loaded by the winprefyacc.y parser */
+extern WINPREFS pref;
/* Functions */
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index edbd4bea0..1ce5c2dca 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -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;
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index cf65881fe..57a08846b 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -65,14 +65,6 @@ winMWExtWMProcs = {
};
#endif
-
-/*
- * References to external symbols
- */
-
-extern Bool g_fSoftwareCursor;
-
-
/*
* Prototypes
*/
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 2de496c09..4e284b9c1 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -38,13 +38,6 @@
/*
- * 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.
*/
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 0d59e6a6a..82fe4be36 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -38,13 +38,6 @@
/*
- * External symbols
- */
-
-extern HWND g_hDlgExit;
-
-
-/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.
*/
diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 8af4be478..4971851e5 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -35,16 +35,6 @@
/*
- * External symbols
- */
-
-#ifdef XWIN_MULTIWINDOW
-extern DWORD g_dwCurrentThreadID;
-#endif
-extern HWND g_hDlgExit;
-
-
-/*
* Local function prototypes
*/
diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c
index 6f8d1c994..357d3d70a 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -35,13 +35,6 @@
#include "winmsg.h"
-/*
- * References to external symbols
- */
-
-extern int g_iNumScreens;
-extern winScreenInfo * g_ScreenInfo;
-extern Bool g_fXdmcpEnabled;
/*
diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c
index e1eece34a..b512b29e8 100644
--- a/hw/xwin/winwakeup.c
+++ b/hw/xwin/winwakeup.c
@@ -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,
diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c
index 4d7afee42..21506df15 100644
--- a/hw/xwin/winwin32rootlesswndproc.c
+++ b/hw/xwin/winwin32rootlesswndproc.c
@@ -53,14 +53,6 @@
/*
- * Global variables
- */
-
-extern Bool g_fNoConfigureWindow;
-extern Bool g_fSoftwareCursor;
-
-
-/*
* Local globals
*/
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 4e4eff22c..6d2270a20 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -51,17 +51,6 @@ 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
*/