GLFW: Add support for window occluded notifications on macOS

Based on: https://github.com/glfw/glfw/pull/1123
This commit is contained in:
Kovid Goyal
2019-02-18 09:34:26 +05:30
parent c8bb7aae40
commit dcb2d95f9a
9 changed files with 127 additions and 2 deletions

21
glfw/window.c vendored
View File

@@ -88,6 +88,14 @@ _GLFWwindow* _glfwWindowForId(GLFWid id) {
return NULL;
}
// Notifies shared code that a window's occlusion state has changed
//
void _glfwInputWindowOcclusion(_GLFWwindow* window, GLFWbool occluded)
{
if (window->callbacks.occlusion)
window->callbacks.occlusion((GLFWwindow*) window, occluded);
}
// Notifies shared code that a window has moved
// The position is specified in content area relative screen coordinates
//
@@ -867,6 +875,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->focusOnShow;
case GLFW_TRANSPARENT_FRAMEBUFFER:
return _glfwPlatformFramebufferTransparent(window);
case GLFW_OCCLUDED:
return _glfwPlatformWindowOccluded(window);
case GLFW_RESIZABLE:
return window->resizable;
case GLFW_DECORATED:
@@ -1068,6 +1078,17 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
return cbfun;
}
GLFWAPI GLFWwindowocclusionfun glfwSetWindowOcclusionCallback(GLFWwindow* handle,
GLFWwindowocclusionfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.occlusion, cbfun);
return cbfun;
}
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
GLFWwindowiconifyfun cbfun)
{