From: Mikko Rasa Date: Sat, 21 Sep 2019 11:05:29 +0000 (+0300) Subject: Put Window on the correcte monitor when initially created X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=27a621a559aea51eec8b9cdadf58f2074c91a072;p=libs%2Fgui.git Put Window on the correcte monitor when initially created --- diff --git a/source/graphics/window.cpp b/source/graphics/window.cpp index d27f41f..6cadf3e 100644 --- a/source/graphics/window.cpp +++ b/source/graphics/window.cpp @@ -47,6 +47,9 @@ void Window::init() moving = false; priv = new Private; + if(options.fullscreen && !options.fullscreen_monitor) + options.fullscreen_monitor = display.get_desktop_mode().monitor; + platform_init(); display.add_window(*this); diff --git a/source/graphics/x11/window.cpp b/source/graphics/x11/window.cpp index 07ff755..32744de 100644 --- a/source/graphics/x11/window.cpp +++ b/source/graphics/x11/window.cpp @@ -34,9 +34,19 @@ void Window::platform_init() attr.override_redirect = options.fullscreen; attr.event_mask = ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask|EnterWindowMask|ExposureMask|FocusChangeMask; + // User position is set when the window is mapped + int x = 0; + int y = 0; + if(options.fullscreen && !options.fullscreen_exclusive) + { + const Monitor::Settings &ms = options.fullscreen_monitor->current_settings; + x = ms.x; + y = ms.y; + } + priv->window = XCreateWindow(dpy, display.get_private().root_window, - 0, 0, // User position is set when the window is mapped + x, y, options.width, options.height, 0, CopyFromParent,