X-Git-Url: http://git.openbox.org/?p=mikachu%2Fopenbox.git;a=blobdiff_plain;f=openbox%2Fclient.c;fp=openbox%2Fclient.c;h=b57d61691bd57120e10cf67cf4a41cfe68b03bbf;hp=c0864bc45db4f70ced2b3ba63850b03ba001fc41;hb=c70379fa8f771e499a4d47e84af06d71838b780d;hpb=9676757a08b3e2e508c47f7795326bda8e54dc53 diff --git a/openbox/client.c b/openbox/client.c index c0864bc..b57d616 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -414,6 +414,12 @@ void client_manage(Window window, ObPrompt *prompt) activate ? "yes" : "no"); if (activate) { gboolean raise = FALSE; + gboolean relative_focused = FALSE; + + relative_focused = (focus_client != 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, @@ -444,10 +450,8 @@ void client_manage(Window window, ObPrompt *prompt) "Not focusing the window because its on another " "desktop"); } - /* If something is focused, and it's not our relative... */ - else if (focus_client && client_search_focus_tree_full(self) == NULL && - client_search_focus_group_full(self) == NULL) - { + /* If something is focused... */ + 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 && @@ -461,8 +465,9 @@ void client_manage(Window window, ObPrompt *prompt) "Not focusing the window because the user is " "working in another window"); } - /* If it's a transient (and its parents aren't focused) */ - else if (client_has_parent(self)) { + /* If the new window is a transient (and its relatives aren't + focused) */ + else if (client_has_parent(self) && !relative_focused) { activate = FALSE; ob_debug_type(OB_DEBUG_FOCUS, "Not focusing the window because it is a " @@ -488,8 +493,11 @@ void client_manage(Window window, ObPrompt *prompt) "Not focusing the window because another window " "would get the focus anyway"); } + /* Don't move focus if the window is not visible on the current + desktop and none of its relatives are focused */ else if (!(self->desktop == screen_desktop || - self->desktop == DESKTOP_ALL)) + self->desktop == DESKTOP_ALL) && + !relative_focused) { activate = FALSE; raise = TRUE;