diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-07-13 20:31:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 20:31:33 +0200 |
commit | 9a502d3c17d4701b0fd8390e515c52a69dc0bf85 (patch) | |
tree | b7b729603ac13ed89e9ccdca49e815ecca63cb99 | |
parent | 0ee47fefbe4f746d6e00e863e4523398365b4e47 (diff) | |
parent | 11dbca419c89f97a538f8f6bc0c3723fa49b9b48 (diff) |
Merge pull request #9619 from marcelofg55/master
Fix fullscreen on X11 for non-resizable windows
-rw-r--r-- | platform/x11/os_x11.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 4aca1468b1..04f41b2e89 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -686,6 +686,16 @@ void OS_X11::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) con } void OS_X11::set_wm_fullscreen(bool p_enabled) { + if (p_enabled && !is_window_resizable()) { + // Set the window as resizable to prevent window managers to ignore the fullscreen state flag. + XSizeHints *xsh; + + xsh = XAllocSizeHints(); + xsh->flags = 0L; + XSetWMNormalHints(x11_display, x11_window, xsh); + XFree(xsh); + } + // Using EWMH -- Extened Window Manager Hints XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); @@ -701,6 +711,23 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) { xev.xclient.data.l[2] = 0; XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); + XFlush(x11_display); + + if (!p_enabled && !is_window_resizable()) { + // Reset the non-resizable flags if we un-set these before. + Size2 size = get_window_size(); + XSizeHints *xsh; + + xsh = XAllocSizeHints(); + xsh->flags = PMinSize | PMaxSize; + xsh->min_width = size.x; + xsh->max_width = size.x; + xsh->min_height = size.y; + xsh->max_height = size.y; + + XSetWMNormalHints(x11_display, x11_window, xsh); + XFree(xsh); + } } int OS_X11::get_screen_count() const { |