From 27a621a559aea51eec8b9cdadf58f2074c91a072 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 21 Sep 2019 14:05:29 +0300 Subject: [PATCH] Put Window on the correcte monitor when initially created --- source/graphics/window.cpp | 3 +++ source/graphics/x11/window.cpp | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) 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, -- 2.45.2