summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-18 06:32:54 +0000
committerDana Jansens <danakj@orodu.net>2003-04-18 06:32:54 +0000
commit9d16ced24e0bdcba0998be008850372055d16a09 (patch)
treec95e3301bb2d5afd9b520406da3ec3e02d706edf
parentf8056d9c28434511073f8bea56d37b87e2fd3fc9 (diff)
try focus other transients of the parent window when a transient falls back before focusing the parent
-rw-r--r--openbox/focus.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/openbox/focus.c b/openbox/focus.c
index cd08ab68..da51669f 100644
--- a/openbox/focus.c
+++ b/openbox/focus.c
@@ -122,6 +122,23 @@ static gboolean focus_under_pointer()
return FALSE;
}
+/* finds the first transient that isn't 'skip' */
+static Client *find_transient_recursive(Client *c, Client *top, Client *skip)
+{
+ GSList *it;
+ Client *ret;
+
+ for (it = c->transients; it; it = it->next) {
+ g_message("looking");
+ if (it->data == top) return NULL;
+ ret = find_transient_recursive(it->data, top, skip);
+ if (ret && ret != skip) return ret;
+ if (it->data != skip) return it->data;
+ g_message("not found");
+ }
+ return NULL;
+}
+
void focus_fallback(FallbackType type)
{
GList *it;
@@ -142,18 +159,29 @@ void focus_fallback(FallbackType type)
}
if (type == Fallback_Unfocusing && old && old->transient_for) {
+ Client *c = NULL;
+
if (old->transient_for == TRAN_GROUP) {
for (it = focus_order[screen_desktop]; it != NULL; it = it->next) {
GSList *sit;
for (sit = old->group->members; sit; sit = sit->next)
- if (sit->data == it->data && client_focus(sit->data))
- return;
+ if (sit->data == it->data && client_normal(sit->data) &&
+ client_focusable(sit->data)) {
+ c = sit->data;
+ break;
+ }
}
} else {
if (client_normal(old->transient_for))
- if (client_focus(old->transient_for))
- return;
+ c = old->transient_for;
+ }
+
+ if (c) {
+ Client *t = find_transient_recursive(c, c, old);
+ if (!t) t = c; /* no transient, keep the top */
+ if (client_focus(t))
+ return;
}
}