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>
This commit is contained in:
Jon TURNEY 2010-10-15 13:00:46 +01:00
parent 6f12277e37
commit 49b996faad
4 changed files with 25 additions and 21 deletions

View File

@ -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)

View File

@ -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

View File

@ -34,13 +34,17 @@
#include "win.h"
#include "winmsg.h"
/*
* Global variables for function pointers into
* dynamically loaded libraries
*/
FARPROC g_fpDirectDrawCreate = NULL;
FARPROC g_fpDirectDrawCreateClipper = NULL;
/*
* External global variables
*/
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;
}
}

View File

@ -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;