summaryrefslogtreecommitdiff
path: root/openbox/actions.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-06-21 23:57:35 +0000
committerDana Jansens <danakj@orodu.net>2007-06-21 23:57:35 +0000
commit314c0566371d83305d723c883884555a24cc0ad8 (patch)
tree8e68c95d5089922e480f2dda07523b0d9a0e7f52 /openbox/actions.c
parent828d06f271392abbef75bb37e2635b2085bdef90 (diff)
make mouse use the new action stuff
Diffstat (limited to 'openbox/actions.c')
-rw-r--r--openbox/actions.c61
1 files changed, 57 insertions, 4 deletions
diff --git a/openbox/actions.c b/openbox/actions.c
index 8d523dc8..dff78f50 100644
--- a/openbox/actions.c
+++ b/openbox/actions.c
@@ -26,7 +26,7 @@ struct _ObActionsDefinition {
guint ref;
gchar *name;
- gboolean allow_interactive;
+ ObActionsType type;
ObActionsDataSetupFunc setup;
ObActionsDataFreeFunc free;
@@ -37,7 +37,6 @@ struct _ObActionsAct {
guint ref;
ObActionsDefinition *def;
-
gpointer options;
};
@@ -63,7 +62,7 @@ void actions_shutdown(gboolean reconfig)
}
gboolean actions_register(const gchar *name,
- gboolean allow_interactive,
+ ObActionsType type,
ObActionsDataSetupFunc setup,
ObActionsDataFreeFunc free,
ObActionsRunFunc run)
@@ -80,7 +79,7 @@ gboolean actions_register(const gchar *name,
def = g_new(ObActionsDefinition, 1);
def->ref = 1;
def->name = g_strdup(name);
- def->allow_interactive = allow_interactive;
+ def->type = type;
def->setup = setup;
def->free = free;
def->run = run;
@@ -161,3 +160,57 @@ void actions_act_unref(ObActionsAct *act)
g_free(act);
}
}
+
+static void actions_setup_data(ObActionsData *data,
+ ObUserAction uact,
+ Time time,
+ guint state,
+ guint button,
+ gint x,
+ gint y)
+{
+ data->any.uact = uact;
+ data->any.time = time;
+ data->any.state = state;
+ data->any.button = button;
+ data->any.x = x;
+ data->any.y = y;
+}
+
+void actions_run_acts(GSList *acts,
+ ObUserAction uact,
+ Time time,
+ guint state,
+ guint button,
+ gint x,
+ gint y,
+ ObFrameContext con,
+ struct _ObClient *client,
+ ObActionsInteractiveState interactive)
+{
+ GSList *it;
+
+ for (it = acts; it; it = g_slist_next(it)) {
+ ObActionsData data;
+ ObActionsAct *act = it->data;
+
+ data.type = act->def->type;
+ actions_setup_data(&data, uact, time, state, button, x, y);
+ switch (data.type) {
+ case OB_ACTION_TYPE_GLOBAL:
+ break;
+ case OB_ACTION_TYPE_CLIENT:
+ data.client.context = con;
+ data.client.c = client;
+ break;
+ case OB_ACTION_TYPE_SELECTOR:
+ data.selector.interactive = interactive;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ /* fire the action's run function with this data */
+ act->def->run(&data, act->options);
+ }
+}