From 6060e57d4369130fe9594751798f4a78893bb4c6 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 6 Feb 2019 21:42:16 +0100 Subject: [PATCH] Sleep some time after changing resolution, so that window manager will be notified before we read window size --- lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp index 80fe43883..6cef27149 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -325,6 +325,11 @@ bool CIrrDeviceLinux::changeResolution() return true; getVideoModeList(); + + core::dimension2d desktop_res = VideoModeList.getDesktopResolution(); + + if (desktop_res.Width == Width && desktop_res.Height == Height) + return true; #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_) s32 eventbase, errorbase; @@ -480,7 +485,11 @@ bool CIrrDeviceLinux::changeResolution() crtc->rotation, &output_id, 1); if (s == Success) + { UseXRandR = true; + XSync(display, false); + sleep(1000, false); + } if (UseXRandR && SupportsNetWM) { @@ -1141,6 +1150,9 @@ bool CIrrDeviceLinux::createWindow() { grabPointer(true); } + + XSync(display, false); + sleep(100, false); } if (!SupportsNetWM && CreationParams.Fullscreen)