1 #include <msp/core/application.h>
4 #include "window_private.h"
11 WindowOptions::WindowOptions():
22 Window::Window(Display &dpy, unsigned w, unsigned h, bool fs):
27 options.fullscreen = fs;
32 Window::Window(Display &dpy, const WindowOptions &opts):
42 kbd_autorepeat = true;
50 display.add_window(*this);
51 display.check_error();
53 const string &app_name = Application::get_name();
62 display.remove_window(*this);
64 if(options.fullscreen && visible)
65 display.restore_mode();
70 void Window::reconfigure(const WindowOptions &opts)
72 bool fullscreen_changed = (opts.fullscreen!=options.fullscreen);
73 if(opts.width!=options.width || opts.height!=options.height)
75 if(opts.x!=options.x || opts.y!=options.y)
82 if(options.fullscreen)
83 set_fullscreen_mode();
84 else if(fullscreen_changed)
85 display.restore_mode();
88 platform_reconfigure(fullscreen_changed);
91 void Window::set_fullscreen_mode()
93 VideoMode mode(options.width, options.height);
94 mode.rotation = display.get_desktop_mode().monitor->desktop_settings.rotation;
95 if(mode.rotation==ROTATE_LEFT || mode.rotation==ROTATE_RIGHT)
96 swap(mode.width, mode.height);
97 display.set_mode(mode, true);
100 void Window::set_keyboard_autorepeat(bool r)
105 void Window::set_touch_input(bool t)
108 platform_set_touch_input();
116 if(options.fullscreen)
118 set_fullscreen_mode();
119 warp_pointer(options.width/2, options.height/2);
128 if(options.fullscreen)
129 display.restore_mode();
132 } // namespace Graphics