]> Dogcows Code - chaz/openbox/commitdiff
add an option to next/previous window to only include hilited/flashing/urgent windows...
authorDana Jansens <danakj@orodu.net>
Fri, 16 Apr 2010 22:17:05 +0000 (18:17 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 17 Apr 2010 01:32:31 +0000 (21:32 -0400)
openbox/actions/cyclewindows.c
openbox/client.c
openbox/client_list_combined_menu.c
openbox/client_list_menu.c
openbox/focus.c
openbox/focus.h
openbox/focus_cycle.c
openbox/focus_cycle.h
openbox/focus_cycle_popup.c
openbox/focus_cycle_popup.h

index 6bd965773c20c92ac532e3777c86b4e64b612cb1..bbcb6585a11422e22001bf22ab8925af321c13cd 100644 (file)
@@ -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,
index 755e9ad568dfccce9db8b1f75ec83f18b9c13e9a..2d78040ad4d5db23cf2dc64e6c000688e99bc902 100644 (file)
@@ -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;
index f4aae884eb3139892efb49570a09eeb203290ff3..f664b776ad693ecea35457a9b5853b7015721015 100644 (file)
@@ -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;
 
index 263b3398514cb70c07686d457f494cb7e6ca418e..b47ead02b30ed0fb8831152a1de6bbbba2b57318 100644 (file)
@@ -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;
index 0b1d5bc5a555ef7711662f102f3d9e6e8ee073bc..d86f1c0b348f953fbb2b98824a80b9023bb23aeb 100644 (file)
@@ -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));
index 47d86d85c9941039d94e2cd07e023cb3c37b1300..1fc1eb5d7046b91a3b1a597c9b8ae5f19cefbe88 100644 (file)
@@ -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);
index e4c370e7aa5b5ff0f60c1755cb6fc0906d0c231a..d478093d308452fbe67d6950f2829648bb04ceaf 100644 (file)
@@ -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);
index ab477d65bb80f34520fa960c7e5531351787fa75..9394b3df8bb65ba187b4f1e37329a942d65900b5 100644 (file)
@@ -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,
index ba2b4680553d00d408ded4ded4aa4b422242beba..172903240cc065d9dd06ec517a2913c74e039703 100644 (file)
@@ -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;
 
index b085f9a94e1ba3e13072c2d18552ab7e103e14cc..cf2d52de48a04e307702f8a15f55a4737d45d3ed 100644 (file)
@@ -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);
This page took 0.038433 seconds and 4 git commands to generate.