#ifndef WIN32
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#ifdef WITH_XF86VIDMODE
+#include <X11/extensions/xf86vmode.h>
+#endif
#else
#include <windowsx.h>
#endif
#else
Bool match_event_type(Display *, XEvent *event, XPointer arg)
{
- return event->type==reinterpret_cast<int>(arg);
+ return event->type==*reinterpret_cast<int *>(arg);
}
#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();
// Wait for the window to be unmapped. This makes window managers happy.
XEvent ev;
- XPeekIfEvent(dpy, &ev, match_event_type, reinterpret_cast<XPointer>(UnmapNotify));
+ int ev_type=UnmapNotify;
+ XPeekIfEvent(dpy, &ev, match_event_type, reinterpret_cast<char *>(&ev_type));
}
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);
+ }
+#ifdef WITH_XF86VIDMODE
+ if(options.fullscreen)
+ {
+ ::Display *dpy=display.get_private().display;
+ int screen=DefaultScreen(dpy);
+ XF86VidModeSetViewPort(dpy, screen, ev.xconfigure.x, ev.xconfigure.y);
+ }
+#endif
break;
case ClientMessage:
if(ev.xclient.data.l[0]==static_cast<long>(priv->wm_delete_window))