From 82dc6c8b8fff52495c178f09720e45eb4bc82512 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 15 Aug 2014 14:50:41 +0200 Subject: [PATCH] Removed option to disable loading of winmm. --- CMakeLists.txt | 9 +-------- README.md | 1 + src/glfw_config.h.in | 2 -- src/win32_init.c | 14 +------------- src/win32_platform.h | 30 ++++++++---------------------- 5 files changed, 11 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0173917..bc338bc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,14 +168,7 @@ endif() #-------------------------------------------------------------------- if (_GLFW_WIN32) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lgdi32 -lwinmm") - - # The DLL links against winmm; the static library loads it - # That way, both code paths receive testing - if (BUILD_SHARED_LIBS) - set(_GLFW_NO_DLOAD_WINMM 1) - list(APPEND glfw_LIBRARIES winmm) - endif() + set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lgdi32") if (GLFW_USE_DWM_SWAP_INTERVAL) set(_GLFW_USE_DWM_SWAP_INTERVAL 1) diff --git a/README.md b/README.md index 77911385..19ab8ef4 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ GLFW bundles a number of dependencies in the `deps/` directory. - [Cocoa] Bugfix: Joystick enumeration took hundreds of ms on some systems - [Cocoa] Bugfix: The cursor was hidden when the user resized a GLFW window - [Win32] Enabled generation of pkg-config file for MinGW + - [Win32] Removed option to require explicitly linking against `winmm.dll` - [Win32] Bugfix: Failure to load winmm or its functions was not reported to the error callback - [Win32] Bugfix: Some keys were reported based on the current layout instead diff --git a/src/glfw_config.h.in b/src/glfw_config.h.in index 76d4b718..11c2aa76 100644 --- a/src/glfw_config.h.in +++ b/src/glfw_config.h.in @@ -55,8 +55,6 @@ // Define this to 1 if building as a shared library / dynamic library / DLL #cmakedefine _GLFW_BUILD_DLL -// Define this to 1 to disable dynamic loading of winmm -#cmakedefine _GLFW_NO_DLOAD_WINMM // Define this to 1 if glfwSwapInterval should ignore DWM compositing status #cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL // Define this to 1 to force use of high-performance GPU on Optimus systems diff --git a/src/win32_init.c b/src/win32_init.c index a34908c7..1b551a79 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -60,9 +60,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) // static GLboolean initLibraries(void) { -#ifndef _GLFW_NO_DLOAD_WINMM - // winmm.dll (for joystick and timer support) - _glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll"); if (!_glfw.win32.winmm.instance) { @@ -89,7 +86,6 @@ static GLboolean initLibraries(void) "Win32: Failed to load winmm functions"); return GL_FALSE; } -#endif // _GLFW_NO_DLOAD_WINMM _glfw.win32.user32.instance = LoadLibraryW(L"user32.dll"); if (_glfw.win32.user32.instance) @@ -114,13 +110,8 @@ static GLboolean initLibraries(void) // static void terminateLibraries(void) { -#ifndef _GLFW_NO_DLOAD_WINMM - if (_glfw.win32.winmm.instance != NULL) - { + if (_glfw.win32.winmm.instance) FreeLibrary(_glfw.win32.winmm.instance); - _glfw.win32.winmm.instance = NULL; - } -#endif // _GLFW_NO_DLOAD_WINMM if (_glfw.win32.user32.instance) FreeLibrary(_glfw.win32.user32.instance); @@ -264,9 +255,6 @@ const char* _glfwPlatformGetVersionString(void) #elif defined(__BORLANDC__) " BorlandC" #endif -#if !defined(_GLFW_NO_DLOAD_WINMM) - " LoadLibrary(winmm)" -#endif #if defined(_GLFW_BUILD_DLL) " DLL" #endif diff --git a/src/win32_platform.h b/src/win32_platform.h index aa21d052..3040e85d 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -110,26 +110,14 @@ typedef struct tagCHANGEFILTERSTRUCT //======================================================================== // winmm.dll function pointer typedefs -#ifndef _GLFW_NO_DLOAD_WINMM -typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT); -typedef MMRESULT (WINAPI * JOYGETPOS_T) (UINT,LPJOYINFO); -typedef MMRESULT (WINAPI * JOYGETPOSEX_T) (UINT,LPJOYINFOEX); -typedef DWORD (WINAPI * TIMEGETTIME_T) (void); -#endif // _GLFW_NO_DLOAD_WINMM - - -// winmm.dll shortcuts -#ifndef _GLFW_NO_DLOAD_WINMM - #define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps - #define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos - #define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx - #define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime -#else - #define _glfw_joyGetDevCaps joyGetDevCaps - #define _glfw_joyGetPos joyGetPos - #define _glfw_joyGetPosEx joyGetPosEx - #define _glfw_timeGetTime timeGetTime -#endif // _GLFW_NO_DLOAD_WINMM +typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT); +typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO); +typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX); +typedef DWORD (WINAPI * TIMEGETTIME_T)(void); +#define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps +#define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos +#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx +#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime // user32.dll function pointer typedefs typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void); @@ -204,7 +192,6 @@ typedef struct _GLFWlibraryWin32 DWORD foregroundLockTimeout; char* clipboardString; -#ifndef _GLFW_NO_DLOAD_WINMM // winmm.dll struct { HINSTANCE instance; @@ -213,7 +200,6 @@ typedef struct _GLFWlibraryWin32 JOYGETPOSEX_T joyGetPosEx; TIMEGETTIME_T timeGetTime; } winmm; -#endif // _GLFW_NO_DLOAD_WINMM // user32.dll struct {