diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-10-15 13:00:46 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-10-19 15:01:55 +0100 |
commit | 49b996faadf0fedcee25d4a8f96f4c4007c29f5f (patch) | |
tree | 6150194042065270575ac753f8646e05368991a7 | |
parent | 6f12277e37d16a7de9d3f3079688c43b07921b0a (diff) |
Cygwin/X: Make g_hmodDirectDraw static
Add winReleaseDDProcAddresses() for releasing the direct draw module
handle, so g_hmodDirectDraw can be made static
Remove unneeded duplicate extern definitions of g_fpDirectDrawCreate
and g_fpDirectDrawCreateClipper, and move the definition from
winglobals.c to winengine.c
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
-rw-r--r-- | hw/xwin/InitOutput.c | 12 | ||||
-rw-r--r-- | hw/xwin/win.h | 4 | ||||
-rw-r--r-- | hw/xwin/winengine.c | 24 | ||||
-rw-r--r-- | hw/xwin/winglobals.c | 4 |
4 files changed, 24 insertions, 20 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 5ed3e74e5..63fca3abb 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -90,10 +90,6 @@ extern HWND g_hwndClipboard; extern Bool g_fClipboard; #endif -extern HMODULE g_hmodDirectDraw; -extern FARPROC g_fpDirectDrawCreate; -extern FARPROC g_fpDirectDrawCreateClipper; - extern HMODULE g_hmodCommonControls; extern FARPROC g_fpTrackMouseEvent; extern Bool g_fNoHelpMessageBox; @@ -258,13 +254,7 @@ ddxGiveUp (void) * At this point we aren't creating any new screens, so * we are guaranteed to not need the DirectDraw functions. */ - if (g_hmodDirectDraw != NULL) - { - FreeLibrary (g_hmodDirectDraw); - g_hmodDirectDraw = NULL; - g_fpDirectDrawCreate = NULL; - g_fpDirectDrawCreateClipper = NULL; - } + winReleaseDDProcAddresses(); /* Unload our TrackMouseEvent function pointer */ if (g_hmodCommonControls != NULL) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 1b1358cda..f197def56 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -653,7 +653,6 @@ extern DeviceIntPtr g_pwinKeyboard; * Extern declares for dynamically loaded libraries and function pointers */ -extern HMODULE g_hmodDirectDraw; extern FARPROC g_fpDirectDrawCreate; extern FARPROC g_fpDirectDrawCreateClipper; @@ -859,6 +858,9 @@ winSetEngine (ScreenPtr pScreen); Bool winGetDDProcAddresses (void); +void +winReleaseDDProcAddresses(void); + /* * winerror.c diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c index fb9aed8a0..e866e1ea1 100644 --- a/hw/xwin/winengine.c +++ b/hw/xwin/winengine.c @@ -34,13 +34,17 @@ #include "win.h" #include "winmsg.h" - /* - * External global variables + * Global variables for function pointers into + * dynamically loaded libraries */ +FARPROC g_fpDirectDrawCreate = NULL; +FARPROC g_fpDirectDrawCreateClipper = NULL; -extern const GUID _IID_IDirectDraw4; - +/* + module handle for dynamically loaded directdraw library +*/ +static HMODULE g_hmodDirectDraw = NULL; /* * Detect engines supported by current Windows version @@ -334,3 +338,15 @@ winGetDDProcAddresses (void) return fReturn; } + +void +winReleaseDDProcAddresses(void) +{ + if (g_hmodDirectDraw != NULL) + { + FreeLibrary (g_hmodDirectDraw); + g_hmodDirectDraw = NULL; + g_fpDirectDrawCreate = NULL; + g_fpDirectDrawCreateClipper = NULL; + } +} diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index 55b0f16d4..da1712988 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -84,10 +84,6 @@ Bool g_fNativeGl = FALSE; * their function pointers */ -HMODULE g_hmodDirectDraw = NULL; -FARPROC g_fpDirectDrawCreate = NULL; -FARPROC g_fpDirectDrawCreateClipper = NULL; - HMODULE g_hmodCommonControls = NULL; FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA; |