Added glfwIsWindow.
diff --git a/examples/boing.c b/examples/boing.c
index c060e4f..ef33737 100644
--- a/examples/boing.c
+++ b/examples/boing.c
@@ -606,7 +606,7 @@
glfwPollEvents();
/* Check if we are still running */
- running = !glfwGetKey( window, GLFW_KEY_ESC );
+ running = glfwIsWindow(window) && !glfwGetKey( window, GLFW_KEY_ESC );
}
while( running );
diff --git a/include/GL/glfw.h b/include/GL/glfw.h
index 1f2bb8a..4647b7b 100644
--- a/include/GL/glfw.h
+++ b/include/GL/glfw.h
@@ -391,6 +391,7 @@
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode);
GLFWAPI void glfwOpenWindowHint(int target, int hint);
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
+GLFWAPI int glfwIsWindow(GLFWwindow window);
GLFWAPI void glfwCloseWindow(GLFWwindow window);
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
diff --git a/lib/window.c b/lib/window.c
index 1363ffa..5383e29 100644
--- a/lib/window.c
+++ b/lib/window.c
@@ -565,7 +565,7 @@
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window)
{
- if (_glfwLibrary.currentWindow == window)
+ if (!_glfwInitialized || _glfwLibrary.currentWindow == window)
return;
_glfwPlatformMakeWindowCurrent(window);
@@ -574,6 +574,19 @@
//========================================================================
+// Returns GL_TRUE if the specified window handle is an actual window
+//========================================================================
+
+GLFWAPI int glfwIsWindow(GLFWwindow window)
+{
+ if (!_glfwInitialized)
+ return;
+
+ return window == _glfwLibrary.window;
+}
+
+
+//========================================================================
// Set hints for opening the window
//========================================================================