summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-25 14:44:49 +0000
committerDana Jansens <danakj@orodu.net>2007-05-25 14:44:49 +0000
commit6a9d502f2020a73202b919ee3e9d85999ededd0f (patch)
treeb8392bf464d4429a2dc8802a9f700a0f5326faa1
parentc83832887bd6ca51fa9e04d91dab086c1bcb4229 (diff)
put the actions back so they don't have to be smart.
make focus_fallback not send focus anywhere if the new target is the same as what is already focused
-rw-r--r--openbox/action.c8
-rw-r--r--openbox/focus.c40
2 files changed, 33 insertions, 15 deletions
diff --git a/openbox/action.c b/openbox/action.c
index 081b68f5..1d815efc 100644
--- a/openbox/action.c
+++ b/openbox/action.c
@@ -1588,7 +1588,7 @@ void action_send_to_desktop(union ActionData *data)
data->sendto.desk == DESKTOP_ALL) {
client_set_desktop(c, data->sendto.desk, data->sendto.follow);
if (data->sendto.follow && data->sendto.desk != screen_desktop)
- screen_set_desktop(data->sendto.desk, c != focus_client);
+ screen_set_desktop(data->sendto.desk, TRUE);
}
}
@@ -1601,7 +1601,7 @@ void action_desktop(union ActionData *data)
{
screen_set_desktop(data->desktop.desk, TRUE);
if (data->inter.any.interactive)
- screen_desktop_popup(data->desktop.desk, focus_client->desktop != DESKTOP_ALL);
+ screen_desktop_popup(data->desktop.desk, TRUE);
}
}
@@ -1621,7 +1621,7 @@ void action_desktop_dir(union ActionData *data)
if (!data->sendtodir.inter.any.interactive ||
(data->sendtodir.inter.final && !data->sendtodir.inter.cancel))
{
- if (d != screen_desktop) screen_set_desktop(d, focus_client->desktop != DESKTOP_ALL);
+ if (d != screen_desktop) screen_set_desktop(d, TRUE);
}
}
@@ -1645,7 +1645,7 @@ void action_send_to_desktop_dir(union ActionData *data)
{
client_set_desktop(c, d, data->sendtodir.follow);
if (data->sendtodir.follow && d != screen_desktop)
- screen_set_desktop(d, c != focus_client);
+ screen_set_desktop(d, TRUE);
}
}
diff --git a/openbox/focus.c b/openbox/focus.c
index 0f9f2f1b..ae0294af 100644
--- a/openbox/focus.c
+++ b/openbox/focus.c
@@ -94,7 +94,8 @@ void focus_set_client(ObClient *client)
}
}
-static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
+static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old,
+ gboolean send_focus)
{
GList *it;
ObClient *c;
@@ -103,10 +104,14 @@ 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) &&
- client_focus(c)))
+ 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)))))
{
- ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff\n");
+ ob_debug_type(OB_DEBUG_FOCUS, "found in pointer stuff (%d)\n",
+ send_focus);
return c;
}
@@ -114,9 +119,11 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
if (allow_refocus && old &&
old->desktop == DESKTOP_ALL &&
client_normal(old) &&
- client_focus(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\n");
+ ob_debug_type(OB_DEBUG_FOCUS, "found in omnipresentness (%d)\n",
+ send_focus);
return old;
}
@@ -134,9 +141,13 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
if (c->desktop == screen_desktop &&
client_normal(c) &&
(allow_refocus || c != old) &&
- client_focus(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)))))
{
- ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n");
+ ob_debug_type(OB_DEBUG_FOCUS, "found in focus order (%d)\n",
+ send_focus);
return c;
}
}
@@ -153,9 +164,13 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
*/
if (c->type == OB_CLIENT_TYPE_DESKTOP &&
(allow_refocus || c != old) &&
- client_focus(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)))))
{
- ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window\n");
+ ob_debug_type(OB_DEBUG_FOCUS, "found a desktop window (%d)\n",
+ send_focus);
return c;
}
}
@@ -168,12 +183,15 @@ 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);
+ new = focus_fallback_target(allow_refocus, old, TRUE);
return new;
}