make interactive actions a type and not special cases.
authorDana Jansens <danakj@orodu.net>
Sat, 30 Aug 2003 16:58:30 +0000 (16:58 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 30 Aug 2003 16:58:30 +0000 (16:58 +0000)
add the <interactive> option to them to turn off interactivity

12 files changed:
data/rc3
openbox/action.c
openbox/action.h
openbox/client_list_menu.c
openbox/config.c
openbox/config.h
openbox/focus.c
openbox/focus.h
openbox/keyboard.c
openbox/mouse.c
openbox/screen.c
openbox/screen.h

index 6d9427d..1b553fa 100644 (file)
--- a/data/rc3
+++ b/data/rc3
@@ -19,7 +19,6 @@
   <followMouse>no</followMouse>
   <focusLast>yes</focusLast>
   <focusLastOnDesktop>yes</focusLastOnDesktop>
-  <cyclingDialog>yes</cyclingDialog>
 </focus>
 
 <theme>
@@ -35,7 +34,6 @@
     <name>three</name>
     <name>four</name>
   </names>
-  <cyclingDialog>yes</cyclingDialog>
 </desktops>
 
 <resize>
       <action name="showmenu"><menu>client-menu</menu></action>
     </mousebind>
     <mousebind button="A-Up" action="click">
-      <action name="desktopright"/>
+      <action name="desktopnext"/>
     </mousebind>
     <mousebind button="A-Down" action="click">
-      <action name="desktopleft"/>
+      <action name="desktopprevious"/>
     </mousebind>
     <mousebind button="C-A-Up" action="click">
-      <action name="sendtodesktopright"/>
+      <action name="sendtodesktopnext"/>
     </mousebind>
     <mousebind button="C-A-Down" action="click">
-      <action name="sendtodesktopleft"/>
+      <action name="sendtodesktopprevious"/>
     </mousebind>
   </context>
   <context name="titlebar">
     </mousebind>
   </context>
   <context name="desktop">
+    <mousebind button="Up" action="click">
+      <action name="desktopnext"><interactive>no</interactive></action>
+    </mousebind>
+    <mousebind button="Down" action="click">
+      <action name="desktopprevious"><interactive>no</interactive></action>
+    </mousebind>
     <mousebind button="A-Up" action="click">
-      <action name="desktopright"/>
+      <action name="desktopnext"/>
     </mousebind>
     <mousebind button="A-Down" action="click">
-      <action name="desktopleft"/>
+      <action name="desktopprevious"/>
     </mousebind>
     <mousebind button="Middle" action="press">
       <action name="showmenu"><menu>client-list-menu</menu></action>
index 7379c0e..0d5e6e6 100644 (file)
@@ -86,6 +86,7 @@ void setup_action_send_to_desktop(ObAction *a)
 
 void setup_action_send_to_desktop_prev(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_WEST;
     a->data.sendtodir.linear = TRUE;
     a->data.sendtodir.wrap = TRUE;
@@ -94,6 +95,7 @@ void setup_action_send_to_desktop_prev(ObAction *a)
 
 void setup_action_send_to_desktop_next(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_EAST;
     a->data.sendtodir.linear = TRUE;
     a->data.sendtodir.wrap = TRUE;
@@ -102,6 +104,7 @@ void setup_action_send_to_desktop_next(ObAction *a)
 
 void setup_action_send_to_desktop_left(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_WEST;
     a->data.sendtodir.linear = FALSE;
     a->data.sendtodir.wrap = TRUE;
@@ -110,6 +113,7 @@ void setup_action_send_to_desktop_left(ObAction *a)
 
 void setup_action_send_to_desktop_right(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_EAST;
     a->data.sendtodir.linear = FALSE;
     a->data.sendtodir.wrap = TRUE;
@@ -118,6 +122,7 @@ void setup_action_send_to_desktop_right(ObAction *a)
 
 void setup_action_send_to_desktop_up(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_NORTH;
     a->data.sendtodir.linear = FALSE;
     a->data.sendtodir.wrap = TRUE;
@@ -126,6 +131,7 @@ void setup_action_send_to_desktop_up(ObAction *a)
 
 void setup_action_send_to_desktop_down(ObAction *a)
 {
+    a->data.sendtodir.inter.any.interactive = TRUE;
     a->data.sendtodir.dir = OB_DIRECTION_SOUTH;
     a->data.sendtodir.linear = FALSE;
     a->data.sendtodir.wrap = TRUE;
@@ -134,6 +140,7 @@ void setup_action_send_to_desktop_down(ObAction *a)
 
 void setup_action_desktop_prev(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_WEST;
     a->data.desktopdir.linear = TRUE;
     a->data.desktopdir.wrap = TRUE;
@@ -141,6 +148,7 @@ void setup_action_desktop_prev(ObAction *a)
 
 void setup_action_desktop_next(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_EAST;
     a->data.desktopdir.linear = TRUE;
     a->data.desktopdir.wrap = TRUE;
@@ -148,6 +156,7 @@ void setup_action_desktop_next(ObAction *a)
 
 void setup_action_desktop_left(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_WEST;
     a->data.desktopdir.linear = FALSE;
     a->data.desktopdir.wrap = TRUE;
@@ -155,6 +164,7 @@ void setup_action_desktop_left(ObAction *a)
 
 void setup_action_desktop_right(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_EAST;
     a->data.desktopdir.linear = FALSE;
     a->data.desktopdir.wrap = TRUE;
@@ -162,6 +172,7 @@ void setup_action_desktop_right(ObAction *a)
 
 void setup_action_desktop_up(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_NORTH;
     a->data.desktopdir.linear = FALSE;
     a->data.desktopdir.wrap = TRUE;
@@ -169,6 +180,7 @@ void setup_action_desktop_up(ObAction *a)
 
 void setup_action_desktop_down(ObAction *a)
 {
+    a->data.desktopdir.inter.any.interactive = TRUE;
     a->data.desktopdir.dir = OB_DIRECTION_SOUTH;
     a->data.desktopdir.linear = FALSE;
     a->data.desktopdir.wrap = TRUE;
@@ -196,24 +208,28 @@ void setup_action_resize_keyboard(ObAction *a)
 
 void setup_action_cycle_windows_linear_next(ObAction *a)
 {
+    a->data.cycle.inter.any.interactive = TRUE;
     a->data.cycle.linear = TRUE;
     a->data.cycle.forward = TRUE;
 }
 
 void setup_action_cycle_windows_linear_previous(ObAction *a)
 {
+    a->data.cycle.inter.any.interactive = TRUE;
     a->data.cycle.linear = TRUE;
     a->data.cycle.forward = FALSE;
 }
 
 void setup_action_cycle_windows_next(ObAction *a)
 {
+    a->data.cycle.inter.any.interactive = TRUE;
     a->data.cycle.linear = FALSE;
     a->data.cycle.forward = TRUE;
 }
 
 void setup_action_cycle_windows_previous(ObAction *a)
 {
+    a->data.cycle.inter.any.interactive = TRUE;
     a->data.cycle.linear = FALSE;
     a->data.cycle.forward = FALSE;
 }
@@ -721,9 +737,8 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
                 if ((n = parse_find_node("delta", node->xmlChildrenNode)))
                     act->data.relative.delta = parse_int(doc, n);
             } else if (act->func == action_desktop_dir) {
-                if ((n = parse_find_node("wrap", node->xmlChildrenNode))) {
+                if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
                     act->data.desktopdir.wrap = parse_bool(doc, n);
-                }
             } else if (act->func == action_send_to_desktop) {
                 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
                     act->data.sendto.follow = parse_bool(doc, n);
@@ -736,6 +751,11 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
                 if ((n = parse_find_node("here", node->xmlChildrenNode)))
                     act->data.activate.here = parse_bool(doc, n);
             }
+
+            if (act->data.any.interactive) {
+                if ((n = parse_find_node("interactive",node->xmlChildrenNode)))
+                    act->data.any.interactive = parse_bool(doc, n);
+            }
         }
         g_free(actname);
     }
@@ -761,31 +781,31 @@ void action_execute(union ActionData *data)
 
 void action_activate(union ActionData *data)
 {
-    if (data->activate.c)
-        client_activate(data->activate.c, data->activate.here);
+    if (data->activate.any.c)
+        client_activate(data->activate.any.c, data->activate.here);
 }
 
 void action_focus(union ActionData *data)
 {
-    if (data->client.c)
-        client_focus(data->client.c);
+    if (data->client.any.c)
+        client_focus(data->client.any.c);
 }
 
 void action_unfocus (union ActionData *data)
 {
-    if (data->client.c)
-        client_unfocus(data->client.c);
+    if (data->client.any.c)
+        client_unfocus(data->client.any.c);
 }
 
 void action_iconify(union ActionData *data)
 {
-    if (data->client.c)
-        client_iconify(data->client.c, TRUE, TRUE);
+    if (data->client.any.c)
+        client_iconify(data->client.any.c, TRUE, TRUE);
 }
 
 void action_raiselower(union ActionData *data)
 {
-    ObClient *c = data->client.c;
+    ObClient *c = data->client.any.c;
     GList *it;
     gboolean raise = FALSE;
 
@@ -814,77 +834,77 @@ void action_raiselower(union ActionData *data)
 
 void action_raise(union ActionData *data)
 {
-    if (data->client.c)
-        stacking_raise(CLIENT_AS_WINDOW(data->client.c));
+    if (data->client.any.c)
+        stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
 }
 
 void action_unshaderaise(union ActionData *data)
 {
-    if (data->client.c) {
-        if (data->client.c->shaded)
-            client_shade(data->client.c, FALSE);
+    if (data->client.any.c) {
+        if (data->client.any.c->shaded)
+            client_shade(data->client.any.c, FALSE);
         else
-            stacking_raise(CLIENT_AS_WINDOW(data->client.c));
+            stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
     }
 }
 
 void action_shadelower(union ActionData *data)
 {
-    if (data->client.c) {
-        if (data->client.c->shaded)
-            stacking_lower(CLIENT_AS_WINDOW(data->client.c));
+    if (data->client.any.c) {
+        if (data->client.any.c->shaded)
+            stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
         else
-            client_shade(data->client.c, TRUE);
+            client_shade(data->client.any.c, TRUE);
     }
 }
 
 void action_lower(union ActionData *data)
 {
-    if (data->client.c)
-        stacking_lower(CLIENT_AS_WINDOW(data->client.c));
+    if (data->client.any.c)
+        stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
 }
 
 void action_close(union ActionData *data)
 {
-    if (data->client.c)
-        client_close(data->client.c);
+    if (data->client.any.c)
+        client_close(data->client.any.c);
 }
 
 void action_kill(union ActionData *data)
 {
-    if (data->client.c)
-        client_kill(data->client.c);
+    if (data->client.any.c)
+        client_kill(data->client.any.c);
 }
 
 void action_shade(union ActionData *data)
 {
-    if (data->client.c)
-        client_shade(data->client.c, TRUE);
+    if (data->client.any.c)
+        client_shade(data->client.any.c, TRUE);
 }
 
 void action_unshade(union ActionData *data)
 {
-    if (data->client.c)
-        client_shade(data->client.c, FALSE);
+    if (data->client.any.c)
+        client_shade(data->client.any.c, FALSE);
 }
 
 void action_toggle_shade(union ActionData *data)
 {
-    if (data->client.c)
-        client_shade(data->client.c, !data->client.c->shaded);
+    if (data->client.any.c)
+        client_shade(data->client.any.c, !data->client.any.c->shaded);
 }
 
 void action_toggle_omnipresent(union ActionData *data)
 { 
-    if (data->client.c)
-        client_set_desktop(data->client.c,
-                           data->client.c->desktop == DESKTOP_ALL ?
+    if (data->client.any.c)
+        client_set_desktop(data->client.any.c,
+                           data->client.any.c->desktop == DESKTOP_ALL ?
                            screen_desktop : DESKTOP_ALL, FALSE);
 }
 
 void action_move_relative_horz(union ActionData *data)
 {
-    ObClient *c = data->relative.c;
+    ObClient *c = data->relative.any.c;
     if (c)
         client_configure(c, OB_CORNER_TOPLEFT,
                          c->area.x + data->relative.delta, c->area.y,
@@ -893,7 +913,7 @@ void action_move_relative_horz(union ActionData *data)
 
 void action_move_relative_vert(union ActionData *data)
 {
-    ObClient *c = data->relative.c;
+    ObClient *c = data->relative.any.c;
     if (c)
         client_configure(c, OB_CORNER_TOPLEFT,
                          c->area.x, c->area.y + data->relative.delta,
@@ -902,7 +922,7 @@ void action_move_relative_vert(union ActionData *data)
 
 void action_resize_relative_horz(union ActionData *data)
 {
-    ObClient *c = data->relative.c;
+    ObClient *c = data->relative.any.c;
     if (c)
         client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
                          c->area.width +
@@ -912,7 +932,7 @@ void action_resize_relative_horz(union ActionData *data)
 
 void action_resize_relative_vert(union ActionData *data)
 {
-    ObClient *c = data->relative.c;
+    ObClient *c = data->relative.any.c;
     if (c && !c->shaded)
         client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
                          c->area.width, c->area.height +
@@ -922,64 +942,65 @@ void action_resize_relative_vert(union ActionData *data)
 
 void action_maximize_full(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, TRUE, 0, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, TRUE, 0, TRUE);
 }
 
 void action_unmaximize_full(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, FALSE, 0, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, FALSE, 0, TRUE);
 }
 
 void action_toggle_maximize_full(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c,
-                        !(data->client.c->max_horz ||
-                          data->client.c->max_vert),
+    if (data->client.any.c)
+        client_maximize(data->client.any.c,
+                        !(data->client.any.c->max_horz ||
+                          data->client.any.c->max_vert),
                         0, TRUE);
 }
 
 void action_maximize_horz(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, TRUE, 1, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, TRUE, 1, TRUE);
 }
 
 void action_unmaximize_horz(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, FALSE, 1, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, FALSE, 1, TRUE);
 }
 
 void action_toggle_maximize_horz(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, !data->client.c->max_horz, 1, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c,
+                        !data->client.any.c->max_horz, 1, TRUE);
 }
 
 void action_maximize_vert(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, TRUE, 2, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, TRUE, 2, TRUE);
 }
 
 void action_unmaximize_vert(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, FALSE, 2, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, FALSE, 2, TRUE);
 }
 
 void action_toggle_maximize_vert(union ActionData *data)
 {
-    if (data->client.c)
-        client_maximize(data->client.c, !data->client.c->max_vert, 2, TRUE);
+    if (data->client.any.c)
+        client_maximize(data->client.any.c, !data->client.any.c->max_vert, 2, TRUE);
 }
 
 void action_send_to_desktop(union ActionData *data)
 {
-    ObClient *c = data->sendto.c;
+    ObClient *c = data->sendto.any.c;
 
     if (!c || !client_normal(c)) return;
 
@@ -1002,222 +1023,35 @@ void action_desktop_dir(union ActionData *data)
 {
     guint d;
 
-    d = screen_cycle_desktop(data->desktopdir.dir, data->desktopdir.wrap,
+    d = screen_cycle_desktop(data->desktopdir.dir,
+                             data->desktopdir.wrap,
                              data->sendtodir.linear,
-                             data->desktopdir.final, data->desktopdir.cancel);
+                             data->desktopdir.inter.any.interactive,
+                             data->desktopdir.inter.final,
+                             data->desktopdir.inter.cancel);
     screen_set_desktop(d);
 }
 
 void action_send_to_desktop_dir(union ActionData *data)
 {
-    ObClient *c = data->sendtodir.c;
+    ObClient *c = data->sendtodir.inter.any.c;
     guint d;
 
     if (!c || !client_normal(c)) return;
 
     d = screen_cycle_desktop(data->sendtodir.dir, data->sendtodir.wrap,
                              data->sendtodir.linear,
-                             data->sendtodir.final, data->sendtodir.cancel);
+                             data->sendtodir.inter.any.interactive,
+                             data->sendtodir.inter.final,
+                             data->sendtodir.inter.cancel);
     client_set_desktop(c, d, data->sendtodir.follow);
     if (data->sendtodir.follow)
         screen_set_desktop(d);
 }
 
-#if 0
-void action_desktop_right(union ActionData *data)
-{
-    guint r, c, d;
-
-    cur_row_col(&r, &c);
-    ++c;
-    if (c >= screen_desktop_layout.columns) {
-        if (!data->desktopdir.wrap) return;
-        c = 0;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->desktopdir.wrap) return;
-        ++c;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops)
-        screen_cycle_desktop(d, data->desktopdir.final,
-                             data->desktopdir.cancel);
-}
-
-void action_send_to_desktop_right(union ActionData *data)
-{
-    ObClient *cl = data->sendto.c;
-    guint r, c, d;
-
-    if (!cl || !client_normal(cl)) return;
-
-    cur_row_col(&r, &c);
-    ++c;
-    if (c >= screen_desktop_layout.columns) {
-        if (!data->sendtodir.wrap) return;
-        c = 0;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->sendtodir.wrap) return;
-        ++c;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops) {
-        client_set_desktop(cl, d, data->sendtodir.follow);
-        if (data->sendtodir.follow)
-            screen_cycle_desktop(d, data->desktopdir.final,
-                                 data->desktopdir.cancel);
-    }
-}
-
-void action_desktop_left(union ActionData *data)
-{
-    guint r, c, d;
-
-    cur_row_col(&r, &c);
-    --c;
-    if (c >= screen_desktop_layout.columns) {
-        if (!data->desktopdir.wrap) return;
-        c = screen_desktop_layout.columns - 1;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->desktopdir.wrap) return;
-        --c;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops)
-        screen_cycle_desktop(d, data->desktopdir.final,
-                             data->desktopdir.cancel);
-}
-
-void action_send_to_desktop_left(union ActionData *data)
-{
-    ObClient *cl = data->sendto.c;
-    guint r, c, d;
-
-    if (!cl || !client_normal(cl)) return;
-
-    cur_row_col(&r, &c);
-    --c;
-    if (c >= screen_desktop_layout.columns) {
-        if (!data->sendtodir.wrap) return;
-        c = screen_desktop_layout.columns - 1;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->sendtodir.wrap) return;
-        --c;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops) {
-        client_set_desktop(cl, d, data->sendtodir.follow);
-        if (data->sendtodir.follow)
-            screen_cycle_desktop(d, data->desktopdir.final,
-                                 data->desktopdir.cancel);
-    }
-}
-
-void action_desktop_down(union ActionData *data)
-{
-    guint r, c, d;
-
-    cur_row_col(&r, &c);
-    ++r;
-    if (r >= screen_desktop_layout.rows) {
-        if (!data->desktopdir.wrap) return;
-        r = 0;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->desktopdir.wrap) return;
-        ++r;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops)
-        screen_cycle_desktop(d, data->desktopdir.final,
-                             data->desktopdir.cancel);
-}
-
-void action_send_to_desktop_down(union ActionData *data)
-{
-    guint r, c, d;
-
-    if (data->sendtodir.c) {
-        cur_row_col(&r, &c);
-        ++r;
-        if (r >= screen_desktop_layout.rows) {
-            if (!data->sendtodir.wrap) return;
-            r = 0;
-        }
-        d = translate_row_col(r, c);
-        if (d >= screen_num_desktops) {
-            if (!data->sendtodir.wrap) return;
-            ++r;
-        }
-        d = translate_row_col(r, c);
-        if (d < screen_num_desktops) {
-            client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
-            if (data->sendtodir.follow)
-                screen_cycle_desktop(d, data->desktopdir.final,
-                                     data->desktopdir.cancel);
-        }
-    }
-}
-
-void action_desktop_up(union ActionData *data)
-{
-    guint r, c, d;
-
-    cur_row_col(&r, &c);
-    --r;
-    if (r >= screen_desktop_layout.rows) {
-        if (!data->desktopdir.wrap) return;
-        r = screen_desktop_layout.rows - 1;
-    }
-    d = translate_row_col(r, c);
-    if (d >= screen_num_desktops) {
-        if (!data->desktopdir.wrap) return;
-        --r;
-    }
-    d = translate_row_col(r, c);
-    if (d < screen_num_desktops)
-        screen_cycle_desktop(d, data->desktopdir.final,
-                             data->desktopdir.cancel);
-}
-
-void action_send_to_desktop_up(union ActionData *data)
-{
-    guint r, c, d;
-
-    if (data->sendtodir.c) {
-        cur_row_col(&r, &c);
-        --r;
-        if (r >= screen_desktop_layout.rows) {
-            if (!data->sendtodir.wrap) return;
-            r = screen_desktop_layout.rows - 1;
-        }
-        d = translate_row_col(r, c);
-        if (d >= screen_num_desktops) {
-            if (!data->sendtodir.wrap) return;
-            --r;
-        }
-        d = translate_row_col(r, c);
-        if (d < screen_num_desktops) {
-            client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
-            if (data->sendtodir.follow)
-                screen_cycle_desktop(d, data->desktopdir.final,
-                                     data->desktopdir.cancel);
-        }
-    }
-}
-#endif
-
 void action_toggle_decorations(union ActionData *data)
 {
-    ObClient *c = data->client.c;
+    ObClient *c = data->client.any.c;
 
     if (!c) return;
 
@@ -1227,7 +1061,7 @@ void action_toggle_decorations(union ActionData *data)
 
 void action_moveresize(union ActionData *data)
 {
-    ObClient *c = data->moveresize.c;
+    ObClient *c = data->moveresize.any.c;
 
     if (!c || !client_normal(c)) return;
 
@@ -1249,7 +1083,7 @@ void action_showmenu(union ActionData *data)
 {
     if (data->showmenu.name) {
         menu_show(data->showmenu.name, data->showmenu.x, data->showmenu.y,
-                  data->showmenu.c);
+                  data->showmenu.any.c);
     }
 }
 
@@ -1257,17 +1091,18 @@ void action_cycle_windows(union ActionData *data)
 {
     ObClient *c;
     
-    c = focus_cycle(data->cycle.forward, data->cycle.linear, data->cycle.final,
-                    data->cycle.cancel);
+    c = focus_cycle(data->cycle.forward, data->cycle.linear,
+                    data->cycle.inter.any.interactive,
+                    data->cycle.inter.final, data->cycle.inter.cancel);
 }
 
 void action_directional_focus(union ActionData *data)
 {
     ObClient *nf;
 
-    if (!data->diraction.c)
+    if (!data->diraction.any.c)
         return;
-    if ((nf = client_find_directional(data->diraction.c,
+    if ((nf = client_find_directional(data->diraction.any.c,
                                       data->diraction.direction)))
         client_activate(nf, FALSE);
 }
@@ -1275,7 +1110,7 @@ void action_directional_focus(union ActionData *data)
 void action_movetoedge(union ActionData *data)
 {
     int x, y;
-    ObClient *c = data->diraction.c;
+    ObClient *c = data->diraction.any.c;
 
     if (!c)
         return;
@@ -1309,7 +1144,7 @@ void action_movetoedge(union ActionData *data)
 void action_growtoedge(union ActionData *data)
 {
     int x, y, width, height, dest;
-    ObClient *c = data->diraction.c;
+    ObClient *c = data->diraction.any.c;
     Rect *a = screen_area(c->desktop);
 
     if (!c)
@@ -1370,13 +1205,13 @@ void action_growtoedge(union ActionData *data)
 
 void action_send_to_layer(union ActionData *data)
 {
-    if (data->layer.c)
-        client_set_layer(data->layer.c, data->layer.layer);
+    if (data->layer.any.c)
+        client_set_layer(data->layer.any.c, data->layer.layer);
 }
 
 void action_toggle_layer(union ActionData *data)
 {
-    ObClient *c = data->layer.c;
+    ObClient *c = data->layer.any.c;
 
     if (c) {
         if (data->layer.layer < 0)
index bacd4b5..c6a0483 100644 (file)
@@ -13,69 +13,72 @@ typedef struct _ObAction ObAction;
 
 struct AnyAction {
     struct _ObClient *c;
+    gboolean interactive;
+};
+
+struct InteractiveAction {
+    struct AnyAction any;
+    gboolean final;
+    gboolean cancel;
 };
 
 struct DirectionalAction{
-    struct _ObClient *c;
+    struct AnyAction any;
     ObDirection direction;
 };
 
 struct Execute {
-    struct _ObClient *c;
+    struct AnyAction any;
     char *path;
 };
 
 struct ClientAction {
-    struct _ObClient *c;
+    struct AnyAction any;
 };
 
 struct Activate {
-    struct _ObClient *c;
+    struct AnyAction any;
     gboolean here; /* bring it to the current desktop */
 };
 
 struct MoveResizeRelative {
-    struct _ObClient *c;
+    struct AnyAction any;
     int delta;
 };
 
 struct SendToDesktop {
-    struct _ObClient *c;
+    struct AnyAction any;
     guint desk;
     gboolean follow;
 };
 
 struct SendToDesktopDirection {
-    struct _ObClient *c;
+    struct InteractiveAction inter;
     ObDirection dir;
     gboolean wrap;
     gboolean linear;
-    gboolean final;
-    gboolean cancel;
     gboolean follow;
 };
 
 struct Desktop {
-    struct _ObClient *c;
+    struct AnyAction any;
     guint desk;
 };
 
 struct Layer {
-    struct _ObClient *c;
+    struct AnyAction any;
     int layer; /* < 0 = below, 0 = normal, > 0 = above */
 };
 
 struct DesktopDirection {
-    struct _ObClient *c;
+    struct InteractiveAction inter;
     ObDirection dir;
     gboolean wrap;
     gboolean linear;
-    gboolean final;
-    gboolean cancel;
 };
 
 struct MoveResize {
-    struct _ObClient *c;
+    struct AnyAction any;
     int x;
     int y;
     guint32 corner; /* prop_atoms.net_wm_moveresize_* */
@@ -83,22 +86,21 @@ struct MoveResize {
 };
 
 struct ShowMenu {
-    struct _ObClient *c;
+    struct AnyAction any;
     char *name;
     int x;
     int y;
 };
 
 struct CycleWindows {
-    struct _ObClient *c;
+    struct InteractiveAction inter;
     gboolean linear;
     gboolean forward;
-    gboolean final;
-    gboolean cancel;
 };
 
 union ActionData {
     struct AnyAction any;
+    struct InteractiveAction inter;
     struct DirectionalAction diraction;
     struct Execute execute;
     struct ClientAction client;
index c176a98..97c40fe 100644 (file)
@@ -37,7 +37,7 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
             ObClientIcon *icon;
 
             act = action_from_string("activate");
-            act->data.activate.c = c;
+            act->data.activate.any.c = c;
             acts = g_slist_prepend(NULL, act);
             e = menu_add_normal(menu, i,
                                 (c->iconic ? c->icon_title : c->title), acts);
index 54ae4c3..24da306 100644 (file)
@@ -9,8 +9,6 @@ gboolean config_focus_new;
 gboolean config_focus_follow;
 gboolean config_focus_last;
 gboolean config_focus_last_on_desktop;
-gboolean config_focus_popup;
-gboolean config_desktop_popup;
 
 char *config_theme;
 
@@ -216,8 +214,6 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
         config_focus_last = parse_bool(doc, n);
     if ((n = parse_find_node("focusLastOnDesktop", node)))
         config_focus_last_on_desktop = parse_bool(doc, n);
-    if ((n = parse_find_node("cyclingDialog", node)))
-        config_focus_popup = parse_bool(doc, n);
 }
 
 static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -266,8 +262,6 @@ static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             nname = parse_find_node("name", nname->next);
         }
     }
-    if ((n = parse_find_node("cyclingDialog", node)))
-        config_desktop_popup = parse_bool(doc, n);
 }
 
 static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -373,7 +367,6 @@ void config_startup(ObParseInst *i)
     config_focus_follow = FALSE;
     config_focus_last = TRUE;
     config_focus_last_on_desktop = TRUE;
-    config_focus_popup = TRUE;
 
     parse_register(i, "focus", parse_focus, NULL);
 
@@ -385,7 +378,6 @@ void config_startup(ObParseInst *i)
 
     config_desktops_num = 4;
     config_desktops_names = NULL;
-    config_desktop_popup = TRUE;
 
     parse_register(i, "desktops", parse_desktops, NULL);
 
index 777d895..f83976a 100644 (file)
@@ -16,10 +16,6 @@ extern gboolean config_focus_follow;
 extern gboolean config_focus_last;
 /*! Focus the last focused window as a fallback when switching desktops */
 extern gboolean config_focus_last_on_desktop;
-/*! Show a popup dialog while cycling focus */
-extern gboolean config_focus_popup;
-/*! Show a popup dialog while cycling desktops */
-extern gboolean config_desktop_popup;
 /*! The number of slits to create 
   extern int config_slit_number;*/
 /*! When true windows' contents are refreshed while they are resized; otherwise
index dab6d57..a15e1b1 100644 (file)
@@ -80,7 +80,7 @@ void focus_set_client(ObClient *client)
 
     /* in the middle of cycling..? kill it. */
     if (focus_cycle_target)
-        focus_cycle(TRUE, TRUE, TRUE, TRUE);
+        focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE);
 
     old = focus_client;
     focus_client = client;
@@ -257,8 +257,8 @@ static void popup_cycle(ObClient *c, gboolean show)
     }
 }
 
-ObClient *focus_cycle(gboolean forward, gboolean linear, gboolean done,
-                      gboolean cancel)
+ObClient *focus_cycle(gboolean forward, gboolean linear,
+                      gboolean dialog, gboolean done, gboolean cancel)
 {
     static ObClient *first = NULL;
     static ObClient *t = NULL;
@@ -313,7 +313,7 @@ ObClient *focus_cycle(gboolean forward, gboolean linear, gboolean done,
                 focus_cycle_target = ft;
                 frame_adjust_focus(focus_cycle_target->frame, TRUE);
             }
-            popup_cycle(ft, config_focus_popup);
+            popup_cycle(ft, dialog);
             return ft;
         }
     } while (it != start);
index 8c5b1ad..cfaba39 100644 (file)
@@ -31,8 +31,8 @@ void focus_fallback(ObFocusFallbackType type);
 
 /*! Cycle focus amongst windows
   Returns the _ObClient to which focus has been cycled, or NULL if none. */
-struct _ObClient *focus_cycle(gboolean forward, gboolean linear, gboolean done,
-                           gboolean cancel);
+struct _ObClient *focus_cycle(gboolean forward, gboolean linear,
+                              gboolean dialog, gboolean done, gboolean cancel);
 
 /*! Add a new client into the focus order */
 void focus_order_add_new(struct _ObClient *c);
index 86ead52..b517014 100644 (file)
@@ -163,18 +163,10 @@ gboolean keyboard_process_interactive_grab(const XEvent *e,
                 cancel = done = TRUE;
         }
         if (done) {
-            if (s->action->func == action_cycle_windows) {
-                s->action->data.cycle.cancel = cancel;
-                s->action->data.cycle.final = TRUE;
-            }
-            if (s->action->func == action_desktop_dir) {
-                s->action->data.desktopdir.cancel = cancel;
-                s->action->data.desktopdir.final = TRUE;
-            }
-            if (s->action->func == action_send_to_desktop_dir) {
-                s->action->data.sendtodir.cancel = cancel;
-                s->action->data.sendtodir.final = TRUE;
-            }
+            g_assert(s->action->data.any.interactive);
+
+            s->action->data.inter.cancel = cancel;
+            s->action->data.inter.final = TRUE;
 
             s->action->func(&s->action->data);
 
@@ -225,38 +217,19 @@ void keyboard_event(ObClient *client, const XEvent *e)
                     if (act->func != NULL) {
                         act->data.any.c = client;
 
-                        if (act->func == action_cycle_windows)
-                        {
-                            act->data.cycle.final = FALSE;
-                            act->data.cycle.cancel = FALSE;
-                        }
-                        if (act->func == action_desktop_dir)
-                        {
-                            act->data.desktopdir.final = FALSE;
-                            act->data.desktopdir.cancel = FALSE;
-                        }
-                        if (act->func == action_send_to_desktop_dir)
-                        {
-                            act->data.sendtodir.final = FALSE;
-                            act->data.sendtodir.cancel = FALSE;
-                        }
-
-                        if (act->func == action_moveresize)
-                        {
+                        if (act->func == action_moveresize) {
                             screen_pointer_pos(&act->data.moveresize.x,
                                                &act->data.moveresize.y);
                         }
 
-                        if ((act->func == action_cycle_windows ||
-                             act->func == action_desktop_dir ||
-                             act->func == action_send_to_desktop_dir))
-                        {
+                        if (act->data.any.interactive) {
+                            act->data.inter.cancel = FALSE;
+                            act->data.inter.final = FALSE;
                             keyboard_interactive_grab(e->xkey.state, client,
                                                       0, act);
                         }
 
-                        if (act->func == action_showmenu)
-                        {
+                        if (act->func == action_showmenu) {
                             act->data.showmenu.x = e->xkey.x_root;
                             act->data.showmenu.y = e->xkey.y_root;
                         }
index 2e8507c..15d77ae 100644 (file)
@@ -115,21 +115,9 @@ static gboolean fire_button(ObMouseAction a, ObFrameContext context,
                 act->data.showmenu.y = y;
             }
 
-            if (act->func == action_desktop_dir)
-            {
-                act->data.desktopdir.final = FALSE;
-                act->data.desktopdir.cancel = FALSE;
-            }
-            if (act->func == action_send_to_desktop_dir)
-            {
-                act->data.sendtodir.final = FALSE;
-                act->data.sendtodir.cancel = FALSE;
-            }
-
-            if (config_desktop_popup &&
-                (act->func == action_desktop_dir ||
-                 act->func == action_send_to_desktop_dir))
-            {
+            if (act->data.any.interactive) {
+                act->data.inter.cancel = FALSE;
+                act->data.inter.final = FALSE;
                 keyboard_interactive_grab(state, c, context, act);
             }
 
index 7913770..a9efcd0 100644 (file)
@@ -584,7 +584,7 @@ static void popup_cycle(guint d, gboolean show)
 }
 
 guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
-                           gboolean done, gboolean cancel)
+                           gboolean dialog, gboolean done, gboolean cancel)
 {
     static gboolean first = TRUE;
     static gboolean lin;
@@ -682,7 +682,7 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
         d = translate_row_col(r, c);
     }
 
-    if (config_desktop_popup) {
+    if (dialog) {
         popup_cycle(d, TRUE);
         return d;
     }
index 696423e..bd47496 100644 (file)
@@ -47,7 +47,7 @@ void screen_set_num_desktops(guint num);
 void screen_set_desktop(guint num);
 /*! Interactively change desktops */
 guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
-                           gboolean done, gboolean cancel);
+                           gboolean dialog, gboolean done, gboolean cancel);
 
 /*! Shows and focuses the desktop and hides all the client windows, or
   returns to the normal state, showing client windows. */