From cc54a0b1f4c61a0dd1978d7390670da534fd7883 Mon Sep 17 00:00:00 2001 From: nimetu Date: Thu, 24 Mar 2022 14:49:08 +0200 Subject: [PATCH] Enable ConfigureEvent for fullscreen window Fixes issue where multi-monitor is removed/resized while client is on that monitor. --- .../3d/driver/opengl/driver_opengl_window.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/nel/src/3d/driver/opengl/driver_opengl_window.cpp index c490fb82c..585fee8ec 100644 --- a/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -265,10 +265,9 @@ bool GlWndProc(CDriverGL *driver, XEvent &e) case ConfigureNotify: - if (driver->_CurrentMode.Windowed && driver->_WndActive) + if (driver->_WndActive) { - // first time setting decoration sizes - if ((driver->_DecorationWidth == -1) || (driver->_DecorationWidth == 0)) + if (driver->_CurrentMode.Windowed) { Atom type_return = 0; int format_return = 0; @@ -294,12 +293,19 @@ bool GlWndProc(CDriverGL *driver, XEvent &e) // don't allow negative decoration sizes if (driver->_DecorationWidth < 0) driver->_DecorationWidth = 0; if (driver->_DecorationHeight < 0) driver->_DecorationHeight = 0; + + driver->_WindowX = e.xconfigure.x - driver->_DecorationWidth; + driver->_WindowY = e.xconfigure.y - driver->_DecorationHeight; + } + else + { + // fullscreen + driver->_WindowX = e.xconfigure.x; + driver->_WindowY = e.xconfigure.y; } driver->_CurrentMode.Width = e.xconfigure.width; driver->_CurrentMode.Height = e.xconfigure.height; - driver->_WindowX = e.xconfigure.x - driver->_DecorationWidth; - driver->_WindowY = e.xconfigure.y - driver->_DecorationHeight; } break; @@ -2775,15 +2781,7 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y) #elif defined (NL_OS_UNIX) if (_CurrentMode.Windowed) - { - // first time requesting decoration sizes - if (_WindowX && _WindowY && !_DecorationWidth && !_DecorationHeight && _WndActive) - { - _DecorationWidth = -1; - _DecorationHeight = -1; - } XMoveWindow(_dpy, _win, x, y); - } #endif // NL_OS_WINDOWS }