]> Dogcows Code - chaz/openbox/commitdiff
add the cyclewindows action
authorDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 04:37:33 +0000 (04:37 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 22 Jun 2007 04:37:33 +0000 (04:37 +0000)
20 files changed:
Makefile.am
openbox/action.c
openbox/actions.c
openbox/actions.h
openbox/actions/all.c
openbox/actions/all.h
openbox/actions/execute.c
openbox/client_list_combined_menu.c
openbox/client_list_menu.c
openbox/client_menu.c
openbox/event.c
openbox/focus_cycle.c
openbox/focus_cycle.h
openbox/keyboard.c
openbox/menu.h
openbox/menuframe.c
openbox/menuframe.h
openbox/mouse.c
openbox/startupnotify.c
openbox/startupnotify.h

index 6d58e90ce36f310cb7364c3ddcddc02752854b58..70b6fc7cfef0ecfa9f36673d0f1ed0788172501e 100644 (file)
@@ -156,6 +156,7 @@ openbox_openbox_SOURCES = \
        gettext.h \
        openbox/actions/all.c \
        openbox/actions/all.h \
+       openbox/actions/cyclewindows.c \
        openbox/actions/debug.c \
        openbox/actions/execute.c \
        openbox/actions/exit.c \
index 0c241b46586ee117c0768d7a226f0e13adf82b3d..7f0cca15c3ab9215a15fa5e4e361a874c03338f3 100644 (file)
@@ -318,28 +318,6 @@ void setup_action_desktop_down(ObAction **a, ObUserAction uact)
     (*a)->data.desktopdir.wrap = TRUE;
 }
 
