2 #include "window_private.h"
3 #include <msp/core/application.h>
11 Window::Window(Display &dpy, unsigned w, unsigned h, bool fs):
16 options.fullscreen = fs;
21 Window::Window(Display &dpy, const WindowOptions &opts):
32 if(options.fullscreen && !options.fullscreen_monitor)
33 options.fullscreen_monitor = display.get_desktop_mode().monitor;
37 display.add_window(*this);
38 display.check_error();
40 const string &app_name = Application::get_name();
49 display.remove_window(*this);
51 if(options.fullscreen && visible)
52 display.restore_mode();
57 void Window::reconfigure(const WindowOptions &opts)
59 bool fullscreen_changed = (opts.fullscreen!=options.fullscreen);
60 if(opts.width!=options.width || opts.height!=options.height)
62 if(opts.x!=options.x || opts.y!=options.y)
69 if(options.fullscreen)
70 set_fullscreen_mode();
71 else if(fullscreen_changed)
72 display.restore_mode();
75 platform_reconfigure(fullscreen_changed);
78 void Window::set_fullscreen_mode()
80 if(!options.fullscreen_monitor)
81 options.fullscreen_monitor = display.get_desktop_mode().monitor;
82 VideoMode mode(options.width, options.height);
83 mode.monitor = options.fullscreen_monitor;
84 mode.rotation = mode.monitor->desktop_settings.rotation;
85 if(mode.rotation==ROTATE_LEFT || mode.rotation==ROTATE_RIGHT)
86 swap(mode.width, mode.height);
87 display.set_mode(mode, options.fullscreen_exclusive);
90 void Window::set_keyboard_autorepeat(bool r)
95 void Window::set_touch_input(bool t)
98 platform_set_touch_input();
106 if(options.fullscreen)
108 set_fullscreen_mode();
109 warp_pointer(options.width/2, options.height/2);
118 if(options.fullscreen)
119 display.restore_mode();
122 } // namespace Graphics