GLFW API to check if window is fullscreen
This commit is contained in:
parent
b3a9c1a100
commit
d95a00df73
@ -2407,6 +2407,14 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor UNUSED)
|
||||
updateCursorImage(window);
|
||||
}
|
||||
|
||||
bool _glfwPlatformIsFullscreen(_GLFWwindow* w, unsigned int flags) {
|
||||
NSWindow *window = w->ns.object;
|
||||
bool traditional = !(flags & 1);
|
||||
if (traditional && @available(macOS 10.16, *)) return w->ns.in_traditional_fullscreen;
|
||||
NSWindowStyleMask sm = [window styleMask];
|
||||
return sm & NSWindowStyleMaskFullScreen;
|
||||
}
|
||||
|
||||
bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
|
||||
NSWindow *window = w->ns.object;
|
||||
bool made_fullscreen = true;
|
||||
|
||||
1
glfw/glfw3.h
vendored
1
glfw/glfw3.h
vendored
@ -2752,6 +2752,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
*/
|
||||
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
|
||||
GLFWAPI bool glfwToggleFullscreen(GLFWwindow *window, unsigned int flags);
|
||||
GLFWAPI bool glfwIsFullscreen(GLFWwindow *window, unsigned int flags);
|
||||
|
||||
/*! @brief Destroys the specified window and its context.
|
||||
*
|
||||
|
||||
1
glfw/internal.h
vendored
1
glfw/internal.h
vendored
@ -717,6 +717,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
|
||||
int xpos, int ypos, int width, int height,
|
||||
int refreshRate);
|
||||
bool _glfwPlatformToggleFullscreen(_GLFWwindow *w, unsigned int flags);
|
||||
bool _glfwPlatformIsFullscreen(_GLFWwindow *w, unsigned int flags);
|
||||
int _glfwPlatformWindowFocused(_GLFWwindow* window);
|
||||
int _glfwPlatformWindowOccluded(_GLFWwindow* window);
|
||||
int _glfwPlatformWindowIconified(_GLFWwindow* window);
|
||||
|
||||
4
glfw/window.c
vendored
4
glfw/window.c
vendored
@ -1058,6 +1058,10 @@ GLFWAPI bool glfwToggleFullscreen(GLFWwindow* wh, unsigned int flags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GLFWAPI bool glfwIsFullscreen(GLFWwindow* wh, unsigned int flags) {
|
||||
return _glfwPlatformIsFullscreen((_GLFWwindow*)wh, flags);
|
||||
}
|
||||
|
||||
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
|
||||
8
glfw/wl_window.c
vendored
8
glfw/wl_window.c
vendored
@ -413,9 +413,15 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, bool on)
|
||||
setIdleInhibitor(window, on);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
_glfwPlatformIsFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
|
||||
return window->wl.toplevel_states & TOPLEVEL_STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
bool
|
||||
_glfwPlatformToggleFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
|
||||
bool already_fullscreen = window->wl.toplevel_states & TOPLEVEL_STATE_FULLSCREEN;
|
||||
bool already_fullscreen = _glfwPlatformIsFullscreen(window, flags);
|
||||
setFullscreen(window, NULL, !already_fullscreen);
|
||||
return !already_fullscreen;
|
||||
}
|
||||
|
||||
5
glfw/x11_window.c
vendored
5
glfw/x11_window.c
vendored
@ -343,6 +343,11 @@ set_fullscreen(_GLFWwindow *window, bool on) {
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
_glfwPlatformIsFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
|
||||
return is_window_fullscreen(window);
|
||||
}
|
||||
|
||||
bool
|
||||
_glfwPlatformToggleFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
|
||||
bool already_fullscreen = is_window_fullscreen(window);
|
||||
|
||||
@ -592,7 +592,9 @@ static bool
|
||||
toggle_fullscreen_for_os_window(OSWindow *w) {
|
||||
if (w && w->handle) {
|
||||
#ifdef __APPLE__
|
||||
if (!OPT(macos_traditional_fullscreen)) return glfwToggleFullscreen(w->handle, 1);
|
||||
if (!OPT(macos_traditional_fullscreen)) {
|
||||
return glfwToggleFullscreen(w->handle, 1);
|
||||
}
|
||||
#endif
|
||||
return do_toggle_fullscreen(w);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user