You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Properly check for fullscreen toggle made through the Window Manager
Fixes #40007. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
committed by
Rémi Verschelde
parent
62994bec2a
commit
aadf831a67
@@ -1817,6 +1817,52 @@ bool DisplayServerX11::_window_maximize_check(WindowID p_window, const char *p_a
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool DisplayServerX11::_window_fullscreen_check(WindowID p_window) const {
|
||||
ERR_FAIL_COND_V(!windows.has(p_window), false);
|
||||
const WindowData &wd = windows[p_window];
|
||||
|
||||
// Using EWMH -- Extended Window Manager Hints
|
||||
Atom property = XInternAtom(x11_display, "_NET_WM_STATE", False);
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long len;
|
||||
unsigned long remaining;
|
||||
unsigned char *data = nullptr;
|
||||
bool retval = false;
|
||||
|
||||
if (property == None) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int result = XGetWindowProperty(
|
||||
x11_display,
|
||||
wd.x11_window,
|
||||
property,
|
||||
0,
|
||||
1024,
|
||||
False,
|
||||
XA_ATOM,
|
||||
&type,
|
||||
&format,
|
||||
&len,
|
||||
&remaining,
|
||||
&data);
|
||||
|
||||
if (result == Success) {
|
||||
Atom *atoms = (Atom *)data;
|
||||
Atom wm_fullscreen = XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
for (uint64_t i = 0; i < len; i++) {
|
||||
if (atoms[i] == wm_fullscreen) {
|
||||
retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
return _window_maximize_check(p_window, "_NET_WM_ALLOWED_ACTIONS");
|
||||
@@ -3604,6 +3650,8 @@ void DisplayServerX11::process_events() {
|
||||
case Expose: {
|
||||
DEBUG_LOG_X11("[%u] Expose window=%lu (%u), count='%u' \n", frame, event.xexpose.window, window_id, event.xexpose.count);
|
||||
|
||||
windows[window_id].fullscreen = _window_fullscreen_check(window_id);
|
||||
|
||||
Main::force_redraw();
|
||||
} break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user