]> Dogcows Code - chaz/openbox/commitdiff
let you raise the focus target temporarily during focus cycling, with the <raise...
authorDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 21:11:51 +0000 (16:11 -0500)
committerDana Jansens <danakj@orodu.net>
Fri, 11 Jan 2008 21:11:51 +0000 (16:11 -0500)
openbox/actions/cyclewindows.c
openbox/actions/directionalwindows.c
openbox/focus_cycle.c
openbox/focus_cycle.h
openbox/focus_cycle_indicator.c

index 285df37029979d0f487db9b7ed0d7f1f3007df27..059db93f9ccf3900b960e3e28ab1a9a7d1985413 100644 (file)
@@ -1,4 +1,6 @@
 #include "openbox/actions.h"
+#include "openbox/stacking.h"
+#include "openbox/window.h"
 #include "openbox/event.h"
 #include "openbox/focus_cycle.h"
 #include "openbox/openbox.h"
@@ -11,6 +13,8 @@ typedef struct {
     gboolean desktop_windows;
     gboolean all_desktops;
     gboolean forward;
+    gboolean bar;
+    gboolean raise;
     GSList *actions;
 } Options;
 
@@ -46,11 +50,16 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
 
     o = g_new0(Options, 1);
     o->dialog = TRUE;
+    o->bar = TRUE;
 
     if ((n = parse_find_node("linear", node)))
         o->linear = parse_bool(doc, n);
     if ((n = parse_find_node("dialog", node)))
         o->dialog = parse_bool(doc, n);
+    if ((n = parse_find_node("bar", node)))
+        o->bar = parse_bool(doc, n);
+    if ((n = parse_find_node("raise", node)))
+        o->raise = parse_bool(doc, n);
     if ((n = parse_find_node("panels", node)))
         o->dock_windows = parse_bool(doc, n);
     if ((n = parse_find_node("desktop", node)))
@@ -111,17 +120,22 @@ static void free_func(gpointer options)
 static gboolean run_func(ObActionsData *data, gpointer options)
 {
     Options *o = options;
+    struct _ObClient *ft;
 
-    focus_cycle(o->forward,
-                o->all_desktops,
-                o->dock_windows,
-                o->desktop_windows,
-                o->linear,
-                TRUE,
-                o->dialog,
-                FALSE, FALSE);
+    ft = focus_cycle(o->forward,
+                     o->all_desktops,
+                     o->dock_windows,
+                     o->desktop_windows,
+                     o->linear,
+                     TRUE,
+                     o->bar,
+                     o->dialog,
+                     FALSE, FALSE);
     cycling = TRUE;
 
+    stacking_restore();
+    if (o->raise) stacking_temp_raise(CLIENT_AS_WINDOW(ft));
+
     return TRUE;
 }
 
@@ -174,6 +188,7 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
                      o->desktop_windows,
                      o->linear,
                      TRUE,
+                     o->bar,
                      o->dialog,
                      TRUE, cancel);
     cycling = FALSE;
@@ -181,4 +196,6 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
     if (ft)
         actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
                          state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
+
+    stacking_restore();
 }
index 707659ebac5af57ae47ab7155a387327ae89984d..c575d84e2d056b5ae99fa21b12046d1839d07757 100644 (file)
@@ -1,5 +1,7 @@
 #include "openbox/actions.h"
 #include "openbox/event.h"
+#include "openbox/stacking.h"
+#include "openbox/window.h"
 #include "openbox/focus_cycle.h"
 #include "openbox/openbox.h"
 #include "openbox/misc.h"
@@ -11,6 +13,8 @@ typedef struct {
     gboolean dock_windows;
     gboolean desktop_windows;
     ObDirection direction;
+    gboolean bar;
+    gboolean raise;
     GSList *actions;
 } Options;
 
@@ -46,9 +50,14 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
 
     o = g_new0(Options, 1);
     o->dialog = TRUE;
+    o->bar = TRUE;
 
     if ((n = parse_find_node("dialog", node)))
         o->dialog = parse_bool(doc, n);
+    if ((n = parse_find_node("bar", node)))
+        o->bar = parse_bool(doc, n);
+    if ((n = parse_find_node("raise", node)))
+        o->raise = parse_bool(doc, n);
     if ((n = parse_find_node("panels", node)))
         o->dock_windows = parse_bool(doc, n);
     if ((n = parse_find_node("desktop", node)))
@@ -135,13 +144,19 @@ static gboolean run_func(ObActionsData *data, gpointer options)
     if (!o->interactive)
         end_cycle(FALSE, data->state, o);
     else {
-        focus_directional_cycle(o->direction,
-                                o->dock_windows,
-                                o->desktop_windows,
-                                TRUE,
-                                o->dialog,
-                                FALSE, FALSE);
+        struct _ObClient *ft;
+
+        ft = focus_directional_cycle(o->direction,
+                                     o->dock_windows,
+                                     o->desktop_windows,
+                                     TRUE,
+                                     o->bar,
+                                     o->dialog,
+                                     FALSE, FALSE);
         cycling = TRUE;
+
+        stacking_restore();
+        if (o->raise) stacking_temp_raise(CLIENT_AS_WINDOW(ft));
     }
 
     return o->interactive;
