return DefWindowProc(hwnd, msg, wparam, lparam);
}
+#else
+Bool match_event_type(Display *, XEvent *event, XPointer arg)
+{
+ return event->type==reinterpret_cast<int>(arg);
+}
#endif
}
if(fullscreen_changed)
{
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));
+
XSetWindowAttributes attr;
attr.override_redirect=options.fullscreen;
XChangeWindowAttributes(dpy, priv->window, CWOverrideRedirect, &attr);
if(!priv->invisible_cursor)
{
int screen=DefaultScreen(dpy);
- char data=0;
- XImage *img=XCreateImage(dpy, DefaultVisual(dpy, screen), 1, XYBitmap, 0, &data, 1, 1, 8, 1);
Pixmap pm=XCreatePixmap(dpy, priv->window, 1, 1, 1);
GC gc=XCreateGC(dpy, pm, 0, 0);
- XPutImage(dpy, pm, gc, img, 0, 0, 0, 0, 1, 1);
+ XSetFunction(dpy, gc, GXclear);
+ XDrawPoint(dpy, pm, gc, 0, 0);
+ XFreeGC(dpy, gc);
XColor black;
black.pixel=BlackPixel(dpy, screen);
priv->invisible_cursor=XCreatePixmapCursor(dpy, pm, pm, &black, &black, 0, 0);
- XFreeGC(dpy, gc);
XFreePixmap(dpy, pm);
- img->data=0;
- XDestroyImage(img);
}
XDefineCursor(dpy, priv->window, priv->invisible_cursor);
}
ShowWindow(priv->window, SW_SHOWNORMAL);
#else
XMapRaised(display.get_private().display, priv->window);
- display.check_error();
#endif
}
ShowWindow(priv->window, SW_HIDE);
#else
XUnmapWindow(display.get_private().display, priv->window);
- display.check_error();
#endif
}
signal_close.emit();
break;
case EnterNotify:
- XSetInputFocus(display.get_private().display, priv->window, RevertToParent, CurrentTime);
+ if(options.fullscreen)
+ XSetInputFocus(display.get_private().display, priv->window, RevertToParent, CurrentTime);
break;
case MapNotify:
if(options.fullscreen)