]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/window.cpp
Use lambdas for comparison functions
[libs/gui.git] / source / graphics / window.cpp
index 958667ead5698165d18508a7685f7ea1eebcfa9f..79cfb7d99833029a0827064c5f74bde8fd3f8899 100644 (file)
@@ -1,24 +1,13 @@
-#include <msp/core/application.h>
-#include "display.h"
 #include "window.h"
 #include "window_private.h"
+#include <msp/core/application.h>
+#include "display.h"
 
 using namespace std;
 
 namespace Msp {
 namespace Graphics {
 
-WindowOptions::WindowOptions():
-       x(0),
-       y(0),
-       user_position(false),
-       width(640),
-       height(480),
-       fullscreen(false),
-       resizable(false)
-{ }
-
-
 Window::Window(Display &dpy, unsigned w, unsigned h, bool fs):
        display(dpy)
 {
@@ -38,13 +27,11 @@ Window::Window(Display &dpy, const WindowOptions &opts):
 
 void Window::init()
 {
-       visible = false;
-       kbd_autorepeat = true;
-       touch_input = false;
-       resizing = false;
-       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);
@@ -90,11 +77,14 @@ void Window::reconfigure(const WindowOptions &opts)
 
 void Window::set_fullscreen_mode()
 {
+       if(!options.fullscreen_monitor)
+               options.fullscreen_monitor = display.get_desktop_mode().monitor;
        VideoMode mode(options.width, options.height);
-       mode.rotation = display.get_desktop_mode().monitor->desktop_settings.rotation;
+       mode.monitor = options.fullscreen_monitor;
+       mode.rotation = mode.monitor->desktop_settings.rotation;
        if(mode.rotation==ROTATE_LEFT || mode.rotation==ROTATE_RIGHT)
                swap(mode.width, mode.height);
-       display.set_mode(mode, true);
+       display.set_mode(mode, options.fullscreen_exclusive);
 }
 
 void Window::set_keyboard_autorepeat(bool r)