X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=e6265e93664226f5049f82660eb0d6c1ac317826;hb=51cc41e4db6295fbf9a3d2be6e8935d51ad61458;hp=6de12d19f855c4a99215d338f6562b0d381234d1;hpb=411cc1d1d9e0c7ad07fe6bce548ccf101a2f4c7a;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 6de12d19..e6265e93 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -401,6 +401,25 @@ void client_unmanage(ObClient *self) influence */ screen_update_areas(); + for (it = client_destructors; it; it = g_slist_next(it)) { + GDestroyNotify func = (GDestroyNotify) it->data; + 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; @@ -410,8 +429,8 @@ void client_unmanage(ObClient *self) ((ObClient*)it->data)->transients = g_slist_remove(((ObClient*)it->data)->transients, self); } else if (self->transient_for) { /* transient of window */ - self->transient_for->transients = - g_slist_remove(self->transient_for->transients, self); + self->transient_for->transients = + g_slist_remove(self->transient_for->transients, self); } /* tell our transients that we're gone */ @@ -422,20 +441,6 @@ void client_unmanage(ObClient *self) } } - for (it = client_destructors; it; it = g_slist_next(it)) { - GDestroyNotify func = (GDestroyNotify) it->data; - 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)); - client_unfocus(self); - } - /* remove from its group */ if (self->group) { group_remove(self->group, self); @@ -2289,7 +2294,7 @@ void client_set_desktop_recursive(ObClient *self, client_showhide(self); /* raise if it was not already on the desktop */ if (old != DESKTOP_ALL) - action_run_string("Raise", self); + client_raise(self); screen_update_areas(); /* add to the new desktop(s) */ @@ -2492,7 +2497,7 @@ ObClient *client_focus_target(ObClient *self) ObClient *child; /* if we have a modal child, then focus it, not us */ - child = client_search_modal_child(self); + child = client_search_modal_child(client_search_top_transient(self)); if (child) return child; return self; } @@ -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; @@ -2602,7 +2607,7 @@ void client_activate(ObClient *self, gboolean here) if (client_normal(self) && screen_showing_desktop) screen_show_desktop(FALSE); if (self->iconic) - client_iconify(self, FALSE, FALSE); + client_iconify(self, FALSE, here); if (self->desktop != DESKTOP_ALL && self->desktop != screen_desktop) { if (here) @@ -2623,6 +2628,16 @@ void client_activate(ObClient *self, gboolean here) about raising the window. when a fullscreen window loses focus, we need this or else the raise wont be able to raise above the to-lose-focus fullscreen window. */ + client_raise(self); +} + +void client_raise(ObClient *self) +{ + action_run_string("Raise", self); +} + +void client_lower(ObClient *self) +{ action_run_string("Raise", self); }