X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=b6ca93a32d69e376d27ccadbd75d1759f58af6b4;hb=661a53cb6843d02f3373feab91052c47397bb6ed;hp=e9443d4914e256ac5647e7ef2dafd261c7ca13b8;hpb=d78ae0546dae17eda6084a1bd33e63637ba802e5;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index e9443d49..b6ca93a3 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -108,7 +108,6 @@ static void client_call_notifies(ObClient *self, GSList *list); static void client_ping_event(ObClient *self, gboolean dead); static void client_prompt_kill(ObClient *self); - void client_startup(gboolean reconfig) { if ((client_default_icon = RrImageCacheFind(ob_rr_icons, @@ -414,12 +413,14 @@ void client_manage(Window window, ObPrompt *prompt) activate ? "yes" : "no"); if (activate) { gboolean raise = FALSE; - gboolean relative_focused = FALSE; + gboolean relative_focused; + gboolean parent_focused; + parent_focused = (focus_client != NULL && + client_search_focus_parent(self)); relative_focused = (focus_client != NULL && - client_search_focus_tree_full(self) != NULL && - client_search_focus_group_full(self) != NULL); - + (client_search_focus_tree_full(self) != NULL || + client_search_focus_group_full(self) != NULL)); /* This is focus stealing prevention */ ob_debug_type(OB_DEBUG_FOCUS, @@ -427,6 +428,12 @@ void client_manage(Window window, ObPrompt *prompt) "launched at %u (last user interaction time %u)", self->window, map_time, launch_time, event_last_user_time); + ob_debug_type(OB_DEBUG_FOCUS, + "Current focus_client: %s", + (focus_client ? focus_client->title : "(none)")); + ob_debug_type(OB_DEBUG_FOCUS, + "parent focuesed: %d relative focused: %d", + parent_focused, relative_focused); if (menu_frame_visible || moveresize_in_progress) { activate = FALSE; @@ -454,7 +461,8 @@ void client_manage(Window window, ObPrompt *prompt) else if (focus_client) { /* If the user is working in another window right now, then don't steal focus */ - if (event_last_user_time && launch_time && + if (!parent_focused && + event_last_user_time && launch_time && event_time_after(event_last_user_time, launch_time) && event_last_user_time != launch_time && event_time_after(event_last_user_time, @@ -463,7 +471,8 @@ void client_manage(Window window, ObPrompt *prompt) activate = FALSE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because the user is " - "working in another window"); + "working in another window that is not " + "its parent"); } /* If the new window is a transient (and its relatives aren't focused) */ @@ -573,7 +582,6 @@ void client_manage(Window window, ObPrompt *prompt) hooks_queue(OB_HOOK_WIN_NEW, self); } - ObClient *client_fake_manage(Window window) { ObClient *self; @@ -925,6 +933,19 @@ static gboolean client_restore_session_stacking(ObClient *self) return FALSE; } +void client_reconfigure(ObClient *self, gboolean force) +{ + int x, y, w, h, lw, lh; + + x = self->area.x; + y = self->area.y; + w = self->area.width; + h = self->area.height; + client_try_configure(self, &x, &y, &w, &h, &lw, &lh, FALSE); + client_find_onscreen(self, &x, &y, w, h, FALSE); + client_configure(self, x, y, w, h, FALSE, TRUE, force); +} + void client_move_onscreen(ObClient *self, gboolean rude) { gint x = self->area.x; @@ -1300,7 +1321,6 @@ static void client_update_transient_tree(ObClient *self, transient windows as their children. * * */ - /* No change has occured */ if (oldgroup == newgroup && oldgtran == newgtran && @@ -2116,7 +2136,6 @@ void client_update_icons(ObClient *self) (gint*)&w, (gint*)&h, &data); obt_display_ignore_errors(FALSE); - if (xicon) { if (w > 0 && h > 0) { /* is this icon in the cache yet? */ @@ -2613,7 +2632,6 @@ gboolean client_enter_focusable(ObClient *self) self->type != OB_CLIENT_TYPE_DESKTOP); } - static void client_apply_startup_state(ObClient *self, gint x, gint y, gint w, gint h) { @@ -2923,7 +2941,6 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, g_assert(*h > 0); } - void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gboolean user, gboolean final, gboolean force_reply) { @@ -3958,6 +3975,21 @@ ObClient *client_search_focus_parent(ObClient *self) return NULL; } +ObClient *client_search_focus_parent_full(ObClient *self) +{ + GSList *it; + ObClient *ret = NULL; + + for (it = self->parents; it; it = g_slist_next(it)) { + if (client_focused(it->data)) + ret = it->data; + else + ret = client_search_focus_parent_full(it->data); + if (ret) break; + } + return ret; +} + ObClient *client_search_parent(ObClient *self, ObClient *search) { GSList *it;