-void setup_action_cycle_windows_next(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.cycle.inter.any.interactive = TRUE;
-    (*a)->data.cycle.linear = FALSE;
-    (*a)->data.cycle.forward = TRUE;
-    (*a)->data.cycle.dialog = TRUE;
-    (*a)->data.cycle.dock_windows = FALSE;
-    (*a)->data.cycle.desktop_windows = FALSE;
-    (*a)->data.cycle.all_desktops = FALSE;
-}
-
-void setup_action_cycle_windows_previous(ObAction **a, ObUserAction uact)
-{
-    (*a)->data.cycle.inter.any.interactive = TRUE;
-    (*a)->data.cycle.linear = FALSE;
-    (*a)->data.cycle.forward = FALSE;
-    (*a)->data.cycle.dialog = TRUE;
-    (*a)->data.cycle.dock_windows = FALSE;
-    (*a)->data.cycle.desktop_windows = FALSE;
-    (*a)->data.cycle.all_desktops = FALSE;
-}
-
 void setup_action_movefromedge_north(ObAction **a, ObUserAction uact)
 {
     (*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
@@ -805,16 +783,6 @@ ActionString actionstrings[] =
         action_toggle_layer,
         setup_action_bottom_layer
     },
-    {
-        "nextwindow",
-        action_cycle_windows,
-        setup_action_cycle_windows_next
-    },
-    {
-        "previouswindow",
-        action_cycle_windows,
-        setup_action_cycle_windows_previous
-    },
     {
         "movefromedgenorth",
         action_movetoedge,
@@ -1000,18 +968,6 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             } else if (act->func == action_activate) {
                 if ((n = parse_find_node("here", node->xmlChildrenNode)))
                     act->data.activate.here = parse_bool(doc, n);
-            } else if (act->func == action_cycle_windows) {
-                if ((n = parse_find_node("linear", node->xmlChildrenNode)))
-                    act->data.cycle.linear = parse_bool(doc, n);
-                if ((n = parse_find_node("dialog", node->xmlChildrenNode)))
-                    act->data.cycle.dialog = parse_bool(doc, n);
-                if ((n = parse_find_node("panels", node->xmlChildrenNode)))
-                    act->data.cycle.dock_windows = parse_bool(doc, n);
-                if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
-                    act->data.cycle.desktop_windows = parse_bool(doc, n);
-                if ((n = parse_find_node("allDesktops",
-                                         node->xmlChildrenNode)))
-                    act->data.cycle.all_desktops = parse_bool(doc, n);
             } else if (act->func == action_directional_focus) {
                 if ((n = parse_find_node("dialog", node->xmlChildrenNode)))
                     act->data.interdiraction.dialog = parse_bool(doc, n);
@@ -1691,21 +1647,6 @@ void action_resize(union ActionData *data)
     moveresize_start(c, data->any.x, data->any.y, data->any.button, corner);
 }
 
-void action_cycle_windows(union ActionData *data)
-{
-    /* if using focus_delay, stop the timer now so that focus doesn't go moving
-       on us */
-    event_halt_focus_delay();
-
-    focus_cycle(data->cycle.forward,
-                data->cycle.all_desktops,
-                data->cycle.dock_windows,
-                data->cycle.desktop_windows,
-                data->cycle.linear, data->any.interactive,
-                data->cycle.dialog,
-                data->cycle.inter.final, data->cycle.inter.cancel);
-}
-
 void action_directional_focus(union ActionData *data)
 {
     /* if using focus_delay, stop the timer now so that focus doesn't go moving
index 9a5d193c4a2b33200416867eff81d769c0d224e2..b56d834a4f4efacd557c1d15289bcab985fff85b 100644 (file)
@@ -190,7 +190,6 @@ void actions_act_unref(ObActionsAct *act)
 
 static void actions_setup_data(ObActionsData *data,
                                ObUserAction uact,
-                               Time time,
                                guint state,
                                gint x,
                                gint y,
@@ -198,7 +197,6 @@ static void actions_setup_data(ObActionsData *data,
                                struct _ObClient *client)
 {
     data->uact = uact;
-    data->time = time;
     data->state = state;
     data->x = x;
     data->y = y;
@@ -208,7 +206,6 @@ static void actions_setup_data(ObActionsData *data,
 
 void actions_run_acts(GSList *acts,
                       ObUserAction uact,
-                      Time time,
                       guint state,
                       gint x,
                       gint y,
@@ -230,7 +227,7 @@ void actions_run_acts(GSList *acts,
         ObActionsAct *act = it->data;
         gboolean ok = TRUE;
 
-        actions_setup_data(&data, uact, time, state, x, y, con, client);
+        actions_setup_data(&data, uact, state, x, y, con, client);
 
         if (actions_act_is_interactive(act) &&
             (!interactive_act || interactive_act->def != act->def))
index 3db6d7927e0cb33304308c48c1740b8f5ef768d7..8e3154b89cd7f98555d352992495591dfbe30751 100644 (file)
@@ -43,7 +43,6 @@ typedef void     (*ObActionsInteractiveCancelFunc)(gpointer options);
 
 struct _ObActionsData {
     ObUserAction uact;
-    Time time;
     guint state;
     gint x;
     gint y;
@@ -79,7 +78,6 @@ void actions_act_unref(ObActionsAct *act);
 */
 void actions_run_acts(GSList *acts,
                       ObUserAction uact,
-                      Time time,
                       guint state,
                       gint x,
                       gint y,
index 141fd12e5401998a1c7d19909dfa7be5b03ac724..d60693b4d08ee70b05ebf5d33bbbb2628cea2d67 100644 (file)
@@ -9,4 +9,5 @@ void action_all_startup()
     action_reconfigure_startup();
     action_exit_startup();
     action_restart_startup();
+    action_cyclewindows_startup();
 }
index 789cce379b890c44e21e6e3d7767f0644c2db17c..c3ab3a87e27c3b5c2c7045105ab24bb59d93590f 100644 (file)
@@ -10,5 +10,6 @@ void action_showdesktop_startup();
 void action_reconfigure_startup();
 void action_exit_startup();
 void action_restart_startup();
+void action_cyclewindows_startup();
 
 #endif
index 606bb15326dd4836fda8ce14dda1ce272d190e2f..8d45aad60506f9687aaf578acc387235a4664a29 100644 (file)
@@ -103,8 +103,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
             /* sets up the environment */
             sn_setup_spawn_environment(program, o->sn_name, o->sn_icon,
                                        /* launch it on the current desktop */
-                                       screen_desktop,
-                                       data->time);
+                                       screen_desktop);
         }
 
         if (!g_spawn_async(NULL, argv, NULL,
index af2819bb3023b6a1cf2f18dec43165bd85279733..60d6e687e46e58266ac2e696623f35a2dc54b67d 100644 (file)
@@ -94,8 +94,7 @@ static gboolean self_update(ObMenuFrame *frame, gpointer data)
 }
 
 static void menu_execute(ObMenuEntry *self, ObMenuFrame *f,
-                         ObClient *c, guint state, gpointer data,
-                         Time time)
+                         ObClient *c, guint state, gpointer data)
 {
     if (self->id == -1) {
         if (self->data.normal.data) /* it's set to NULL if its destroyed */
index 936c31255860bf77c1e871fced4ff268dadac77d..512cb3e8dd63cb164c4499a2a207ba8d7cf544cb 100644 (file)
@@ -94,8 +94,7 @@ static gboolean desk_menu_update(ObMenuFrame *frame, gpointer data)
 }
 
 static void desk_menu_execute(ObMenuEntry *self, ObMenuFrame *f,
-                              ObClient *c, guint state, gpointer data,
-                              Time time)
+                              ObClient *c, guint state, gpointer data)
 {
     if (self->id == -1) {
         if (self->data.normal.data) /* it's set to NULL if its destroyed */
index 8e29bd7e5a18572ad9a389ae2fcca39e6150c4a0..e92a772cc827f7465f4e7b961b86d18d246b1526 100644 (file)
@@ -103,8 +103,7 @@ static gboolean client_menu_update(ObMenuFrame *frame, gpointer data)
 }
 
 static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
-                                ObClient *c, guint state, gpointer data,
-                                Time time)
+                                ObClient *c, guint state, gpointer data)
 {
     gint x, y;
     gulong ignore_start;
@@ -202,8 +201,7 @@ static gboolean layer_menu_update(ObMenuFrame *frame, gpointer data)
 }
 
 static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
