Added window iconification callback.

This commit is contained in:
Camilla Berglund
2010-09-20 02:22:35 +02:00
parent 871f3d172e
commit 0d7e1794a5
8 changed files with 51 additions and 1 deletions
+6
View File
@@ -94,11 +94,17 @@
- (void)windowDidMiniaturize:(NSNotification *)notification
{
window->iconified = GL_TRUE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
}
- (void)windowDidDeminiaturize:(NSNotification *)notification
{
window->iconified = GL_FALSE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
+1
View File
@@ -149,6 +149,7 @@ typedef struct _GLFWwindow
GLFWwindowclosefun windowCloseCallback;
GLFWwindowrefreshfun windowRefreshCallback;
GLFWwindowfocusfun windowFocusCallback;
GLFWwindowiconifyfun windowIconifyCallback;
GLFWmousebuttonfun mouseButtonCallback;
GLFWmouseposfun mousePosCallback;
GLFWmousewheelfun mouseWheelCallback;
+8 -1
View File
@@ -697,7 +697,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
_glfwInputWindowFocus(window, active);
window->iconified = iconified;
if (iconified != window->iconified)
{
window->iconified = iconified;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
}
return 0;
}
+16
View File
@@ -1122,6 +1122,22 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cb
}
//========================================================================
// Set callback function for window iconification events
//========================================================================
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED);
return;
}
window->windowIconifyCallback = cbfun;
}
//========================================================================
// Poll for new window and input events and close any flagged windows
//========================================================================
+8
View File
@@ -1272,6 +1272,10 @@ static void processSingleEvent(void)
}
window->iconified = GL_FALSE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
break;
}
@@ -1286,6 +1290,10 @@ static void processSingleEvent(void)
}
window->iconified = GL_TRUE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
break;
}