From 1960d1ebb1484bc7b38187239a5eea64e78de77b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 8 Oct 2011 23:41:30 +0200 Subject: [PATCH 1/3] Added error setting for more cases of invalid tokens. --- src/enable.c | 2 ++ src/input.c | 2 +- src/window.c | 9 ++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/enable.c b/src/enable.c index 82ba940c..897f0753 100644 --- a/src/enable.c +++ b/src/enable.c @@ -152,6 +152,7 @@ GLFWAPI void glfwEnable(GLFWwindow window, int token) enableKeyRepeat(window); break; default: + _glfwSetError(GLFW_INVALID_ENUM, NULL); break; } } @@ -184,6 +185,7 @@ GLFWAPI void glfwDisable(GLFWwindow window, int token) disableKeyRepeat(window); break; default: + _glfwSetError(GLFW_INVALID_ENUM, NULL); break; } } diff --git a/src/input.c b/src/input.c index 04c835a4..8845b758 100644 --- a/src/input.c +++ b/src/input.c @@ -53,7 +53,7 @@ GLFWAPI int glfwGetKey(GLFWwindow handle, int key) if (key < 0 || key > GLFW_KEY_LAST) { // TODO: Decide whether key is a value or enum - _glfwSetError(GLFW_INVALID_VALUE, + _glfwSetError(GLFW_INVALID_ENUM, "glfwGetKey: The specified key is invalid"); return GLFW_RELEASE; } diff --git a/src/window.c b/src/window.c index a39125ef..2e49b868 100644 --- a/src/window.c +++ b/src/window.c @@ -468,6 +468,7 @@ GLFWAPI void glfwOpenWindowHint(int target, int hint) _glfwLibrary.hints.glRobustness = hint; break; default: + _glfwSetError(GLFW_INVALID_ENUM, NULL); break; } } @@ -748,12 +749,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) return window->glProfile; case GLFW_OPENGL_ROBUSTNESS: return window->glRobustness; - default: - _glfwSetError(GLFW_INVALID_ENUM, - "glfwGetWindowParam: Invalid enum value for 'param' " - "parameter"); - return 0; } + + _glfwSetError(GLFW_INVALID_ENUM, NULL); + return 0; } From 65f074d2574fb2dccee9818a03fc93a07c115530 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sat, 8 Oct 2011 23:57:03 +0200 Subject: [PATCH 2/3] Formatting. --- src/opengl.c | 1 + src/window.c | 1 + src/x11_enable.c | 1 + src/x11_window.c | 2 ++ 4 files changed, 5 insertions(+) diff --git a/src/opengl.c b/src/opengl.c index d75eee8f..f4c6984c 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -345,6 +345,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) return GL_TRUE; } + //======================================================================== // Checks whether the specified context fulfils the requirements // It blames glfwOpenWindow because that's the only caller diff --git a/src/window.c b/src/window.c index 2e49b868..06c32b8d 100644 --- a/src/window.c +++ b/src/window.c @@ -817,6 +817,7 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindowsizefun cbfun) } } + //======================================================================== // Set callback function for window close events //======================================================================== diff --git a/src/x11_enable.c b/src/x11_enable.c index 9b439385..49961395 100644 --- a/src/x11_enable.c +++ b/src/x11_enable.c @@ -48,6 +48,7 @@ void _glfwPlatformEnableSystemKeys(_GLFWwindow* window) } } + //======================================================================== // Disable system keys //======================================================================== diff --git a/src/x11_window.c b/src/x11_window.c index a05b121c..962da7fb 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -206,6 +206,7 @@ static GLboolean hasEWMH(_GLFWwindow* window) return GL_TRUE; } + //======================================================================== // Translates an X Window key to internal coding //======================================================================== @@ -974,6 +975,7 @@ static void enterFullscreenMode(_GLFWwindow* window) window->width / 2, window->height / 2); } + //======================================================================== // Leave fullscreen mode //======================================================================== From ebffe58369254a3a4b52785e7a828d9228e144d4 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 9 Oct 2011 00:01:44 +0200 Subject: [PATCH 3/3] Renamed version to glfwinfo. --- readme.html | 3 ++- tests/CMakeLists.txt | 6 +++--- tests/{version.c => glfwinfo.c} | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename tests/{version.c => glfwinfo.c} (100%) diff --git a/readme.html b/readme.html index 65fbf372..a028b45b 100644 --- a/readme.html +++ b/readme.html @@ -287,6 +287,7 @@ version of GLFW.

  • Changed buffer bit depth parameters of glfwOpenWindow to window hints
  • Renamed glfw.h to glfw3.h to avoid conflicts with 2.x series
  • Renamed GLFW_WINDOW token to GLFW_WINDOWED
  • +
  • Renamed version test to glfwinfo
  • Replaced ad hoc build system with CMake
  • Replaced layout-dependent key codes with single, platform-independent set based on US layout
  • Replaced mouse wheel interface with two-dimensional scrolling interface
  • @@ -302,7 +303,7 @@ version of GLFW.

  • Removed GLFW_OPENED window parameter
  • Removed nonsensical key actions for Unicode character input
  • Removed GLFWCALL and GLFWAPIENTRY macros for stdcall calling convention
  • -
  • Bugfix: The default OpenGL version in the version test was set to 1.1
  • +
  • Bugfix: The default OpenGL version in the glfwinfo test was set to 1.1
  • Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation
  • Bugfix: The FSAA test did not check for the availability of GL_ARB_multisample
  • [Cocoa] Added support for OpenGL 3.2 core profile in 10.7 Lion and above
  • diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9ef07acc..b85d79b4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,12 +10,12 @@ add_executable(events events.c) add_executable(fsaa fsaa.c getopt.c) add_executable(fsfocus fsfocus.c) add_executable(gamma gamma.c getopt.c) +add_executable(glfwinfo glfwinfo.c getopt.c) add_executable(iconify iconify.c getopt.c) add_executable(joysticks joysticks.c) add_executable(listmodes listmodes.c) add_executable(peter peter.c) add_executable(reopen reopen.c) -add_executable(version version.c getopt.c) if(APPLE) # Set fancy names for bundles @@ -32,8 +32,8 @@ else() endif(APPLE) set(WINDOWS_BINARIES accuracy sharing tearing windows) -set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma iconify joysticks - listmodes peter reopen version) +set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify + joysticks listmodes peter reopen) if(MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables diff --git a/tests/version.c b/tests/glfwinfo.c similarity index 100% rename from tests/version.c rename to tests/glfwinfo.c