From 7cb6b245e86bdab44bcef37915f77fa8869d8e1d Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Fri, 4 Jan 2013 19:14:27 -0600 Subject: [PATCH 1/3] Fix invalid variable declarations in win32_monitor.c This fixes build errors in visual studio on windows. --- src/win32_monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 7b0d3925..b23dcd5a 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -56,6 +56,7 @@ int _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode) { GLFWvidmode current; const GLFWvidmode* best; + DEVMODE dm; best = _glfwChooseVideoMode(monitor, mode); @@ -63,7 +64,6 @@ int _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode) if (_glfwCompareVideoModes(¤t, best) == 0) return GL_TRUE; - DEVMODE dm; dm.dmSize = sizeof(DEVMODE); dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; dm.dmPelsWidth = best->width; @@ -120,6 +120,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) DEVMODE settings; char* name; HDC dc; + GLboolean primary; ZeroMemory(&adapter, sizeof(DISPLAY_DEVICE)); adapter.cb = sizeof(DISPLAY_DEVICE); @@ -171,7 +172,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) EnumDisplayDevices(adapter.DeviceName, 0, &monitor, 0); dc = CreateDC(L"DISPLAY", monitor.DeviceString, NULL, NULL); - const GLboolean primary = adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE; + primary = adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE; monitors[found] = _glfwCreateMonitor(name, primary, GetDeviceCaps(dc, HORZSIZE), From 516279609439e7031203bd618d5593bae0cd4aed Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 6 Jan 2013 12:31:47 -0500 Subject: [PATCH 2/3] Threads still need to be linked with static library --- tests/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 30201265..d6629933 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -24,7 +24,7 @@ endif() set(GETOPT ${GLFW_SOURCE_DIR}/support/getopt.h ${GLFW_SOURCE_DIR}/support/getopt.c) set(TINYCTHREAD ${GLFW_SOURCE_DIR}/support/tinycthread.h - ${GLFW_SOURCE_DIR}/support/tinycthread.c) + ${GLFW_SOURCE_DIR}/support/tinycthread.c) add_executable(clipboard clipboard.c ${GETOPT}) add_executable(defaults defaults.c) @@ -57,9 +57,8 @@ set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") add_executable(windows WIN32 MACOSX_BUNDLE windows.c) set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") -if (BUILD_SHARED_LIBS) - target_link_libraries(threads ${thread_LIBRARIES}) -endif() +target_link_libraries(threads ${thread_LIBRARIES}) + set(WINDOWS_BINARIES accuracy sharing tearing threads title windows) set(CONSOLE_BINARIES clipboard defaults events fsaa fsfocus gamma glfwinfo From 6501a3007c16265ec3e5b1bf66407fb8d6444eb1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 6 Jan 2013 12:37:56 -0500 Subject: [PATCH 3/3] No monitors should call error callback --- src/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/init.c b/src/init.c index 672e01ff..c2c6caf6 100644 --- a/src/init.c +++ b/src/init.c @@ -147,6 +147,7 @@ GLFWAPI int glfwInit(void) _glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount); if (!_glfw.monitors) { + _glfwErrorCallback(GLFW_PLATFORM_ERROR, "No monitors found"); _glfwPlatformTerminate(); return GL_FALSE; }