namespace Msp {
namespace Graphics {
-SimpleWindow::SimpleWindow(unsigned w, unsigned h):
- Window(dpy, w, h)
+SimpleWindow::SimpleWindow(unsigned w, unsigned h, bool fs):
+ Window(dpy, w, h, fs)
{ }
-SimpleGLWindow::SimpleGLWindow(unsigned w, unsigned h):
- SimpleWindow(w, h),
+SimpleGLWindow::SimpleGLWindow(unsigned w, unsigned h, bool fs):
+ SimpleWindow(w, h, fs),
gl_ctx(*this)
{ }
class SimpleWindow: public SimpleWindowBase, public Window
{
public:
- SimpleWindow(unsigned, unsigned);
+ SimpleWindow(unsigned, unsigned, bool =false);
};
GLContext gl_ctx;
public:
- SimpleGLWindow(unsigned, unsigned);
+ SimpleGLWindow(unsigned, unsigned, bool =false);
GLContext &get_gl_context() { return gl_ctx; }
void swap_buffers();
};
#ifndef WIN32
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#ifdef WITH_XF86VIDMODE
+#include <X11/extensions/xf86vmode.h>
+#endif
#else
#include <windowsx.h>
#endif
{
visible=false;
kbd_autorepeat=true;
+ resizing=false;
priv=new Private;
#ifdef WIN32
void Window::reconfigure(const WindowOptions &opts)
{
bool fullscreen_changed=(opts.fullscreen!=options.fullscreen);
+ resizing=(opts.width!=options.width || opts.height!=options.height);
options=opts;
#else
::Display *dpy=display.get_private().display;
+ bool was_visible=visible;
if(fullscreen_changed)
{
- bool was_visible=visible;
-
if(was_visible)
{
hide();
XSetWindowAttributes attr;
attr.override_redirect=options.fullscreen;
XChangeWindowAttributes(dpy, priv->window, CWOverrideRedirect, &attr);
-
- if(was_visible)
- show();
}
XSizeHints hints;
XMoveResizeWindow(dpy, priv->window, 0, 0, options.width, options.height);
else
XResizeWindow(dpy, priv->window, options.width, options.height);
+
+ if(fullscreen_changed)
+ {
+ if(was_visible)
+ show();
+ }
#endif
if(visible)
signal_key_release.emit(XKeycodeToKeysym(display.get_private().display, ev.xkey.keycode, 0), ev.xkey.state);
break;
case ConfigureNotify:
- options.width=ev.xconfigure.width;
- options.height=ev.xconfigure.height;
- signal_resize.emit(options.width, options.height);
+ if((ev.xconfigure.width==static_cast<int>(options.width) && ev.xconfigure.height==static_cast<int>(options.height)) == resizing)
+ {
+ options.width=ev.xconfigure.width;
+ options.height=ev.xconfigure.height;
+ resizing=false;
+ signal_resize.emit(options.width, options.height);
+ }
+ if(options.fullscreen)
+ {
+ ::Display *dpy=display.get_private().display;
+ int screen=DefaultScreen(dpy);
+ XF86VidModeSetViewPort(dpy, screen, ev.xconfigure.x, ev.xconfigure.y);
+ }
break;
case ClientMessage:
if(ev.xclient.data.l[0]==static_cast<long>(priv->wm_delete_window))