From: Dana Jansens Date: Fri, 16 Apr 2010 22:17:05 +0000 (-0400) Subject: add an option to next/previous window to only include hilited/flashing/urgent windows... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=56fface3a4e2b5970e4867047207da84a58adeb2;p=chaz%2Fopenbox add an option to next/previous window to only include hilited/flashing/urgent windows (feature req/bug #4341) --- diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c index 6bd96577..bbcb6585 100644 --- a/openbox/actions/cyclewindows.c +++ b/openbox/actions/cyclewindows.c @@ -11,6 +11,7 @@ typedef struct { gboolean linear; gboolean dock_windows; gboolean desktop_windows; + gboolean only_hilite_windows; gboolean all_desktops; gboolean forward; gboolean bar; @@ -83,6 +84,8 @@ static gpointer setup_func(xmlNodePtr node, o->raise = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "panels"))) o->dock_windows = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "hilite"))) + o->only_hilite_windows = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "desktop"))) o->desktop_windows = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "allDesktops"))) @@ -154,6 +157,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) ft = focus_cycle(o->forward, o->all_desktops, + !o->only_hilite_windows, o->dock_windows, o->desktop_windows, o->linear, @@ -226,6 +230,7 @@ static void i_post_func(gpointer options) ft = focus_cycle(o->forward, o->all_desktops, + !o->only_hilite_windows, o->dock_windows, o->desktop_windows, o->linear, diff --git a/openbox/client.c b/openbox/client.c index 755e9ad5..2d78040a 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -295,7 +295,7 @@ void client_manage(Window window, ObPrompt *prompt) /* this checks for focus=false for the window */ (!settings || settings->focus != 0) && focus_valid_target(self, self->desktop, - FALSE, FALSE, TRUE, FALSE, FALSE, + FALSE, FALSE, TRUE, 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 f4aae884..f664b776 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -54,7 +54,8 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data) for (it = focus_order; it; it = g_list_next(it)) { ObClient *c = it->data; if (focus_valid_target(c, desktop, - TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) + TRUE, TRUE, + FALSE, TRUE, FALSE, FALSE, FALSE)) { empty = FALSE; diff --git a/openbox/client_list_menu.c b/openbox/client_list_menu.c index 263b3398..b47ead02 100644 --- a/openbox/client_list_menu.c +++ b/openbox/client_list_menu.c @@ -55,7 +55,7 @@ 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, d->desktop, - TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)) { + TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE)) { ObMenuEntry *e; empty = FALSE; diff --git a/openbox/focus.c b/openbox/focus.c index 0b1d5bc5..d86f1c0b 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -133,7 +133,8 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, */ if ((allow_omnipresent || c->desktop == screen_desktop) && focus_valid_target(c, screen_desktop, - TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) && + TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, + FALSE) && !c->shaded && (allow_refocus || client_focus_target(c) != old) && client_focus(c)) @@ -154,7 +155,7 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, backup fallback though) */ if (focus_valid_target(c, screen_desktop, - TRUE, FALSE, FALSE, FALSE, TRUE, FALSE) && + TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE) && (allow_refocus || client_focus_target(c) != old) && client_focus(c)) { @@ -288,7 +289,7 @@ static gboolean focus_target_has_siblings(ObClient *ft, if (c != ft && c->type == OB_CLIENT_TYPE_NORMAL && focus_valid_target(c, screen_desktop, TRUE, iconic_windows, all_desktops, - FALSE, FALSE, FALSE)) + TRUE, FALSE, FALSE, FALSE)) { return TRUE; } @@ -301,6 +302,7 @@ gboolean focus_valid_target(ObClient *ft, gboolean helper_windows, gboolean iconic_windows, gboolean all_desktops, + gboolean nonhilite_windows, gboolean dock_windows, gboolean desktop_windows, gboolean user_request) @@ -321,6 +323,9 @@ gboolean focus_valid_target(ObClient *ft, ok = (all_desktops || ft->desktop == desktop || ft->desktop == DESKTOP_ALL); + /* if we only include hilited windows, check if the window is */ + ok = ok && (nonhilite_windows || ft->demands_attention); + /* the window can receive focus somehow */ ok = ok && (ft->can_focus || ft->focus_notify); @@ -370,6 +375,7 @@ gboolean focus_valid_target(ObClient *ft, TRUE, iconic_windows, all_desktops, + nonhilite_windows, dock_windows, desktop_windows, FALSE)); diff --git a/openbox/focus.h b/openbox/focus.h index 47d86d85..1fc1eb5d 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -73,6 +73,7 @@ gboolean focus_valid_target(struct _ObClient *ft, gboolean helper_windows, gboolean iconic_windows, gboolean all_desktops, + gboolean nonhilite_windows, gboolean dock_windows, gboolean desktop_windows, gboolean user_request); diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index e4c370e7..d478093d 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -39,6 +39,7 @@ ObClient *focus_cycle_target = NULL; static ObCycleType focus_cycle_type = OB_CYCLE_NONE; static gboolean focus_cycle_iconic_windows; static gboolean focus_cycle_all_desktops; +static gboolean focus_cycle_nonhilite_windows; static gboolean focus_cycle_dock_windows; static gboolean focus_cycle_desktop_windows; @@ -89,12 +90,13 @@ void focus_cycle_reorder() TRUE); focus_cycle_update_indicator(focus_cycle_target); if (!focus_cycle_target) - focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, + focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); } } ObClient* focus_cycle(gboolean forward, gboolean all_desktops, + gboolean nonhilite_windows, gboolean dock_windows, gboolean desktop_windows, gboolean linear, gboolean interactive, gboolean showbar, ObFocusCyclePopupMode mode, @@ -126,6 +128,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, if (focus_cycle_target == NULL) { focus_cycle_iconic_windows = TRUE; focus_cycle_all_desktops = all_desktops; + focus_cycle_nonhilite_windows = nonhilite_windows; focus_cycle_dock_windows = dock_windows; focus_cycle_desktop_windows = desktop_windows; start = it = g_list_find(list, focus_client); @@ -153,12 +156,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, focus_cycle_draw_indicator(showbar ? ft : NULL); } /* same arguments as focus_target_valid */ - focus_cycle_popup_show(ft, - focus_cycle_iconic_windows, - focus_cycle_all_desktops, - focus_cycle_dock_windows, - focus_cycle_desktop_windows, - mode); + focus_cycle_popup_show(ft, mode); return focus_cycle_target; } else if (ft != focus_cycle_target) { focus_cycle_target = ft; @@ -302,6 +300,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, if (focus_cycle_target == NULL) { focus_cycle_iconic_windows = FALSE; focus_cycle_all_desktops = FALSE; + focus_cycle_nonhilite_windows = TRUE; focus_cycle_dock_windows = dock_windows; focus_cycle_desktop_windows = desktop_windows; } @@ -332,11 +331,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, } if (focus_cycle_target && dialog) /* same arguments as focus_target_valid */ - focus_cycle_popup_single_show(focus_cycle_target, - focus_cycle_iconic_windows, - focus_cycle_all_desktops, - focus_cycle_dock_windows, - focus_cycle_desktop_windows); + focus_cycle_popup_single_show(focus_cycle_target); return focus_cycle_target; done_cycle: @@ -357,6 +352,7 @@ gboolean focus_cycle_valid(struct _ObClient *client) return focus_valid_target(client, screen_desktop, TRUE, focus_cycle_iconic_windows, focus_cycle_all_desktops, + focus_cycle_nonhilite_windows, focus_cycle_dock_windows, focus_cycle_desktop_windows, FALSE); diff --git a/openbox/focus_cycle.h b/openbox/focus_cycle.h index ab477d65..9394b3df 100644 --- a/openbox/focus_cycle.h +++ b/openbox/focus_cycle.h @@ -36,6 +36,7 @@ void focus_cycle_shutdown(gboolean reconfig); /*! Cycle focus amongst windows. */ struct _ObClient* focus_cycle(gboolean forward, gboolean all_desktops, + gboolean nonhilite_windows, gboolean dock_windows, gboolean desktop_windows, gboolean linear, gboolean interactive, gboolean showbar, ObFocusCyclePopupMode mode, diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index ba2b4680..17290324 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -700,10 +700,7 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) XFlush(obt_display); } -void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows, - gboolean all_desktops, gboolean dock_windows, - gboolean desktop_windows, - ObFocusCyclePopupMode mode) +void focus_cycle_popup_show(ObClient *c, ObFocusCyclePopupMode mode) { g_assert(c != NULL); @@ -747,11 +744,7 @@ void focus_cycle_popup_hide(void) popup_cleanup(); } -void focus_cycle_popup_single_show(struct _ObClient *c, - gboolean iconic_windows, - gboolean all_desktops, - gboolean dock_windows, - gboolean desktop_windows) +void focus_cycle_popup_single_show(struct _ObClient *c) { gchar *text; diff --git a/openbox/focus_cycle_popup.h b/openbox/focus_cycle_popup.h index b085f9a9..cf2d52de 100644 --- a/openbox/focus_cycle_popup.h +++ b/openbox/focus_cycle_popup.h @@ -33,17 +33,10 @@ typedef enum { void focus_cycle_popup_startup(gboolean reconfig); void focus_cycle_popup_shutdown(gboolean reconfig); -void focus_cycle_popup_show(struct _ObClient *c, gboolean iconic_windows, - gboolean all_desktops, gboolean dock_windows, - gboolean desktop_windows, - ObFocusCyclePopupMode mode); +void focus_cycle_popup_show(struct _ObClient *c, ObFocusCyclePopupMode mode); void focus_cycle_popup_hide(void); -void focus_cycle_popup_single_show(struct _ObClient *c, - gboolean iconic_windows, - gboolean all_desktops, - gboolean dock_windows, - gboolean desktop_windows); +void focus_cycle_popup_single_show(struct _ObClient *c); void focus_cycle_popup_single_hide(void); gboolean focus_cycle_popup_is_showing(struct _ObClient *c);