-                               ObClient *c, guint state, gpointer data,
-                               Time time)
+                               ObClient *c, guint state, gpointer data)
 {
     gulong ignore_start;
 
@@ -281,8 +279,7 @@ static gboolean send_to_menu_update(ObMenuFrame *frame, gpointer data)
 }
 
 static void send_to_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
-                                 ObClient *c, guint state, gpointer data,
-                                 Time time)
+                                 ObClient *c, guint state, gpointer data)
 {
     g_assert(c);
 
index 2a12d990781bd6fef6e8b35c12e663b438452cb5..cd66014b89a271a8bbb2dc1ff089618b56415fc0 100644 (file)
@@ -1630,7 +1630,7 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
         if (frame->child)
             menu_frame_select_next(frame->child);
         else if (frame->selected)
-            menu_entry_frame_execute(frame->selected, state, ev->xkey.time);
+            menu_entry_frame_execute(frame->selected, state);
     }
 
     else if (keycode == ob_keycode(OB_KEY_LEFT) && ev->xkey.state == 0) {
@@ -1700,7 +1700,7 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
                 menu_frame_select(frame, found, TRUE);
                 usleep(50000); /* highlight the item for a short bit so the
                                   user can see what happened */
-                menu_entry_frame_execute(found, state, ev->xkey.time);
+                menu_entry_frame_execute(found, state);
             } else {
                 menu_frame_select(frame, found, TRUE);
                 if (num_found == 1)
@@ -1730,8 +1730,7 @@ static gboolean event_handle_menu(XEvent *ev)
                                             ev->xbutton.y_root)))
             {
                 menu_frame_select(e->frame, e, TRUE);
-                menu_entry_frame_execute(e, ev->xbutton.state,
-                                         ev->xbutton.time);
+                menu_entry_frame_execute(e, ev->xbutton.state);
             }
             else
                 menu_frame_hide_all();
index a5ac4e68ce4d84f55c35cb8512fc863aca9fc677..971f116fdda1f99986b7489d85efa1a54b0014ae 100644 (file)
@@ -67,15 +67,16 @@ void focus_cycle_stop(ObClient *ifclient)
     }
 }
 
