mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
x11events: ignore UnmapNotify events from XReparentWindow
UnmapNotify event does not mean that window has been iconified. It just reports that window changed state from mapped to unmapped. XReparentWindow can unmap and remap window if it was mapped. This causes unnecessary events - HIDDEN, MINIMIZED, RESTORED and SHOW. These events are problematic with Metacity 3.36+ which started to remove window decorations from fullscreen windows. - SDL makes decorated window fullscreen - Metacity removes decorations - SDL gets UnmapNotify and exits from fullscreen - Metacity re-adds decorations As SDL will also get MapNotify event it will try to restore window state causing above steps to repeat. https://bugzilla.libsdl.org/show_bug.cgi?id=5314
This commit is contained in:
parent
e37a9385e2
commit
73010da4dc
@ -642,6 +642,29 @@ X11_HandleClipboardEvent(_THIS, const XEvent *xevent)
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
isMapNotify(Display *display, XEvent *ev, XPointer arg)
|
||||
{
|
||||
XUnmapEvent *unmap;
|
||||
|
||||
unmap = (XUnmapEvent*) arg;
|
||||
|
||||
return ev->type == MapNotify &&
|
||||
ev->xmap.window == unmap->window &&
|
||||
ev->xmap.serial == unmap->serial;
|
||||
}
|
||||
|
||||
static Bool
|
||||
isReparentNotify(Display *display, XEvent *ev, XPointer arg)
|
||||
{
|
||||
XUnmapEvent *unmap;
|
||||
|
||||
unmap = (XUnmapEvent*) arg;
|
||||
|
||||
return ev->type == ReparentNotify &&
|
||||
ev->xreparent.window == unmap->window &&
|
||||
ev->xreparent.serial == unmap->serial;
|
||||
}
|
||||
|
||||
static void
|
||||
X11_DispatchEvent(_THIS)
|
||||
@ -948,11 +971,18 @@ X11_DispatchEvent(_THIS)
|
||||
|
||||
/* Have we been iconified? */
|
||||
case UnmapNotify:{
|
||||
XEvent ev;
|
||||
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window %p: UnmapNotify!\n", data);
|
||||
#endif
|
||||
|
||||
if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent.xunmap)) {
|
||||
X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&xevent.xunmap);
|
||||
} else {
|
||||
X11_DispatchUnmapNotify(data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Have we been restored? */
|
||||
|
Loading…
Reference in New Issue
Block a user