X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fwindow.cpp;h=073cd8d5c819311277bfeb6e0ff0444521a4eeb9;hb=787d1982dceae67b9b934a9b74e08a096c0c1830;hp=d116b691c14bcbf11592bca91d9edcb647eca792;hpb=9c7ae47da64904c2aa9a9969870ca8befebe7d02;p=libs%2Fgui.git diff --git a/source/graphics/window.cpp b/source/graphics/window.cpp index d116b69..073cd8d 100644 --- a/source/graphics/window.cpp +++ b/source/graphics/window.cpp @@ -75,18 +75,28 @@ void Window::reconfigure(const WindowOptions &opts) if(opts.x!=options.x || opts.y!=options.y) moving = true; + options = opts; + if(visible) { - if(opts.fullscreen) - display.set_mode(VideoMode(opts.width, opts.height)); + if(options.fullscreen) + set_fullscreen_mode(); else if(fullscreen_changed) display.restore_mode(); } - options = opts; platform_reconfigure(fullscreen_changed); } +void Window::set_fullscreen_mode() +{ + VideoMode mode(options.width, options.height); + mode.rotation = display.get_desktop_mode().monitor->desktop_rotation; + if(mode.rotation==ROTATE_LEFT || mode.rotation==ROTATE_RIGHT) + swap(mode.width, mode.height); + display.set_mode(mode, true); +} + void Window::set_keyboard_autorepeat(bool r) { kbd_autorepeat = r; @@ -105,7 +115,7 @@ void Window::show() if(options.fullscreen) { - display.set_mode(VideoMode(options.width, options.height), true); + set_fullscreen_mode(); warp_pointer(options.width/2, options.height/2); } }