diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2016-11-21 11:54:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-21 11:54:49 +0100 |
commit | d5a9102a883514922e3b09f282731ea9e7f2e60f (patch) | |
tree | ed75e895bff4330a55feff0d6b3b3a5542cb3e5c /platform | |
parent | e3c09ed90d120dc1e62d1d468065113318843478 (diff) | |
parent | 8d3efe2b7de494c0971d4b7f7af6ed0dc2f4613c (diff) |
Merge pull request #7125 from Hinsbart/x11_maximize
X11: Fix maximized boot splash
Diffstat (limited to 'platform')
-rwxr-xr-x[-rw-r--r--] | platform/x11/os_x11.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 0172dca4c4..65f546e2ee 100644..100755 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -880,6 +880,9 @@ bool OS_X11::is_window_minimized() const { } void OS_X11::set_window_maximized(bool p_enabled) { + + if (is_window_maximized() == p_enabled) return; + // Using EWMH -- Extended Window Manager Hints XEvent xev; Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False); @@ -898,6 +901,23 @@ void OS_X11::set_window_maximized(bool p_enabled) { XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); maximized = p_enabled; + + //wait until the window has been resized and update video mode + while (true) { + XEvent ev; + XNextEvent(x11_display, &ev); + if (ev.type == ConfigureNotify) { + XConfigureEvent &xc = ev.xconfigure; + if (xc.send_event == 1 && + (xc.width == get_screen_size(get_current_screen()).width || (!p_enabled && xc.width < current_videomode.width))) { + + current_videomode.width=xc.width; + current_videomode.height=xc.height; + break; + }; + } + }; + } bool OS_X11::is_window_maximized() const { @@ -1990,6 +2010,7 @@ OS_X11::OS_X11() { AudioDriverManagerSW::add_driver(&driver_alsa); #endif + maximized = false; minimized = false; xim_style=0L; mouse_mode=MOUSE_MODE_VISIBLE; |