Add GLFW_OCCLUDED window attribute

This commit is contained in:
Green Lightning 2017-11-09 18:09:40 +01:00
parent 9ebcfb4764
commit 11061d59e7
10 changed files with 43 additions and 0 deletions

View File

@ -1150,6 +1150,12 @@ void window_occlusion_callback(GLFWwindow* window, int occluded)
} }
@endcode @endcode
You can also get the current occlusion state with @ref glfwGetWindowAttrib.
@code
int occluded = glfwGetWindowAttrib(window, GLFW_OCCLUDED);
@endcode
@note This is currently implemented on macOS only. @note This is currently implemented on macOS only.
@ -1289,6 +1295,10 @@ for details.
__GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref __GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref
window_hide for details. window_hide for details.
@anchor GLFW_OCCLUDED_attrib
__GLFW_OCCLUDED__ indicates whether the specified window is occluded.
See @ref window_occlusion for details.
@anchor GLFW_RESIZABLE_attrib @anchor GLFW_RESIZABLE_attrib
__GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the __GLFW_RESIZABLE__ indicates whether the specified window is resizable _by the
user_. This can be set before creation with the user_. This can be set before creation with the

View File

@ -825,6 +825,11 @@ extern "C" {
* [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
*/ */
#define GLFW_FOCUS_ON_SHOW 0x0002000C #define GLFW_FOCUS_ON_SHOW 0x0002000C
/*! @brief Occlusion window attribute
*
* Occlusion [window attribute](@ref GLFW_OCCLUDED_attrib).
*/
#define GLFW_OCCLUDED 0x0002000D
/*! @brief Framebuffer bit depth hint. /*! @brief Framebuffer bit depth hint.
* *

View File

@ -1515,6 +1515,11 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
return [window->ns.object isKeyWindow]; return [window->ns.object isKeyWindow];
} }
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
{
return !([window->ns.object occlusionState] & NSWindowOcclusionStateVisible);
}
int _glfwPlatformWindowIconified(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window)
{ {
return [window->ns.object isMiniaturized]; return [window->ns.object isMiniaturized];

View File

@ -657,6 +657,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
int xpos, int ypos, int width, int height, int xpos, int ypos, int width, int height,
int refreshRate); int refreshRate);
int _glfwPlatformWindowFocused(_GLFWwindow* window); int _glfwPlatformWindowFocused(_GLFWwindow* window);
int _glfwPlatformWindowOccluded(_GLFWwindow* window);
int _glfwPlatformWindowIconified(_GLFWwindow* window); int _glfwPlatformWindowIconified(_GLFWwindow* window);
int _glfwPlatformWindowVisible(_GLFWwindow* window); int _glfwPlatformWindowVisible(_GLFWwindow* window);
int _glfwPlatformWindowMaximized(_GLFWwindow* window); int _glfwPlatformWindowMaximized(_GLFWwindow* window);

0
src/mir_window.c Normal file
View File

View File

@ -222,6 +222,11 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
return GLFW_FALSE; return GLFW_FALSE;
} }
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
{
return GLFW_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window)
{ {
return GLFW_FALSE; return GLFW_FALSE;

View File

@ -1760,6 +1760,11 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
return window->win32.handle == GetActiveWindow(); return window->win32.handle == GetActiveWindow();
} }
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
{
return GLFW_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window)
{ {
return IsIconic(window->win32.handle); return IsIconic(window->win32.handle);

View File

@ -832,6 +832,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->focusOnShow; return window->focusOnShow;
case GLFW_TRANSPARENT_FRAMEBUFFER: case GLFW_TRANSPARENT_FRAMEBUFFER:
return _glfwPlatformFramebufferTransparent(window); return _glfwPlatformFramebufferTransparent(window);
case GLFW_OCCLUDED:
return _glfwPlatformWindowOccluded(window);
case GLFW_RESIZABLE: case GLFW_RESIZABLE:
return window->resizable; return window->resizable;
case GLFW_DECORATED: case GLFW_DECORATED:

View File

@ -1243,6 +1243,11 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
return _glfw.wl.keyboardFocus == window; return _glfw.wl.keyboardFocus == window;
} }
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
{
return GLFW_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window)
{ {
// wl_shell doesn't have any iconified concept, and xdg-shell doesnt give // wl_shell doesn't have any iconified concept, and xdg-shell doesnt give

View File

@ -2433,6 +2433,11 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
return window->x11.handle == focused; return window->x11.handle == focused;
} }
int _glfwPlatformWindowOccluded(_GLFWwindow* window)
{
return GLFW_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window) int _glfwPlatformWindowIconified(_GLFWwindow* window)
{ {
return getWindowState(window) == IconicState; return getWindowState(window) == IconicState;