-void focus_cycle(gboolean forward, gboolean all_desktops,
-                 gboolean dock_windows, gboolean desktop_windows,
-                 gboolean linear, gboolean interactive,
-                 gboolean dialog, gboolean done, gboolean cancel)
+ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
+                      gboolean dock_windows, gboolean desktop_windows,
+                      gboolean linear, gboolean interactive,
+                      gboolean dialog, gboolean done, gboolean cancel)
 {
     static ObClient *t = NULL;
     static GList *order = NULL;
     GList *it, *start, *list;
     ObClient *ft = NULL;
+    ObClient *ret = NULL;
 
     if (interactive) {
         if (cancel) {
@@ -146,8 +147,7 @@ void focus_cycle(gboolean forward, gboolean all_desktops,
     } while (it != start);
 
 done_cycle:
-    if (done && focus_cycle_target)
-        client_activate(focus_cycle_target, FALSE, TRUE);
+    if (done && !cancel) ret = focus_cycle_target;
 
     t = NULL;
     focus_cycle_target = NULL;
@@ -159,7 +159,7 @@ done_cycle:
         focus_cycle_popup_hide();
     }
 
-    return;
+    return ret;
 }
 
 /* this be mostly ripped from fvwm */
index 2e32805f1948bef39a109a807c519471eb0a051a..3fecc9e42acd04258a56e085106e2703e8f84698 100644 (file)
@@ -34,10 +34,10 @@ void focus_cycle_startup(gboolean reconfig);
 void focus_cycle_shutdown(gboolean reconfig);
 
 /*! Cycle focus amongst windows. */
-void focus_cycle(gboolean forward, gboolean all_desktops,
-                 gboolean dock_windows, gboolean desktop_windows,
-                 gboolean linear, gboolean interactive,
-                 gboolean dialog, gboolean done, gboolean cancel);
+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);
 void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
                              gboolean desktop_windows, gboolean interactive,
                              gboolean dialog, gboolean done, gboolean cancel);
index ac92f5f93ddc9290fc1a86ed92b76e224f54213a..b12ad53d4c1e8bdaab877115eeb387a4f58bf08b 100644 (file)
@@ -255,8 +255,7 @@ void keyboard_event(ObClient *client, const XEvent *e)
                     keyboard_reset_chains(0);
 
                 actions_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY,
-                                 e->xkey.time, e->xkey.state,
-                                 e->xkey.x_root, e->xkey.y_root,
+                                 e->xkey.state, e->xkey.x_root, e->xkey.y_root,
                                  OB_FRAME_CONTEXT_NONE, client);
             }
             break;
index f0fc42baa49d6a18b1e6e61e8b10eaa7e1661ec6..f4368229ba9964cdb313292acae3ab2590fe3218 100644 (file)
@@ -44,7 +44,7 @@ typedef gboolean (*ObMenuUpdateFunc)(struct _ObMenuFrame *frame,
 typedef void (*ObMenuExecuteFunc)(struct _ObMenuEntry *entry,
                                   struct _ObMenuFrame *frame,
                                   struct _ObClient *client,
-                                  guint state, gpointer data, Time time);
+                                  guint state, gpointer data);
 typedef void (*ObMenuDestroyFunc)(struct _ObMenu *menu, gpointer data);
 /*! @param x is the mouse x coordinate. on return it should be the x coordinate
              for the menu
index 4cdf6a37a46f9419b4fbdc29910d1841a474c97f..6a25a9aece93d8daa1bbc627f3e6257bfcfaee20 100644 (file)
@@ -1179,7 +1179,7 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self)
     menu_frame_show_submenu(f, self->frame, self);
 }
 
-void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state, Time time)
+void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)
 {
     if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
         self->entry->data.normal.enabled)
@@ -1200,11 +1200,10 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state, Time time)
         }
 
         if (func)
-            func(entry, frame, client, state, data, time);
+            func(entry, frame, client, state, data);
         else
             actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION,
-                             time, state, -1, -1, OB_FRAME_CONTEXT_NONE,
-                             client);
+                             state, -1, -1, OB_FRAME_CONTEXT_NONE, client);
     }
 }
 
index 75e03da451ad73fd57351b04309370679095fde3..191bcfe8f4c5d68eb1397d7db94e56d40988199b 100644 (file)
@@ -141,6 +141,6 @@ ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
 
 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
 
-void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state, Time time);
+void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
 
 #endif
index d8813162627de27dfca2b0586d2c98ca3fd2e141..493e1000c1eb546674053154896504cfae599935 100644 (file)
@@ -182,7 +182,7 @@ static ObUserAction mouse_action_to_user_action(ObMouseAction a)
 
 static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
                              ObClient *c, guint state,
-                             guint button, gint x, gint y, Time time)
+                             guint button, gint x, gint y)
 {
     GSList *it;
     ObMouseBinding *b;
@@ -196,7 +196,7 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context,
     if (it == NULL) return FALSE;
 
     actions_run_acts(b->actions[a], mouse_action_to_user_action(a),
-                     time, state, x, y, context, c);
+                     state, x, y, context, c);
     return TRUE;
 }
 
@@ -228,8 +228,7 @@ void mouse_event(ObClient *client, XEvent *e)
         fire_binding(OB_MOUSE_ACTION_PRESS, context,
                      client, e->xbutton.state,
                      e->xbutton.button,
-                     e->xbutton.x_root, e->xbutton.y_root,
-                     e->xbutton.time);
+                     e->xbutton.x_root, e->xbutton.y_root);
 
         /* if the bindings grab the pointer, there won't be a ButtonRelease
            event for us */
