From 4c5de7a7b06a9d3d39db07d75e1e4f753dfd205c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 30 Oct 2012 17:20:16 +0100 Subject: [PATCH 1/3] Fixed selection flag not being used. --- src/win32_fullscreen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32_fullscreen.c b/src/win32_fullscreen.c index 35d75054..045fecab 100644 --- a/src/win32_fullscreen.c +++ b/src/win32_fullscreen.c @@ -130,7 +130,7 @@ void _glfwSetVideoMode(int* width, int* height, closestRate = *refreshRate; if (getClosestVideoMode(&closestWidth, &closestHeight, - &closestBPP, &closestRate, GL_FALSE)) + &closestBPP, &closestRate, exactBPP)) { dm.dmSize = sizeof(DEVMODE); dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; From a9d1fdfc44de37e9a4c2837cd75a56c4a0608826 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 30 Oct 2012 17:37:34 +0100 Subject: [PATCH 2/3] Fixed VC++ warnings. --- src/win32_fullscreen.c | 2 +- src/win32_input.c | 4 ++++ src/win32_window.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/win32_fullscreen.c b/src/win32_fullscreen.c index 045fecab..26740d11 100644 --- a/src/win32_fullscreen.c +++ b/src/win32_fullscreen.c @@ -43,7 +43,7 @@ static GLboolean getClosestVideoMode(int* width, int* height, int* bpp, int* refreshRate, GLboolean exactBPP) { - int mode, bestWidth, bestHeight, bestBPP, bestRate; + int mode, bestWidth = 0, bestHeight = 0, bestBPP = 0, bestRate = 0; unsigned int sizeDiff, rateDiff, leastSizeDiff, leastRateDiff; GLboolean foundMode = GL_FALSE; DEVMODE dm; diff --git a/src/win32_input.c b/src/win32_input.c index a9195838..2178b145 100644 --- a/src/win32_input.c +++ b/src/win32_input.c @@ -106,6 +106,8 @@ static LRESULT CALLBACK keyboardHook(int nCode, WPARAM wParam, LPARAM lParam) void _glfwPlatformEnableSystemKeys(_GLFWwindow* window) { + UNREFERENCED_PARAMETER(window); + if (_glfwLibrary.Win32.keyboardHook != NULL) { UnhookWindowsHookEx(_glfwLibrary.Win32.keyboardHook); @@ -120,6 +122,8 @@ void _glfwPlatformEnableSystemKeys(_GLFWwindow* window) void _glfwPlatformDisableSystemKeys(_GLFWwindow* window) { + UNREFERENCED_PARAMETER(window); + _glfwLibrary.Win32.keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyboardHook, _glfwLibrary.Win32.instance, diff --git a/src/win32_window.c b/src/win32_window.c index 6bb9509d..75c8a8c1 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -41,6 +41,7 @@ static void hideCursor(_GLFWwindow* window) { + UNREFERENCED_PARAMETER(window); } @@ -69,6 +70,8 @@ static void captureCursor(_GLFWwindow* window) static void showCursor(_GLFWwindow* window) { + UNREFERENCED_PARAMETER(window); + // Un-capture cursor ReleaseCapture(); From ad7bf4beba40f4b14ab4ee072742906d395ea9e2 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 5 Nov 2012 16:19:11 +0100 Subject: [PATCH 3/3] Replaced ad-hoc Linux detection with __linux__. --- CMakeLists.txt | 4 ---- src/config.h.in | 3 --- src/x11_init.c | 2 +- src/x11_joystick.c | 20 ++++++++++---------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abfee8c9..a7d0625a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,10 +185,6 @@ if (_GLFW_X11_GLX) set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -ldl") endif() endif() - - if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - set(_GLFW_HAS_LINUX_JOYSTICKS 1) - endif() endif() #-------------------------------------------------------------------- diff --git a/src/config.h.in b/src/config.h.in index a432d947..4a8c1e3f 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -63,9 +63,6 @@ // Define this to 1 if glXGetProcAddressEXT is available #cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT -// Define this to 1 if the Linux joystick API is available -#cmakedefine _GLFW_HAS_LINUX_JOYSTICKS - // The GLFW version as used by glfwGetVersionString #define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@" diff --git a/src/x11_init.c b/src/x11_init.c index 60a0add3..3fbbd608 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -719,7 +719,7 @@ const char* _glfwPlatformGetVersionString(void) #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) " clock_gettime" #endif -#if defined(_GLFW_HAS_LINUX_JOYSTICKS) +#if defined(__linux__) " Linux-joystick-API" #else " no-joystick-support" diff --git a/src/x11_joystick.c b/src/x11_joystick.c index 3d2f597d..93ab3e7f 100644 --- a/src/x11_joystick.c +++ b/src/x11_joystick.c @@ -30,7 +30,7 @@ #include "internal.h" -#ifdef _GLFW_HAS_LINUX_JOYSTICKS +#ifdef __linux__ #include #include @@ -41,7 +41,7 @@ #include #include #include -#endif // _GLFW_HAS_LINUX_JOYSTICKS +#endif // __linux__ //======================================================================== @@ -50,7 +50,7 @@ static int openJoystickDevice(int joy, const char* path) { -#ifdef _GLFW_HAS_LINUX_JOYSTICKS +#ifdef __linux__ char numAxes, numButtons; int fd, version; @@ -97,7 +97,7 @@ static int openJoystickDevice(int joy, const char* path) } _glfwLibrary.X11.joystick[joy].present = GL_TRUE; -#endif // _GLFW_HAS_LINUX_JOYSTICKS +#endif // __linux__ return GL_TRUE; } @@ -109,7 +109,7 @@ static int openJoystickDevice(int joy, const char* path) static void pollJoystickEvents(void) { -#ifdef _GLFW_HAS_LINUX_JOYSTICKS +#ifdef __linux__ int i; ssize_t result; struct js_event e; @@ -160,7 +160,7 @@ static void pollJoystickEvents(void) } } } -#endif // _GLFW_HAS_LINUX_JOYSTICKS +#endif // __linux__ } @@ -174,7 +174,7 @@ static void pollJoystickEvents(void) int _glfwInitJoysticks(void) { -#ifdef _GLFW_HAS_LINUX_JOYSTICKS +#ifdef __linux__ int i, joy = 0; regex_t regex; DIR* dir; @@ -215,7 +215,7 @@ int _glfwInitJoysticks(void) } regfree(®ex); -#endif // _GLFW_HAS_LINUX_JOYSTICKS +#endif // __linux__ return GL_TRUE; } @@ -227,7 +227,7 @@ int _glfwInitJoysticks(void) void _glfwTerminateJoysticks(void) { -#ifdef _GLFW_HAS_LINUX_JOYSTICKS +#ifdef __linux__ int i; for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) @@ -241,7 +241,7 @@ void _glfwTerminateJoysticks(void) _glfwLibrary.X11.joystick[i].present = GL_FALSE; } } -#endif // _GLFW_HAS_LINUX_JOYSTICKS +#endif // __linux__ }