You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Fix fullscreen on X11.
Attempts to set a Godot window to fullscreen prior to the window being mapped would silently fail. This commit uses _window_fullscreen_check to test if a window had been set to fullscreen while unmapped, and if so, resets it to fullscreen once the window has been successfully mapped. Fixes #54065
This commit is contained in:
@@ -1869,6 +1869,14 @@ bool DisplayServerX11::_window_fullscreen_check(WindowID p_window) const {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisplayServerX11::_validate_fullscreen_on_map(WindowID p_window) {
|
||||||
|
const WindowData &wd = windows[p_window];
|
||||||
|
if (wd.fullscreen && !_window_fullscreen_check(p_window)) {
|
||||||
|
// Unmapped fullscreen attempt didn't take effect, redo...
|
||||||
|
_set_wm_fullscreen(p_window, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
|
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
|
||||||
_THREAD_SAFE_METHOD_
|
_THREAD_SAFE_METHOD_
|
||||||
return _window_maximize_check(p_window, "_NET_WM_ALLOWED_ACTIONS");
|
return _window_maximize_check(p_window, "_NET_WM_ALLOWED_ACTIONS");
|
||||||
@@ -3650,6 +3658,9 @@ void DisplayServerX11::process_events() {
|
|||||||
|
|
||||||
const WindowData &wd = windows[window_id];
|
const WindowData &wd = windows[window_id];
|
||||||
|
|
||||||
|
// Have we failed to set fullscreen while the window was unmapped?
|
||||||
|
_validate_fullscreen_on_map(window_id);
|
||||||
|
|
||||||
XWindowAttributes xwa;
|
XWindowAttributes xwa;
|
||||||
XSync(x11_display, False);
|
XSync(x11_display, False);
|
||||||
XGetWindowAttributes(x11_display, wd.x11_window, &xwa);
|
XGetWindowAttributes(x11_display, wd.x11_window, &xwa);
|
||||||
@@ -4990,6 +5001,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
|||||||
XNextEvent(x11_display, &xevent);
|
XNextEvent(x11_display, &xevent);
|
||||||
if (xevent.type == ConfigureNotify) {
|
if (xevent.type == ConfigureNotify) {
|
||||||
_window_changed(&xevent);
|
_window_changed(&xevent);
|
||||||
|
} else if (xevent.type == MapNotify) {
|
||||||
|
// Have we failed to set fullscreen while the window was unmapped?
|
||||||
|
_validate_fullscreen_on_map(main_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ class DisplayServerX11 : public DisplayServer {
|
|||||||
void _update_real_mouse_position(const WindowData &wd);
|
void _update_real_mouse_position(const WindowData &wd);
|
||||||
bool _window_maximize_check(WindowID p_window, const char *p_atom_name) const;
|
bool _window_maximize_check(WindowID p_window, const char *p_atom_name) const;
|
||||||
bool _window_fullscreen_check(WindowID p_window) const;
|
bool _window_fullscreen_check(WindowID p_window) const;
|
||||||
|
void _validate_fullscreen_on_map(WindowID p_window);
|
||||||
void _update_size_hints(WindowID p_window);
|
void _update_size_hints(WindowID p_window);
|
||||||
void _set_wm_fullscreen(WindowID p_window, bool p_enabled);
|
void _set_wm_fullscreen(WindowID p_window, bool p_enabled);
|
||||||
void _set_wm_maximized(WindowID p_window, bool p_enabled);
|
void _set_wm_maximized(WindowID p_window, bool p_enabled);
|
||||||
|
|||||||
Reference in New Issue
Block a user