client_validate should return FALSE only for UnmapNotifies that will cause the window to become unmanaged

This commit is contained in:
Dana Jansens 2009-07-03 18:58:21 -04:00 committed by Mikael Magnusson
parent 75ca846792
commit d48e720c39

View file

@ -3591,18 +3591,38 @@ ObClient *client_search_modal_child(ObClient *self)
return NULL; return NULL;
} }
static gboolean client_validate_unmap(ObClient *self, int n)
{
XEvent e;
gboolean ret = TRUE;
if (XCheckTypedWindowEvent(ob_display, self->window, UnmapNotify, &e)) {
if (n < self->ignore_unmaps) // ignore this one, but look for more
ret = client_validate_unmap(self, n+1);
else
ret = FALSE; // the window is going to become unmanaged
/* put them back on the event stack so they end up in the same order */
XPutBackEvent(ob_display, &e);
}
return ret;
}
gboolean client_validate(ObClient *self) gboolean client_validate(ObClient *self)
{ {
XEvent e; XEvent e;
XSync(ob_display, FALSE); /* get all events on the server */ XSync(ob_display, FALSE); /* get all events on the server */
if (XCheckTypedWindowEvent(ob_display, self->window, DestroyNotify, &e) || if (XCheckTypedWindowEvent(ob_display, self->window, DestroyNotify, &e)) {
XCheckTypedWindowEvent(ob_display, self->window, UnmapNotify, &e)) {
XPutBackEvent(ob_display, &e); XPutBackEvent(ob_display, &e);
return FALSE; return FALSE;
} }
if (!client_validate_unmap(self, 0))
return FALSE;
return TRUE; return TRUE;
} }