]> git.tdb.fi Git - libs/gui.git/commitdiff
Put Window on the correcte monitor when initially created
authorMikko Rasa <tdb@tdb.fi>
Sat, 21 Sep 2019 11:05:29 +0000 (14:05 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 21 Sep 2019 11:05:29 +0000 (14:05 +0300)
source/graphics/window.cpp
source/graphics/x11/window.cpp

index d27f41fd6fda9980cbf9192329335388e918d8c0..6cadf3ec9f4becb047c35033b7d70be5f919a770 100644 (file)
@@ -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);
index 07ff75588c824ad17ab1cdd22b09572a7cd279de..32744deb0178a3dc5684b1786c298d8cb3281ae1 100644 (file)
@@ -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,