@@ -194,12 +209,14 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
                                  o->dock_windows,
                                  o->desktop_windows,
                                  o->interactive,
+                                 o->bar,
                                  o->dialog,
                                  TRUE, cancel);
     cycling = FALSE;
 
-    if (ft) {
+    if (ft)
         actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
                          state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
-    }
+
+    stacking_restore();
 }
index 85cdf4808b7067e66716c825d3b531b9f9bd7d37..2348f8d0364b7d4802aa41bc01e3a836e3cb65b1 100644 (file)
@@ -62,15 +62,16 @@ void focus_cycle_stop(ObClient *ifclient)
                            focus_cycle_dock_windows,
                            focus_cycle_desktop_windows))
     {
-        focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
-        focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
+        focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE);
+        focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
     }
 }
 
 ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
                       gboolean dock_windows, gboolean desktop_windows,
                       gboolean linear, gboolean interactive,
-                      gboolean dialog, gboolean done, gboolean cancel)
+                      gboolean showbar, gboolean dialog,
+                      gboolean done, gboolean cancel)
 {
     static ObClient *t = NULL;
     static GList *order = NULL;
@@ -128,7 +129,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
             if (interactive) {
                 if (ft != focus_cycle_target) { /* prevents flicker */
                     focus_cycle_target = ft;
-                    focus_cycle_draw_indicator(ft);
+                    focus_cycle_draw_indicator(showbar ? ft : NULL);
                 }
                 if (dialog)
                     /* same arguments as focus_target_valid */
@@ -261,7 +262,7 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir,
 ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
                                   gboolean desktop_windows,
                                   gboolean interactive,
-                                  gboolean dialog,
+                                  gboolean showbar, gboolean dialog,
                                   gboolean done, gboolean cancel)
 {
     static ObClient *first = NULL;
@@ -307,7 +308,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
         focus_cycle_target = ft;
         if (!interactive)
             goto done_cycle;
-        focus_cycle_draw_indicator(ft);
+        focus_cycle_draw_indicator(showbar ? ft : NULL);
     }
     if (focus_cycle_target && dialog)
         /* same arguments as focus_target_valid */
index 68b8d929d149d856a08e1f5ad5dc416804063102..6e1c2c9dbad183f990ff8fb70addc494bd63a3a5 100644 (file)
@@ -37,11 +37,13 @@ void focus_cycle_shutdown(gboolean reconfig);
 struct _ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
                               gboolean dock_windows, gboolean desktop_windows,
                               gboolean linear, gboolean interactive,
-                              gboolean dialog, gboolean done, gboolean cancel);
+                              gboolean showbar, gboolean dialog,
+                              gboolean done, gboolean cancel);
 struct _ObClient* focus_directional_cycle(ObDirection dir,
                                           gboolean dock_windows,
                                           gboolean desktop_windows,
                                           gboolean interactive,
+                                          gboolean showbar,
                                           gboolean dialog,
                                           gboolean done, gboolean cancel);
 
index 790713145d09a540e5c4f9a94b40e2593f06dd25..5a6a1029efc1a0d1c44d6cf236709aa4930f694b 100644 (file)
@@ -39,6 +39,7 @@ struct
 
 static RrAppearance *a_focus_indicator;
 static RrColor      *color_white;
+static gboolean      visible;
 
 static Window create_window(Window parent, gulong mask,
                             XSetWindowAttributes *attrib)
@@ -53,6 +54,8 @@ void focus_cycle_indicator_startup(gboolean reconfig)
 {
     XSetWindowAttributes attr;
 
+    visible = FALSE;
+
     if (reconfig) return;
 
     focus_indicator.top.obwin.type = Window_Internal;
@@ -118,7 +121,7 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
 
 void focus_cycle_draw_indicator(ObClient *c)
 {
-    if (!c) {
+    if (!c && visible) {
         gulong ignore_start;
 
         /* kill enter events cause by this unmapping */
@@ -130,7 +133,10 @@ void focus_cycle_draw_indicator(ObClient *c)
         XUnmapWindow(ob_display, focus_indicator.bottom.win);
 
         event_end_ignore_all_enters(ignore_start);
-    } else {
+
+        visible = FALSE;
+    }
+    else if (c) {
         /*
           if (c)
               frame_adjust_focus(c->frame, FALSE);
@@ -249,5 +255,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         XMapWindow(ob_display, focus_indicator.left.win);
         XMapWindow(ob_display, focus_indicator.right.win);
         XMapWindow(ob_display, focus_indicator.bottom.win);
+
+        visible = TRUE;
     }
 }
This page took 0.040145 seconds and 4 git commands to generate.