From: Dana Jansens Date: Fri, 8 Jan 2010 19:40:29 +0000 (-0500) Subject: Make focus_valid_target() take a desktop argument. X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=63f748aa3fac4d3ed004a2c5343a51c3a046e21d;p=chaz%2Fopenbox Make focus_valid_target() take a desktop argument. So you can find valid targets on desktops other than the currently visible one --- diff --git a/openbox/client.c b/openbox/client.c index 4d8f4e77..98a27dc9 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -290,7 +290,8 @@ void client_manage(Window window, ObPrompt *prompt) (user_time != 0) && /* this checks for focus=false for the window */ (!settings || settings->focus != 0) && - focus_valid_target(self, FALSE, FALSE, TRUE, FALSE, FALSE, + focus_valid_target(self, self->desktop, + FALSE, FALSE, TRUE, FALSE, FALSE, settings->focus == 1)) { activate = TRUE; diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c index 7f0e9f5d..22840ad6 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -53,7 +53,8 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data) menu_add_separator(menu, SEPARATOR, screen_desktop_names[desktop]); for (it = focus_order; it; it = g_list_next(it)) { ObClient *c = it->data; - if (focus_valid_target(c, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) + if (focus_valid_target(c, desktop, + TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) { empty = FALSE; diff --git a/openbox/client_list_menu.c b/openbox/client_list_menu.c index e1f4987a..3f79f621 100644 --- a/openbox/client_list_menu.c +++ b/openbox/client_list_menu.c @@ -54,7 +54,8 @@ static gboolean desk_menu_update(ObMenuFrame *frame, gpointer data) for (it = focus_order; it; it = g_list_next(it)) { ObClient *c = it->data; - if (focus_valid_target(c, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) { + if (focus_valid_target(c, d->desktop, + TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) { ObMenuEntry *e; empty = FALSE; diff --git a/openbox/focus.c b/openbox/focus.c index 73129749..8b4b66e4 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -129,7 +129,8 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, 3. it is not shaded */ if ((allow_omnipresent || c->desktop == screen_desktop) && - focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) && + focus_valid_target(c, screen_desktop, + TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) && !c->shaded && (allow_refocus || client_focus_target(c) != old) && client_focus(c)) @@ -149,7 +150,8 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, a splashscreen or a desktop window (save the desktop as a backup fallback though) */ - if (focus_valid_target(c, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) && + if (focus_valid_target(c, screen_desktop, + TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) && (allow_refocus || client_focus_target(c) != old) && client_focus(c)) { @@ -273,7 +275,8 @@ static gboolean focus_target_has_siblings(ObClient *ft, ObClient *c = it->data; /* check that it's not a helper window to avoid infinite recursion */ if (c != ft && c->type == OB_CLIENT_TYPE_NORMAL && - focus_valid_target(c, TRUE, iconic_windows, all_desktops, + focus_valid_target(c, screen_desktop, + TRUE, iconic_windows, all_desktops, FALSE, FALSE, FALSE)) { return TRUE; @@ -283,6 +286,7 @@ static gboolean focus_target_has_siblings(ObClient *ft, } gboolean focus_valid_target(ObClient *ft, + guint desktop, gboolean helper_windows, gboolean iconic_windows, gboolean all_desktops, @@ -296,7 +300,7 @@ gboolean focus_valid_target(ObClient *ft, do this check first because it will usually filter out the most windows */ - ok = (all_desktops || ft->desktop == screen_desktop || + ok = (all_desktops || ft->desktop == desktop || ft->desktop == DESKTOP_ALL); /* the window can receive focus somehow */ @@ -341,6 +345,7 @@ gboolean focus_valid_target(ObClient *ft, { ObClient *cft = client_focus_target(ft); ok = ok && (ft == cft || !focus_valid_target(cft, + screen_desktop, TRUE, iconic_windows, all_desktops, diff --git a/openbox/focus.h b/openbox/focus.h index 80ce3a38..f926d01e 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -65,6 +65,7 @@ void focus_order_to_bottom(struct _ObClient *c); struct _ObClient *focus_order_find_first(guint desktop); gboolean focus_valid_target(struct _ObClient *ft, + guint desktop, gboolean helper_windows, gboolean iconic_windows, gboolean all_desktops, diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index a70151fd..4e04477b 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -115,7 +115,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, if (it == NULL) it = g_list_last(list); } ft = it->data; - if (focus_valid_target(ft, TRUE, + if (focus_valid_target(ft, screen_desktop, TRUE, focus_cycle_iconic_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, @@ -186,7 +186,8 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir, /* the currently selected window isn't interesting */ if (cur == c) continue; - if (!focus_valid_target(it->data, TRUE, FALSE, FALSE, dock_windows, + if (!focus_valid_target(it->data, screen_desktop, + TRUE, FALSE, FALSE, dock_windows, desktop_windows, FALSE)) continue; @@ -291,7 +292,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, GList *it; for (it = focus_order; it; it = g_list_next(it)) - if (focus_valid_target(it->data, TRUE, + if (focus_valid_target(it->data, screen_desktop, TRUE, focus_cycle_iconic_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index 4f697fdd..42484418 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -261,7 +261,7 @@ static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets, for (it = g_list_last(focus_order); it; it = g_list_previous(it)) { ObClient *ft = it->data; - if (focus_valid_target(ft, TRUE, + if (focus_valid_target(ft, screen_desktop, TRUE, iconic_windows, all_desktops, dock_windows,