X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus.c;h=fad53e92dcf67897f927076129ce3f2465f44ad6;hb=7d164842e0d0c3138401fad0dafc6f21bba0a04f;hp=ae0294af53bb20ca8107d8eb42db59b4d10019d2;hpb=6a9d502f2020a73202b919ee3e9d85999ededd0f;p=chaz%2Fopenbox diff --git a/openbox/focus.c b/openbox/focus.c index ae0294af..fad53e92 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -94,8 +94,7 @@ void focus_set_client(ObClient *client) } } -static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old, - gboolean send_focus) +static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old) { GList *it; ObClient *c; @@ -104,30 +103,13 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old, if (config_focus_follow && !config_focus_last) if ((c = client_under_pointer()) && (allow_refocus || c != old) && - client_normal(c) && - /* if we're sending focus then try to */ - ((send_focus && client_focus(c)) || - /* if not just see if we could try, or it's already focused */ - (!send_focus && (c == old || client_can_focus(c))))) + (client_normal(c) && + client_focus(c))) { - ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff (%d)\n", - send_focus); + ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff\n"); return c; } - ob_debug_type(OB_DEBUG_FOCUS, "trying omnipresentness\n"); - if (allow_refocus && old && - old->desktop == DESKTOP_ALL && - client_normal(old) && - /* this one is only for when not sending focus, to keep it there */ - !send_focus) - { - ob_debug_type(OB_DEBUG_FOCUS, "found in omnipresentness (%d)\n", - send_focus); - return old; - } - - ob_debug_type(OB_DEBUG_FOCUS, "trying the focus order\n"); for (it = focus_order; it; it = g_list_next(it)) { c = it->data; @@ -141,13 +123,9 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old, if (c->desktop == screen_desktop && client_normal(c) && (allow_refocus || c != old) && - /* if we're sending focus then try to */ - ((send_focus && client_focus(c)) || - /* if not just see if we could try, or it's already focused */ - (!send_focus && (c == old || client_can_focus(c))))) + client_focus(c)) { - ob_debug_type(OB_DEBUG_FOCUS, "found in focus order (%d)\n", - send_focus); + ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n"); return c; } } @@ -164,13 +142,9 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old, */ if (c->type == OB_CLIENT_TYPE_DESKTOP && (allow_refocus || c != old) && - /* if we're sending focus then try to */ - ((send_focus && client_focus(c)) || - /* if not just see if we could try, or it's already focused */ - (!send_focus && (c == old || client_can_focus(c))))) + client_focus(c)) { - ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window (%d)\n", - send_focus); + ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window\n"); return c; } } @@ -183,15 +157,12 @@ ObClient* focus_fallback(gboolean allow_refocus) ObClient *new; ObClient *old = focus_client; - new = focus_fallback_target(allow_refocus, old, FALSE); - if (new == old) return; - /* unfocus any focused clients.. they can be focused by Pointer events and such, and then when we try focus them, we won't get a FocusIn event at all for them. */ focus_nothing(); - new = focus_fallback_target(allow_refocus, old, TRUE); + new = focus_fallback_target(allow_refocus, old); return new; }