@@ -293,22 +292,19 @@ void mouse_event(ObClient *client, XEvent *e)
                      client, e->xbutton.state,
                      e->xbutton.button,
                      e->xbutton.x_root,
-                     e->xbutton.y_root,
-                     e->xbutton.time);
+                     e->xbutton.y_root);
         if (click)
             fire_binding(OB_MOUSE_ACTION_CLICK, context,
                          client, e->xbutton.state,
                          e->xbutton.button,
                          e->xbutton.x_root,
-                         e->xbutton.y_root,
-                         e->xbutton.time);
+                         e->xbutton.y_root);
         if (dclick)
             fire_binding(OB_MOUSE_ACTION_DOUBLE_CLICK, context,
                          client, e->xbutton.state,
                          e->xbutton.button,
                          e->xbutton.x_root,
-                         e->xbutton.y_root,
-                         e->xbutton.time);
+                         e->xbutton.y_root);
         break;
 
     case MotionNotify:
@@ -329,7 +325,7 @@ void mouse_event(ObClient *client, XEvent *e)
                     break;
 
                 fire_binding(OB_MOUSE_ACTION_MOTION, context,
-                             client, state, button, px, py, e->xmotion.time);
+                             client, state, button, px, py);
                 button = 0;
                 state = 0;
             }
index 83e8c75b0f34723652fe35044b8dbcedba2b2df4..f1b067c7a36b4e84515c06a8bfd2c5982817f356 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "startupnotify.h"
 #include "gettext.h"
+#include "event.h"
 
 #include <stdlib.h>
 
@@ -228,8 +229,7 @@ static gboolean sn_launch_wait_timeout(gpointer data)
 }
 
 void sn_setup_spawn_environment(gchar *program, gchar *name,
-                                gchar *icon_name, gint desktop,
-                                Time time)
+                                gchar *icon_name, gint desktop)
 {
     gchar *desc;
     const char *id;
@@ -247,7 +247,8 @@ void sn_setup_spawn_environment(gchar *program, gchar *name,
     sn_launcher_context_set_binary_name(sn_launcher, program);
     if (desktop >= 0 && (unsigned) desktop < screen_num_desktops)
         sn_launcher_context_set_workspace(sn_launcher, (signed) desktop);
-    sn_launcher_context_initiate(sn_launcher, "openbox", program, time);
+    sn_launcher_context_initiate(sn_launcher, "openbox", program,
+                                 event_curtime);
     id = sn_launcher_context_get_startup_id(sn_launcher);
 
     /* 20 second timeout for apps to start */
index 82b87a58c11c02549aadeeebbb9c55638b6445db..7c28faba10b478749a7da6983004c38e8c76f151 100644 (file)
@@ -36,8 +36,7 @@ gboolean sn_get_desktop(gchar *id, guint *desktop);
 
 /* Get the environment to run the program in, with startup notification */
 void sn_setup_spawn_environment(gchar *program, gchar *name,
-                                gchar *icon_name, gint desktop,
-                                Time time);
+                                gchar *icon_name, gint desktop);
 
 /* Tell startup notification we're not actually running the program we
    told it we were
This page took 0.045479 seconds and 4 git commands to generate.