Send synthetic unmap events to affected windows, whatever their destination. This needs testing. (Fixes issue #184)

This commit is contained in:
Kris Maglione 2010-05-28 15:51:00 -04:00
parent 072abd44e4
commit 185fdef6f3
7 changed files with 29 additions and 24 deletions

View File

@ -944,9 +944,8 @@ unmap_event(Window *w, void *aux, XUnmapEvent *e) {
Client *c;
c = aux;
if(!e->send_event)
c->unmapped--;
client_destroy(c);
if(e->send_event || c->w.unmapped < 0)
client_destroy(c);
return false;
}

View File

@ -161,7 +161,6 @@ struct Client {
long proto;
uint border;
int fullscreen;
int unmapped;
bool floating;
bool fixedsize;
bool urgent;

View File

@ -10,16 +10,6 @@ debug_event(XEvent *e) {
Dprint(DEvent, "%E\n", e);
}
void
event_buttonpress(XButtonPressedEvent *ev) {
Window *w;
if((w = findwin(ev->window)))
event_handle(w, bdown, ev);
else
XAllowEvents(display, ReplayPointer, ev->time);
}
void
event_configurenotify(XConfigureEvent *ev) {
Window *w;
@ -110,11 +100,13 @@ event_focusout(XFocusChangeEvent *ev) {
void
event_mapnotify(XMapEvent *ev) {
Window *w;
Window *w;
ignoreenter = ev->serial;
if((w = findwin(ev->window)))
event_handle(w, map, ev);
ignoreenter = ev->serial;
if((w = findwin(ev->event)))
event_handle(w, map, ev);
if(ev->send_event && (w = findwin(ev->event)))
event_handle(w, map, ev);
}
void
@ -122,10 +114,15 @@ event_unmapnotify(XUnmapEvent *ev) {
Window *w;
ignoreenter = ev->serial;
if((w = findwin(ev->window)) && (ev->event == w->parent->xid)) {
w->mapped = false;
if(ev->send_event || w->unmapped-- == 0)
if((w = findwin(ev->window))) {
if(!ev->send_event)
w->mapped = false;
if(!ev->send_event && ev->event == ev->window)
w->unmapped--;
if(ev->send_event && ev->event != ev->window)
event_handle(w, unmap, ev);
}
if((w = findwin(ev->event)))
event_handle(w, unmap, ev);
}

View File

@ -9,4 +9,6 @@ event_mapnotify(XMapEvent *ev) {
if((w = findwin(ev->event)))
event_handle(w, map, ev);
if(ev->send_event && (w = findwin(ev->event)))
event_handle(w, map, ev);
}

View File

@ -9,4 +9,6 @@ event_reparentnotify(XReparentEvent *ev) {
if((w = findwin(ev->event)))
event_handle(w, reparent, ev);
if(ev->send_event && (w = findwin(ev->window)))
event_handle(w, reparent, ev);
}

View File

@ -7,9 +7,14 @@ void
event_unmapnotify(XUnmapEvent *ev) {
Window *w;
if((w = findwin(ev->window)) && (ev->event == w->parent->xid)) {
w->mapped = false;
if(w->parent && (ev->send_event || w->unmapped-- == 0))
if((w = findwin(ev->window))) {
if(!ev->send_event)
w->mapped = false;
if(!ev->send_event && ev->event == ev->window)
w->unmapped--;
if(ev->send_event && ev->event != ev->window)
event_handle(w, unmap, ev);
}
if((w = findwin(ev->event)))
event_handle(w, unmap, ev);
}

View File

@ -7,6 +7,7 @@ void
reparentwindow(Window *w, Window *par, Point p) {
assert(w->type == WWindow);
XReparentWindow(display, w->xid, par->xid, p.x, p.y);
w->unmapped++;
w->parent = par;
w->r = rectsubpt(w->r, w->r.min);
w->r = rectaddpt(w->r, p);