From ed9e40375014021f674e5fb4d60dbe62f1dd68ba Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 23 Dec 2012 15:59:09 +0100 Subject: [PATCH 1/3] Documentation work. --- include/GL/glfw3.h | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index e9aefce3..9ceae2c2 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -1050,6 +1050,31 @@ GLFWAPI void glfwDefaultWindowHints(void); * @param[in] target The new value of the window hint. * @ingroup window * + * This function sets hints for the next call to @ref glfwCreateWindow. The + * hints, once set, retain their values until changed by a call to @ref + * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is + * terminated with @ref glfwTerminate. + * + * Some window hints are hard constraints. These must match the available + * capabilities @em exactly for window and context creation to succeed. Hints + * that are not hard constraints are matched as closely as possible, but the + * resulting window and context may differ from what these hints requested. To + * find out the actual properties of the created window and context, use the + * @ref glfwGetWindowParam function. + * + * The following hints are hard constraints: + * @arg @ref GLFW_STEREO + * @arg @ref GLFW_CLIENT_API + * + * The following additional hints are hard constraints if requesting an OpenGL + * context: + * @arg @ref GLFW_OPENGL_FORWARD_COMPAT + * @arg @ref GLFW_OPENGL_PROFILE + * + * Hints that do not apply to a given type of window or context are ignored. + * + * @par Framebuffer hints + * * The @ref GLFW_RED_BITS, @ref GLFW_GREEN_BITS, @ref GLFW_BLUE_BITS, @ref * GLFW_ALPHA_BITS, @ref GLFW_DEPTH_BITS and @ref GLFW_STENCIL_BITS hints * specify the desired bit depths of the various components of the default @@ -1075,6 +1100,8 @@ GLFWAPI void glfwDefaultWindowHints(void); * The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be * sRGB capable. * + * @par Context hints + * * The @ref GLFW_CLIENT_API hint specifies which client API to create the * context for. Possible values are @ref GLFW_OPENGL_API and @ref * GLFW_OPENGL_ES_API. @@ -1113,6 +1140,8 @@ GLFWAPI void glfwDefaultWindowHints(void); * The @ref GLFW_CONTEXT_ROBUSTNESS hint specifies the robustness strategy to * be used by the context. * + * @par Window hints + * * The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable * by the user. The window will still be resizable using the @ref * glfwSetWindowSize function. This hint is ignored for fullscreen windows. @@ -1123,22 +1152,6 @@ GLFWAPI void glfwDefaultWindowHints(void); * The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y hints specify the initial * position of the window. These hints are ignored for fullscreen windows. * - * Some window hints are hard constraints. These must match the available - * capabilities @em exactly for window and context creation to succeed. Hints - * that are not hard constraints are matched as closely as possible, but the - * resulting window and context may differ from what these hints requested. To - * find out the actual properties of the created window and context, use the - * @ref glfwGetWindowParam function. - * - * The following hints are hard constraints: - * @arg @ref GLFW_STEREO - * @arg @ref GLFW_CLIENT_API - * - * The following additional hints are hard constraints if requesting an OpenGL - * context: - * @arg @ref GLFW_OPENGL_FORWARD_COMPAT - * @arg @ref GLFW_OPENGL_PROFILE - * * @note This function may only be called from the main thread. * * @sa glfwDefaultWindowHints From be7ad339f7743b026cac4074722758c9e520e8a0 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 23 Dec 2012 16:08:17 +0100 Subject: [PATCH 2/3] Added clearing of callbacks on window destruction. --- src/window.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/window.c b/src/window.c index 112b2d50..83db3bdd 100644 --- a/src/window.c +++ b/src/window.c @@ -494,6 +494,20 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle) if (window == NULL) return; + // Clear all callbacks to avoid exposing a half torn-down window object + window->windowPosCallback = NULL; + window->windowSizeCallback = NULL; + window->windowCloseCallback = NULL; + window->windowRefreshCallback = NULL; + window->windowFocusCallback = NULL; + window->windowIconifyCallback = NULL; + window->mouseButtonCallback = NULL; + window->cursorPosCallback = NULL; + window->cursorEnterCallback = NULL; + window->scrollCallback = NULL; + window->keyCallback = NULL; + window->charCallback = NULL; + // The window's context must not be current on another thread when the // window is destroyed if (window == _glfwPlatformGetCurrentContext()) From cdcdf5763ae81766a4a969c89aab8e3373dd9565 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Dec 2012 18:04:24 +0100 Subject: [PATCH 3/3] Temporary fix for OPENGL_INCLUDE_DIR being NOTFOUND on OS X 10.8. --- examples/CMakeLists.txt | 8 ++++++-- tests/CMakeLists.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a3c26beb..723244d3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,8 +9,12 @@ else() endif() include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/support - ${OPENGL_INCLUDE_DIR}) + ${GLFW_SOURCE_DIR}/support) + +if (NOT APPLE) + # HACK: This is NOTFOUND on OS X 10.8 + include_directories(${OPENGL_INCLUDE_DIR}) +endif() set(GETOPT ${GLFW_SOURCE_DIR}/support/getopt.h ${GLFW_SOURCE_DIR}/support/getopt.c) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 11bcfe9e..30201265 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,8 +14,12 @@ if (UNIX AND NOT APPLE) endif() include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/support - ${OPENGL_INCLUDE_DIR}) + ${GLFW_SOURCE_DIR}/support) + +if (NOT APPLE) + # HACK: This is NOTFOUND on OS X 10.8 + include_directories(${OPENGL_INCLUDE_DIR}) +endif() set(GETOPT ${GLFW_SOURCE_DIR}/support/getopt.h ${GLFW_SOURCE_DIR}/support/getopt.c)