X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwindow.cpp;h=f916d1c9e5312e4290d40224e076b0e9e776b5e1;hb=78b7a839c4084f7a6cef80cd7d59621460fe5f53;hp=224195605225f16a33427cec2762e3f77f690cb1;hpb=7c7c2cdce368b09b8b07bab860874440c7bc3c14;p=libs%2Fgui.git diff --git a/source/window.cpp b/source/window.cpp index 2241956..f916d1c 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -65,6 +65,31 @@ void Window::set_title(const string &title) display.check_error(); } +void Window::reconfigure(const WindowOptions &opts) +{ + bool fullscreen_changed=(opts.fullscreen!=options.fullscreen); + + options=opts; + + ::Display *dpy=display.get_display(); + + XMoveResizeWindow(dpy, window, 0, 0, options.width, options.height); + + if(fullscreen_changed) + { + hide(); + XSetWindowAttributes attr; + attr.override_redirect=options.fullscreen; + XChangeWindowAttributes(dpy, window, CWOverrideRedirect, &attr); + show(); + } + + if(options.fullscreen) + display.set_mode(VideoMode(options.width, options.height)); + else if(fullscreen_changed) + display.restore_mode(); +} + void Window::show() { XMapRaised(display.get_display(), window);