mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-10 21:48:46 +01:00
REVIEWED: Fullscreen modes on Linux (X11 over XWayland)
It does not work as expected... :(
This commit is contained in:
@ -196,11 +196,16 @@ void ToggleFullscreen(void)
|
||||
CORE.Window.display.height = mode->height;
|
||||
|
||||
CORE.Window.position = (Point){ 0, 0 };
|
||||
CORE.Window.screen = (Size){ CORE.Window.display.width, CORE.Window.display.height };
|
||||
CORE.Window.screen = CORE.Window.display;
|
||||
|
||||
// Set fullscreen flag to be processed on FramebufferSizeCallback() accordingly
|
||||
FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
|
||||
|
||||
// NOTE: X11 requires undecorating the window before switching to
|
||||
// fullscreen to avoid issues with framebuffer scaling
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||
FLAG_SET(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||
|
||||
// WARNING: This function launches FramebufferSizeCallback()
|
||||
glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
}
|
||||
@ -226,8 +231,14 @@ void ToggleFullscreen(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// WARNING: This function launches FramebufferSizeCallback()
|
||||
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
|
||||
CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
|
||||
// NOTE: X11 requires restoring the decorated window after switching from
|
||||
// fullscreen to avoid issues with framebuffer scaling
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
|
||||
}
|
||||
|
||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||
|
||||
Reference in New Issue
Block a user