X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=e6265e93664226f5049f82660eb0d6c1ac317826;hb=51cc41e4db6295fbf9a3d2be6e8935d51ad61458;hp=19b8c122a1b9392cc8af273b11920e1f983e8069;hpb=af7278b6e5f0c67fb5b19c8800a4b79aa043e7a9;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 19b8c122..e6265e93 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -406,6 +406,20 @@ void client_unmanage(ObClient *self) func(self); } + if (focus_client == self) { + XEvent e; + + /* focus the last focused window on the desktop, and ignore enter + events from the unmap so it doesnt mess with the focus */ + while (XCheckTypedEvent(ob_display, EnterNotify, &e)); + /* remove these flags so we don't end up getting focused in the + fallback! */ + self->can_focus = FALSE; + self->focus_notify = FALSE; + self->modal = FALSE; + client_unfocus(self); + } + /* tell our parent(s) that we're gone */ if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */ GSList *it; @@ -433,15 +447,6 @@ void client_unmanage(ObClient *self) self->group = NULL; } - if (focus_client == self) { - XEvent e; - - /* focus the last focused window on the desktop, and ignore enter - events from the unmap so it doesnt mess with the focus */ - while (XCheckTypedEvent(ob_display, EnterNotify, &e)); - client_unfocus(self); - } - /* give the client its border back */ client_toggle_border(self, TRUE); @@ -2511,24 +2516,24 @@ gboolean client_can_focus(ObClient *self) (self->desktop == screen_desktop || self->desktop == DESKTOP_ALL) && !self->iconic)) - return FALSE; + return FALSE; /* do a check to see if the window has already been unmapped or destroyed do this intelligently while watching out for unmaps we've generated (ignore_unmaps > 0) */ if (XCheckTypedWindowEvent(ob_display, self->window, - DestroyNotify, &ev)) { - XPutBackEvent(ob_display, &ev); - return FALSE; + DestroyNotify, &ev)) { + XPutBackEvent(ob_display, &ev); + return FALSE; } while (XCheckTypedWindowEvent(ob_display, self->window, - UnmapNotify, &ev)) { - if (self->ignore_unmaps) { - self->ignore_unmaps--; - } else { - XPutBackEvent(ob_display, &ev); - return FALSE; - } + UnmapNotify, &ev)) { + if (self->ignore_unmaps) { + self->ignore_unmaps--; + } else { + XPutBackEvent(ob_display, &ev); + return FALSE; + } } return TRUE;