From 1e4215c5c63c53c199a3a5a177607de308c8a3f1 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 8 May 2007 21:57:36 +0000 Subject: [PATCH] merge r6176-6182 from 3.4-working --- openbox/client.c | 34 ++++------------------------------ openbox/client.h | 14 +++----------- openbox/event.c | 1 - openbox/focus.c | 45 ++++++++++++++++++++++++++++++++++----------- openbox/modkeys.c | 1 + 5 files changed, 42 insertions(+), 53 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index c872bbc9..e0d5c215 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2994,8 +2994,7 @@ void client_hilite(ObClient *self, gboolean hilite) void client_set_desktop_recursive(ObClient *self, guint target, - gboolean donthide, - gboolean focus_nonintrusive) + gboolean donthide) { guint old; GSList *it; @@ -3006,10 +3005,6 @@ void client_set_desktop_recursive(ObClient *self, g_assert(target < screen_num_desktops || target == DESKTOP_ALL); - /* remove from the old desktop(s) */ - if (!focus_nonintrusive) - focus_order_remove(self); - old = self->desktop; self->desktop = target; PROP_SET32(self->window, net_wm_desktop, cardinal, target); @@ -3024,14 +3019,6 @@ void client_set_desktop_recursive(ObClient *self, if (STRUT_EXISTS(self->strut)) screen_update_areas(); - /* add to the new desktop(s) */ - if (!focus_nonintrusive) { - if (config_focus_new) - focus_order_to_top(self); - else - focus_order_to_bottom(self); - } - /* call the notifies */ GSList *it; for (it = client_desktop_notifies; it; it = g_slist_next(it)) { @@ -3049,7 +3036,7 @@ void client_set_desktop_recursive(ObClient *self, } void client_set_desktop(ObClient *self, guint target, - gboolean donthide, gboolean focus_nonintrusive) + gboolean donthide) { self = client_search_top_normal_parent(self); client_set_desktop_recursive(self, target, donthide, focus_nonintrusive); @@ -3460,7 +3447,8 @@ static void client_bring_helper_windows_recursive(ObClient *self, if (client_helper(self) && self->desktop != desktop && self->desktop != DESKTOP_ALL) { - client_set_desktop(self, desktop, FALSE, TRUE); + client_set_desktop(self, desktop, FALSE); +>>>>>>> .merge-right.r6182 } } @@ -3902,17 +3890,3 @@ gboolean client_has_group_siblings(ObClient *self) { return self->group && self->group->members->next; } - -gboolean client_has_non_helper_group_siblings(ObClient *self) -{ - GSList *it; - - if (!self->group) return FALSE; - - for (it = self->group->members; it; it = g_slist_next(it)) { - ObClient *c = it->data; - if (c != self && client_normal(c) && !client_helper(c)) - return TRUE; - } - return FALSE; -} diff --git a/openbox/client.h b/openbox/client.h index ae60181c..5fb26262 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -464,13 +464,9 @@ void client_kill(ObClient *self); /*! Sends the window to the specified desktop @param donthide If TRUE, the window will not be shown/hidden after its - desktop has been changed. Generally this should be FALSE. - @param focus_nonintrusive If TRUE, the window will not be moved in the - focus order at all. Do this when moving windows to a desktop in - the "background" or something. It can be used to make a window share - multiple desktops. Generally this should be FALSE. */ -void client_set_desktop(ObClient *self, guint target, - gboolean donthide, gboolean focus_nonintrusive); + desktop has been changed. Generally this should be FALSE. +*/ +void client_set_desktop(ObClient *self, guint target, gboolean donthide); /*! Show the client if it should be shown. */ void client_show(ObClient *self); @@ -665,8 +661,4 @@ ObClient* client_under_pointer(); gboolean client_has_group_siblings(ObClient *self); -/*! Returns if a client has an group siblings which are main application - windows (not helper or non-normal windows) */ -gboolean client_has_non_helper_group_siblings(ObClient *self); - #endif diff --git a/openbox/event.c b/openbox/event.c index ace3e861..38ad837c 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -43,7 +43,6 @@ #include "translate.h" #include -#include #include #include diff --git a/openbox/focus.c b/openbox/focus.c index b473686a..80cd0b08 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -37,7 +37,7 @@ #include #include -#define FOCUS_INDICATOR_WIDTH 5 +#define FOCUS_INDICATOR_WIDTH 6 ObClient *focus_client = NULL; GList *focus_order = NULL; @@ -528,6 +528,28 @@ void focus_cycle_draw_indicator() } } +static gboolean has_valid_group_siblings_on_desktop(ObClient *ft, + gboolean all_desktops) + +{ + GSList *it; + + if (!ft->group) return FALSE; + + for (it = ft->group->members; it; it = g_slist_next(it)) { + ObClient *c = it->data; + /* check that it's not a helper window to avoid infinite recursion */ + if (c != ft && !client_helper(ft) && + valid_focus_target(ft, all_desktops, FALSE)) + { + return TRUE; + } + } + return FALSE; +} + +/*! @param allow_helpers This is used for calling itself recursively while + checking helper windows. */ static gboolean valid_focus_target(ObClient *ft, gboolean all_desktops, gboolean dock_windows) @@ -548,16 +570,17 @@ static gboolean valid_focus_target(ObClient *ft, if (dock_windows) ok = ok && ft->type == OB_CLIENT_TYPE_DOCK; else - ok = ok && (ft->type == OB_CLIENT_TYPE_NORMAL || - ft->type == OB_CLIENT_TYPE_DIALOG || - ((ft->type == OB_CLIENT_TYPE_TOOLBAR || - ft->type == OB_CLIENT_TYPE_MENU || - ft->type == OB_CLIENT_TYPE_UTILITY) && - /* let alt-tab go to these windows when a window in its - group already has focus ... */ - ((focus_client && ft->group == focus_client->group) || - /* ... or if there are no main windows in its group */ - !client_has_non_helper_group_siblings(ft)))); + /* normal non-helper windows are valid targets */ + ok = ok && + ((client_normal(ft) && !client_helper(ft)) + || + /* helper windows are valid targets it... */ + (client_helper(ft) && + /* ...a window in its group already has focus ... */ + ((focus_client && ft->group == focus_client->group) || + /* ... or if there are no other windows in its group + that can be cycled to instead */ + !has_valid_group_siblings_on_desktop(ft, all_desktops)))); /* it's not set to skip the taskbar (unless it is a type that would be expected to set this hint */ diff --git a/openbox/modkeys.c b/openbox/modkeys.c index dc522082..4eb836e5 100644 --- a/openbox/modkeys.c +++ b/openbox/modkeys.c @@ -20,6 +20,7 @@ #include "openbox.h" #include +#include /* These masks are constants and the modifier keys are bound to them as anyone sees fit: -- 2.39.2