mirror of
https://github.com/glfw/glfw.git
synced 2026-11-18 04:44:54 +00:00
Added window iconification callback.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -149,6 +149,7 @@ typedef struct _GLFWwindow
|
||||
GLFWwindowclosefun windowCloseCallback;
|
||||
GLFWwindowrefreshfun windowRefreshCallback;
|
||||
GLFWwindowfocusfun windowFocusCallback;
|
||||
GLFWwindowiconifyfun windowIconifyCallback;
|
||||
GLFWmousebuttonfun mouseButtonCallback;
|
||||
GLFWmouseposfun mousePosCallback;
|
||||
GLFWmousewheelfun mouseWheelCallback;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
//========================================================================
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user