summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/x11
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-17 16:21:13 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-17 16:21:13 +0100
commitf84479fe5a0a3c34c1d0217527ae08dd24543243 (patch)
treec291e070ec176f7fd57dbfa8286960169806dcec /platform/linuxbsd/x11
parenta0afeb5d5a9fd3cacdae827aa28904f16998be17 (diff)
parent853f0eae5886f3e6b19265da1bbd01138253a5d9 (diff)
Merge pull request #72877 from bruvzg/x11_on_top
[X11] Fix initial "on top" window state.
Diffstat (limited to 'platform/linuxbsd/x11')
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 00547c4560..dff2f536a8 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -2057,6 +2057,22 @@ void DisplayServerX11::_validate_mode_on_map(WindowID p_window) {
} else if (wd.minimized && !_window_minimize_check(p_window)) {
_set_wm_minimized(p_window, true);
}
+
+ if (wd.on_top) {
+ Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False);
+ Atom wm_above = XInternAtom(x11_display, "_NET_WM_STATE_ABOVE", False);
+
+ XClientMessageEvent xev;
+ memset(&xev, 0, sizeof(xev));
+ xev.type = ClientMessage;
+ xev.window = wd.x11_window;
+ xev.message_type = wm_state;
+ xev.format = 32;
+ xev.data.l[0] = _NET_WM_STATE_ADD;
+ xev.data.l[1] = wm_above;
+ xev.data.l[3] = 1;
+ XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xev);
+ }
}
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {