From fcb9ff37877be673791c9e4d8910f46842c0207f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 28 Jul 2011 14:43:55 -0400 Subject: [PATCH] Rename ObActions* to ObAction* and remove more 3.4-compat action stuff that was missed. --- Makefile.am | 17 +- openbox/{actions.c => action.c} | 198 +++++------ openbox/action.h | 115 +++++++ openbox/{actions_list.c => action_list.c} | 36 +- openbox/action_list.h | 55 ++++ openbox/{actions_parser.c => action_parser.c} | 127 ++++--- openbox/{actions_parser.h => action_parser.h} | 22 +- openbox/{actions_value.c => action_value.c} | 58 ++-- openbox/{actions_value.h => action_value.h} | 32 +- openbox/actions.h | 115 ------- openbox/actions/addremovedesktop.c | 38 +-- openbox/actions/all.c | 4 +- openbox/actions/all.h | 4 +- openbox/actions/breakchroot.c | 12 +- openbox/actions/close.c | 10 +- openbox/actions/cyclewindows.c | 120 +++---- openbox/actions/debug.c | 16 +- openbox/actions/decorations.c | 32 +- openbox/actions/desktop.c | 72 ++-- openbox/actions/directionalwindows.c | 311 +++--------------- openbox/actions/dock.c | 26 +- openbox/actions/dockautohide.c | 10 +- openbox/actions/execute.c | 46 +-- openbox/actions/exit.c | 17 +- openbox/actions/focus.c | 28 +- openbox/actions/focustobottom.c | 8 +- openbox/actions/fullscreen.c | 12 +- openbox/actions/growtoedge.c | 69 +--- openbox/actions/iconify.c | 14 +- openbox/actions/kill.c | 10 +- openbox/actions/layer.c | 67 +--- openbox/actions/lower.c | 14 +- openbox/actions/maximize.c | 40 +-- openbox/actions/move.c | 10 +- openbox/actions/moverelative.c | 24 +- openbox/actions/moveresizeto.c | 62 ++-- openbox/actions/movetoedge.c | 60 +--- openbox/actions/omnipresent.c | 12 +- openbox/actions/raise.c | 12 +- openbox/actions/raiselower.c | 12 +- openbox/actions/reconfigure.c | 8 +- openbox/actions/resize.c | 16 +- openbox/actions/resizerelative.c | 32 +- openbox/actions/restart.c | 16 +- openbox/actions/shade.c | 32 +- openbox/actions/shadelowerraise.c | 40 --- openbox/actions/showdesktop.c | 8 +- openbox/actions/showmenu.c | 16 +- openbox/actions/unfocus.c | 8 +- openbox/actions_list.h | 55 ---- openbox/config.c | 52 +-- openbox/event.c | 8 +- openbox/keyboard.c | 18 +- openbox/keyboard.h | 4 +- openbox/keytree.c | 6 +- openbox/keytree.h | 4 +- openbox/menu.c | 26 +- openbox/menu.h | 6 +- openbox/menuframe.c | 10 +- openbox/mouse.c | 20 +- openbox/mouse.h | 4 +- openbox/openbox.c | 6 +- 62 files changed, 954 insertions(+), 1388 deletions(-) rename openbox/{actions.c => action.c} (65%) create mode 100644 openbox/action.h rename openbox/{actions_list.c => action_list.c} (57%) create mode 100644 openbox/action_list.h rename openbox/{actions_parser.c => action_parser.c} (78%) rename openbox/{actions_parser.h => action_parser.h} (54%) rename openbox/{actions_value.c => action_value.c} (64%) rename openbox/{actions_value.h => action_value.h} (52%) delete mode 100644 openbox/actions.h delete mode 100644 openbox/actions/shadelowerraise.c delete mode 100644 openbox/actions_list.h diff --git a/Makefile.am b/Makefile.am index 6ca83144..bbd647c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -226,18 +226,17 @@ openbox_openbox_SOURCES = \ openbox/actions/resizerelative.c \ openbox/actions/restart.c \ openbox/actions/shade.c \ - openbox/actions/shadelowerraise.c \ openbox/actions/showdesktop.c \ openbox/actions/showmenu.c \ openbox/actions/unfocus.c \ - openbox/actions.c \ - openbox/actions.h \ - openbox/actions_list.c \ - openbox/actions_list.h \ - openbox/actions_parser.c \ - openbox/actions_parser.h \ - openbox/actions_value.c \ - openbox/actions_value.h \ + openbox/action.c \ + openbox/action.h \ + openbox/action_list.c \ + openbox/action_list.h \ + openbox/action_parser.c \ + openbox/action_parser.h \ + openbox/action_value.c \ + openbox/action_value.h \ openbox/client.c \ openbox/client.h \ openbox/client_list_menu.c \ diff --git a/openbox/actions.c b/openbox/action.c similarity index 65% rename from openbox/actions.c rename to openbox/action.c index 1ab1d173..79f0f1f1 100644 --- a/openbox/actions.c +++ b/openbox/action.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions.c for the Openbox window manager - Copyright (c) 2007 Dana Jansens + action.c for the Openbox window manager + Copyright (c) 2007-2011 Dana Jansens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include "actions.h" -#include "actions_list.h" +#include "action.h" +#include "action_list.h" #include "gettext.h" #include "grab.h" #include "screen.h" @@ -30,71 +30,71 @@ #include "actions/all.h" -static void actions_definition_ref(ObActionsDefinition *def); -static void actions_definition_unref(ObActionsDefinition *def); -static gboolean actions_interactive_begin_act(ObActionsAct *act, guint state); -static void actions_interactive_end_act(); -static ObActionsAct* actions_act_find_name(const gchar *name); +static void action_definition_ref(ObActionDefinition *def); +static void action_definition_unref(ObActionDefinition *def); +static gboolean action_interactive_begin_act(ObAction *act, guint state); +static void action_interactive_end_act(); +static ObAction* action_find_by_name(const gchar *name); -static ObActionsAct *interactive_act = NULL; -static guint interactive_initial_state = 0; +static ObAction *interactive_act = NULL; +static guint interactive_initial_state = 0; -struct _ObActionsDefinition { +struct _ObActionDefinition { guint ref; gchar *name; gboolean canbeinteractive; union { - ObActionsIDataSetupFunc i; - ObActionsDataSetupFunc n; + ObActionIDataSetupFunc i; + ObActionDataSetupFunc n; } setup; - ObActionsDataFreeFunc free; - ObActionsRunFunc run; - ObActionsShutdownFunc shutdown; + ObActionDataFreeFunc free; + ObActionRunFunc run; + ObActionShutdownFunc shutdown; }; -struct _ObActionsAct { +struct _ObAction { guint ref; - ObActionsDefinition *def; - ObActionsIPreFunc i_pre; - ObActionsIInputFunc i_input; - ObActionsICancelFunc i_cancel; - ObActionsIPostFunc i_post; + ObActionDefinition *def; + ObActionIPreFunc i_pre; + ObActionIInputFunc i_input; + ObActionICancelFunc i_cancel; + ObActionIPostFunc i_post; gpointer options; }; static GSList *registered = NULL; -void actions_startup(gboolean reconfig) +void action_startup(gboolean reconfig) { if (reconfig) return; - action_all_startup(); + actions_all_startup(); } -void actions_shutdown(gboolean reconfig) +void action_shutdown(gboolean reconfig) { - actions_interactive_cancel_act(); + action_interactive_cancel_act(); if (reconfig) return; /* free all the registered actions */ while (registered) { - ObActionsDefinition *d = registered->data; + ObActionDefinition *d = registered->data; if (d->shutdown) d->shutdown(); - actions_definition_unref(d); + action_definition_unref(d); registered = g_slist_delete_link(registered, registered); } } -ObActionsDefinition* do_register(const gchar *name, - ObActionsDataFreeFunc free, - ObActionsRunFunc run) +ObActionDefinition* do_register(const gchar *name, + ObActionDataFreeFunc free, + ObActionRunFunc run) { GSList *it; - ObActionsDefinition *def; + ObActionDefinition *def; g_assert(run != NULL); @@ -104,7 +104,7 @@ ObActionsDefinition* do_register(const gchar *name, return NULL; } - def = g_slice_new(ObActionsDefinition); + def = g_slice_new(ObActionDefinition); def->ref = 1; def->name = g_strdup(name); def->free = free; @@ -115,12 +115,12 @@ ObActionsDefinition* do_register(const gchar *name, return def; } -gboolean actions_register_i(const gchar *name, - ObActionsIDataSetupFunc setup, - ObActionsDataFreeFunc free, - ObActionsRunFunc run) +gboolean action_register_i(const gchar *name, + ObActionIDataSetupFunc setup, + ObActionDataFreeFunc free, + ObActionRunFunc run) { - ObActionsDefinition *def = do_register(name, free, run); + ObActionDefinition *def = do_register(name, free, run); if (def) { def->canbeinteractive = TRUE; def->setup.i = setup; @@ -128,12 +128,12 @@ gboolean actions_register_i(const gchar *name, return def != NULL; } -gboolean actions_register(const gchar *name, - ObActionsDataSetupFunc setup, - ObActionsDataFreeFunc free, - ObActionsRunFunc run) +gboolean action_register(const gchar *name, + ObActionDataSetupFunc setup, + ObActionDataFreeFunc free, + ObActionRunFunc run) { - ObActionsDefinition *def = do_register(name, free, run); + ObActionDefinition *def = do_register(name, free, run); if (def) { def->canbeinteractive = FALSE; def->setup.n = setup; @@ -141,11 +141,11 @@ gboolean actions_register(const gchar *name, return def != NULL; } -gboolean actions_set_shutdown(const gchar *name, - ObActionsShutdownFunc shutdown) +gboolean action_set_shutdown(const gchar *name, + ObActionShutdownFunc shutdown) { GSList *it; - ObActionsDefinition *def; + ObActionDefinition *def; for (it = registered; it; it = g_slist_next(it)) { def = it->data; @@ -157,24 +157,24 @@ gboolean actions_set_shutdown(const gchar *name, return FALSE; } -static void actions_definition_ref(ObActionsDefinition *def) +static void action_definition_ref(ObActionDefinition *def) { ++def->ref; } -static void actions_definition_unref(ObActionsDefinition *def) +static void action_definition_unref(ObActionDefinition *def) { if (def && --def->ref == 0) { g_free(def->name); - g_slice_free(ObActionsDefinition, def); + g_slice_free(ObActionDefinition, def); } } -static ObActionsAct* actions_act_find_name(const gchar *name) +static ObAction* action_find_by_name(const gchar *name) { GSList *it; - ObActionsDefinition *def = NULL; - ObActionsAct *act = NULL; + ObActionDefinition *def = NULL; + ObAction *act = NULL; /* find the requested action */ for (it = registered; it; it = g_slist_next(it)) { @@ -186,10 +186,10 @@ static ObActionsAct* actions_act_find_name(const gchar *name) /* if we found the action */ if (def) { - act = g_slice_new(ObActionsAct); + act = g_slice_new(ObAction); act->ref = 1; act->def = def; - actions_definition_ref(act->def); + action_definition_ref(act->def); act->i_pre = NULL; act->i_input = NULL; act->i_cancel = NULL; @@ -202,11 +202,11 @@ static ObActionsAct* actions_act_find_name(const gchar *name) return act; } -ObActionsAct* actions_act_new(const gchar *name, GHashTable *config) +ObAction* action_new(const gchar *name, GHashTable *config) { - ObActionsAct *act = NULL; + ObAction *act = NULL; - act = actions_act_find_name(name); + act = action_find_by_name(name); if (act) { /* there is more stuff to parse here */ if (act->def->canbeinteractive) { @@ -226,36 +226,36 @@ ObActionsAct* actions_act_new(const gchar *name, GHashTable *config) return act; } -gboolean actions_act_is_interactive(ObActionsAct *act) +gboolean action_is_interactive(ObAction *act) { return act->i_input != NULL; } -void actions_act_ref(ObActionsAct *act) +void action_ref(ObAction *act) { ++act->ref; } -void actions_act_unref(ObActionsAct *act) +void action_unref(ObAction *act) { if (act && --act->ref == 0) { /* free the action specific options */ if (act->def->free) act->def->free(act->options); /* unref the definition */ - actions_definition_unref(act->def); - g_slice_free(ObActionsAct, act); + action_definition_unref(act->def); + g_slice_free(ObAction, act); } } -static void actions_setup_data(ObActionsData *data, - ObUserAction uact, - guint state, - gint x, - gint y, - gint button, - ObFrameContext con, - struct _ObClient *client) +static void action_setup_data(ObActionData *data, + ObUserAction uact, + guint state, + gint x, + gint y, + gint button, + ObFrameContext con, + struct _ObClient *client) { data->uact = uact; data->state = state; @@ -266,14 +266,14 @@ static void actions_setup_data(ObActionsData *data, data->client = client; } -gboolean actions_run_acts(ObActionsList *acts, - ObUserAction uact, - guint state, - gint x, - gint y, - gint button, - ObFrameContext con, - struct _ObClient *client) +gboolean action_run_acts(ObActionList *acts, + ObUserAction uact, + guint state, + gint x, + gint y, + gint button, + ObFrameContext con, + struct _ObClient *client) { gboolean ran_interactive; gboolean update_user_time; @@ -289,8 +289,8 @@ gboolean actions_run_acts(ObActionsList *acts, ran_interactive = FALSE; update_user_time = FALSE; while (acts) { - ObActionsAct *act; - ObActionsData data; + ObAction *act; + ObActionData data; gboolean ok = TRUE; if (acts->isfilter) { @@ -302,23 +302,23 @@ gboolean actions_run_acts(ObActionsList *acts, act = acts->u.action; } - actions_setup_data(&data, uact, state, x, y, button, con, client); + action_setup_data(&data, uact, state, x, y, button, con, client); /* if they have the same run function, then we'll assume they are cooperating and not cancel eachother out */ if (!interactive_act || interactive_act->def->run != act->def->run) { - if (actions_act_is_interactive(act)) { + if (action_is_interactive(act)) { /* cancel the old one */ if (interactive_act) - actions_interactive_cancel_act(); + action_interactive_cancel_act(); if (act->i_pre) if (!act->i_pre(state, act->options)) act->i_input = NULL; /* remove the interactivity */ ran_interactive = TRUE; } /* check again cuz it might have been cancelled */ - if (actions_act_is_interactive(act)) { - ok = actions_interactive_begin_act(act, state); + if (action_is_interactive(act)) { + ok = action_interactive_begin_act(act, state); ran_interactive = TRUE; } } @@ -326,8 +326,8 @@ gboolean actions_run_acts(ObActionsList *acts, /* fire the action's run function with this data */ if (ok) { if (!act->def->run(&data, act->options)) { - if (actions_act_is_interactive(act)) - actions_interactive_end_act(); + if (action_is_interactive(act)) + action_interactive_end_act(); if (client && client == focus_client) update_user_time = TRUE; } else { @@ -345,25 +345,25 @@ gboolean actions_run_acts(ObActionsList *acts, return ran_interactive; } -gboolean actions_interactive_act_running(void) +gboolean action_interactive_act_running(void) { return interactive_act != NULL; } -void actions_interactive_cancel_act(void) +void action_interactive_cancel_act(void) { if (interactive_act) { if (interactive_act->i_cancel) interactive_act->i_cancel(interactive_act->options); - actions_interactive_end_act(); + action_interactive_end_act(); } } -static gboolean actions_interactive_begin_act(ObActionsAct *act, guint state) +static gboolean action_interactive_begin_act(ObAction *act, guint state) { if (grab_keyboard()) { interactive_act = act; - actions_act_ref(interactive_act); + action_ref(interactive_act); interactive_initial_state = state; @@ -377,10 +377,10 @@ static gboolean actions_interactive_begin_act(ObActionsAct *act, guint state) return FALSE; } -static void actions_interactive_end_act(void) +static void action_interactive_end_act(void) { if (interactive_act) { - ObActionsAct *ia = interactive_act; + ObAction *ia = interactive_act; /* set this to NULL first so the i_post() function can't cause this to get called again (if it decides it wants to cancel any ongoing @@ -392,11 +392,11 @@ static void actions_interactive_end_act(void) if (ia->i_post) ia->i_post(ia->options); - actions_act_unref(ia); + action_unref(ia); } } -gboolean actions_interactive_input_event(XEvent *e) +gboolean action_interactive_input_event(XEvent *e) { gboolean used = FALSE; if (interactive_act) { @@ -406,13 +406,13 @@ gboolean actions_interactive_input_event(XEvent *e) { used = TRUE; /* if it cancelled the action then it has to of been used */ - actions_interactive_end_act(); + action_interactive_end_act(); } } return used; } -void actions_client_move(ObActionsData *data, gboolean start) +void action_client_move(ObActionData *data, gboolean start) { static gulong ignore_start = 0; if (start) diff --git a/openbox/action.h b/openbox/action.h new file mode 100644 index 00000000..187bf590 --- /dev/null +++ b/openbox/action.h @@ -0,0 +1,115 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + action.h for the Openbox window manager + Copyright (c) 2007-2011 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include "misc.h" +#include "frame.h" +#include "obt/xml.h" +#include "obt/keyboard.h" + +#include +#include + +struct _ObActionList; + +typedef struct _ObActionDefinition ObActionDefinition; +typedef struct _ObAction ObAction; +typedef struct _ObActionData ObActionData; + +typedef void (*ObActionDataFreeFunc)(gpointer options); +typedef gboolean (*ObActionRunFunc)(ObActionData *data, + gpointer options); +typedef gpointer (*ObActionDataSetupFunc)(GHashTable *config); +typedef void (*ObActionShutdownFunc)(void); + +/* functions for interactive actions */ +/* return TRUE if the action is going to be interactive, or false to change + your mind and make it not */ +typedef gboolean (*ObActionIPreFunc)(guint initial_state, gpointer options); +typedef void (*ObActionIPostFunc)(gpointer options); +typedef gboolean (*ObActionIInputFunc)(guint initial_state, + XEvent *e, + ObtIC *ic, + gpointer options, + gboolean *used); +typedef void (*ObActionICancelFunc)(gpointer options); +typedef gpointer (*ObActionIDataSetupFunc)(GHashTable *config, + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post); + +struct _ObActionData { + ObUserAction uact; + guint state; + gint x; + gint y; + gint button; + + struct _ObClient *client; + ObFrameContext context; +}; + +void action_startup(gboolean reconfigure); +void action_shutdown(gboolean reconfigure); + +/*! Use this if the actions created from this name may be interactive */ +gboolean action_register_i(const gchar *name, + ObActionIDataSetupFunc setup, + ObActionDataFreeFunc free, + ObActionRunFunc run); + +gboolean action_register(const gchar *name, + ObActionDataSetupFunc setup, + ObActionDataFreeFunc free, + ObActionRunFunc run); + +gboolean action_set_shutdown(const gchar *name, + ObActionShutdownFunc shutdown); + +gboolean action_is_interactive(ObAction *act); + +/*! Create a new ObAction structure. + @name The name of the action. + @keys The names of the options passed to the action. + @values The values of the options passed to the action, paired with the + keys. These are ObActionListValue objects. +*/ +ObAction* action_new(const gchar *name, GHashTable *config); + +void action_ref(ObAction *act); +void action_unref(ObAction *act); + +/*! Runs a list of actions. + @return TRUE if an interactive action was started, FALSE otherwise. +*/ +gboolean action_run_acts(struct _ObActionList *acts, + ObUserAction uact, + guint state, + gint x, + gint y, + gint button, + ObFrameContext con, + struct _ObClient *client); + +gboolean action_interactive_act_running(void); +void action_interactive_cancel_act(void); + +gboolean action_interactive_input_event(XEvent *e); + +/*! Function for actions to call when they are moving a client around */ +void action_client_move(ObActionData *data, gboolean start); diff --git a/openbox/actions_list.c b/openbox/action_list.c similarity index 57% rename from openbox/actions_list.c rename to openbox/action_list.c index 345f47b9..c6c50608 100644 --- a/openbox/actions_list.c +++ b/openbox/action_list.c @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions_list.c for the Openbox window manager + action_list.c for the Openbox window manager Copyright (c) 2011 Dana Jansens This program is free software; you can redistribute it and/or modify @@ -16,50 +16,50 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include "actions_list.h" -#include "actions.h" -#include "actions_value.h" +#include "action_list.h" +#include "action.h" +#include "action_value.h" #include -void actions_list_ref(ObActionsList *l) +void action_list_ref(ObActionList *l) { if (l) ++l->ref; } -void actions_list_unref(ObActionsList *l) +void action_list_unref(ObActionList *l) { while (l && --l->ref < 1) { - ObActionsList *n = l->next; + ObActionList *n = l->next; if (l->isfilter) { - actions_list_test_destroy(l->u.f.test); - actions_list_unref(l->u.f.thendo); - actions_list_unref(l->u.f.elsedo); + action_list_test_destroy(l->u.f.test); + action_list_unref(l->u.f.thendo); + action_list_unref(l->u.f.elsedo); } else { - actions_act_unref(l->u.action); + action_unref(l->u.action); } - g_slice_free(ObActionsList, l); + g_slice_free(ObActionList, l); l = n; } } -void actions_list_test_destroy(ObActionsListTest *t) +void action_list_test_destroy(ObActionListTest *t) { while (t) { - ObActionsListTest *n = t->next; + ObActionListTest *n = t->next; g_free(t->key); - actions_value_unref(t->value); - g_slice_free(ObActionsListTest, t); + action_value_unref(t->value); + g_slice_free(ObActionListTest, t); t = n; } } -ObActionsList* actions_list_concat(ObActionsList *a, ObActionsList *b) +ObActionList* action_list_concat(ObActionList *a, ObActionList *b) { - ObActionsList *start = a; + ObActionList *start = a; if (!start) return b; while (a->next) a = a->next; diff --git a/openbox/action_list.h b/openbox/action_list.h new file mode 100644 index 00000000..4e2dcb2e --- /dev/null +++ b/openbox/action_list.h @@ -0,0 +1,55 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + action_list.h for the Openbox window manager + Copyright (c) 2011 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include + +struct _ObActionAct; +struct _ObActionValue; + +typedef struct _ObActionList ObActionList; +typedef struct _ObActionListTest ObActionListTest; + +/*! Each node of the Action list is an action itself (or a filter bound to + an action). */ +struct _ObActionList { + gint ref; + gboolean isfilter; + union { + struct _ObActionListFilter { + ObActionListTest *test; /* can be null */ + ObActionList *thendo; /* can be null */ + ObActionList *elsedo; /* can be null */ + } f; + struct _ObAction *action; + } u; + ObActionList *next; +}; + +struct _ObActionListTest { + gchar *key; + struct _ObActionValue *value; /* can be null */ + gboolean and; + ObActionListTest *next; +}; + +void action_list_ref(ObActionList *l); +void action_list_unref(ObActionList *l); + +void action_list_test_destroy(ObActionListTest *t); + +ObActionList* action_list_concat(ObActionList *a, ObActionList *b); diff --git a/openbox/actions_parser.c b/openbox/action_parser.c similarity index 78% rename from openbox/actions_parser.c rename to openbox/action_parser.c index 5947378d..0424bdbd 100644 --- a/openbox/actions_parser.c +++ b/openbox/action_parser.c @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions_parser.c for the Openbox window manager + action_parser.c for the Openbox window manager Copyright (c) 2011 Dana Jansens This program is free software; you can redistribute it and/or modify @@ -16,45 +16,45 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include "actions_parser.h" -#include "actions.h" -#include "actions_list.h" -#include "actions_value.h" +#include "action_parser.h" +#include "action.h" +#include "action_list.h" +#include "action_value.h" #include "gettext.h" #ifdef HAVE_STRING_H # include #endif -struct _ObActionsList; -struct _ObActionsListTest; -struct _ObActionsValue; +struct _ObActionList; +struct _ObActionListTest; +struct _ObActionValue; #define SKIP " \t" #define IDENTIFIER_FIRST G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_" #define IDENTIFIER_NTH IDENTIFIER_FIRST G_CSET_LATINS G_CSET_LATINC #define ESCAPE_SEQS "\"()" -struct _ObActionsList* parse_list(ObActionsParser *p, - GTokenType end, - gboolean *e); -struct _ObActionsList* parse_action(ObActionsParser *p, gboolean *e); -struct _ObActionsList* parse_filter(ObActionsParser *p, gboolean *e); -struct _ObActionsListTest* parse_filter_test(ObActionsParser *p, gboolean *e); -struct _ObActionsValue* parse_value(ObActionsParser *p, - gboolean allow_actions, - gboolean *e); -gchar* parse_string(ObActionsParser *p, guchar end, gboolean *e); - -struct _ObActionsParser +struct _ObActionList* parse_list(ObActionParser *p, + GTokenType end, + gboolean *e); +struct _ObActionList* parse_action(ObActionParser *p, gboolean *e); +struct _ObActionList* parse_filter(ObActionParser *p, gboolean *e); +struct _ObActionListTest* parse_filter_test(ObActionParser *p, gboolean *e); +struct _ObActionValue* parse_value(ObActionParser *p, + gboolean allow_actions, + gboolean *e); +gchar* parse_string(ObActionParser *p, guchar end, gboolean *e); + +struct _ObActionParser { gint ref; GScanner *scan; }; -ObActionsParser* actions_parser_new(void) +ObActionParser* action_parser_new(void) { - ObActionsParser *p; + ObActionParser *p; GScannerConfig config = { .cset_skip_characters = SKIP, .cset_identifier_first = IDENTIFIER_FIRST, @@ -84,27 +84,26 @@ ObActionsParser* actions_parser_new(void) .store_int64 = FALSE }; - p = g_slice_new(ObActionsParser); + p = g_slice_new(ObActionParser); p->ref = 1; p->scan = g_scanner_new(&config); return p; } -void actions_parser_ref(ObActionsParser *p) +void action_parser_ref(ObActionParser *p) { ++p->ref; } -void actions_parser_unref(ObActionsParser *p) +void action_parser_unref(ObActionParser *p) { if (p && --p->ref < 1) { g_scanner_destroy(p->scan); - g_slice_free(ObActionsParser, p); + g_slice_free(ObActionParser, p); } } -ObActionsList* actions_parser_read_string(ObActionsParser *p, - const gchar *text) +ObActionList* action_parser_read_string(ObActionParser *p, const gchar *text) { gboolean e; @@ -115,9 +114,9 @@ ObActionsList* actions_parser_read_string(ObActionsParser *p, return parse_list(p, G_TOKEN_EOF, &e); } -ObActionsList* actions_parser_read_file(ObActionsParser *p, - const gchar *file, - GError **error) +ObActionList* actions_parser_read_file(ObActionParser *p, + const gchar *file, + GError **error) { GIOChannel *ch; gboolean e; @@ -152,7 +151,7 @@ STRING := "TEXT" | (TEXT) | \\ \( \) and \" are all valid escaped characters. ************** ************/ -gpointer parse_error(ObActionsParser *p, GTokenType exp, const gchar *message, +gpointer parse_error(ObActionParser *p, GTokenType exp, const gchar *message, gboolean *e) { g_scanner_unexp_token(p->scan, exp, NULL, NULL, NULL, message, TRUE); @@ -160,9 +159,9 @@ gpointer parse_error(ObActionsParser *p, GTokenType exp, const gchar *message, return NULL; } -ObActionsList* parse_list(ObActionsParser *p, GTokenType end, gboolean *e) +ObActionList* parse_list(ObActionParser *p, GTokenType end, gboolean *e) { - ObActionsList *first, *last; + ObActionList *first, *last; GTokenType t; first = last = NULL; @@ -175,7 +174,7 @@ ObActionsList* parse_list(ObActionsParser *p, GTokenType end, gboolean *e) g_scanner_get_next_token(p->scan); /* separator */ } else if (t == G_TOKEN_IDENTIFIER) { - ObActionsList *next; + ObActionList *next; /* parse the next action and stick it on the end of the list */ next = parse_action(p, e); @@ -200,10 +199,10 @@ ObActionsList* parse_list(ObActionsParser *p, GTokenType end, gboolean *e) return first; } -ObActionsList* parse_action(ObActionsParser *p, gboolean *e) +ObActionList* parse_action(ObActionParser *p, gboolean *e) { GTokenType t; - ObActionsList *al; + ObActionList *al; gchar *name; GHashTable *config; @@ -219,7 +218,7 @@ ObActionsList* parse_action(ObActionsParser *p, gboolean *e) /* read the action's name */ name = g_strdup(p->scan->value.v_string); config = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)actions_value_unref); + (GDestroyNotify)action_value_unref); /* read the action's options key:value pairs */ t = g_scanner_peek_next_token(p->scan); @@ -232,7 +231,7 @@ ObActionsList* parse_action(ObActionsParser *p, gboolean *e) } else { gchar *key; - ObActionsValue *value; + ObActionValue *value; g_scanner_get_next_token(p->scan); /* eat the key */ t = g_scanner_peek_next_token(p->scan); /* check for ':' */ @@ -262,26 +261,26 @@ ObActionsList* parse_action(ObActionsParser *p, gboolean *e) t = g_scanner_peek_next_token(p->scan); } - al = g_slice_new(ObActionsList); + al = g_slice_new(ObActionList); al->ref = 1; al->isfilter = FALSE; - al->u.action = actions_act_new(name, config); + al->u.action = action_new(name, config); al->next = NULL; g_free(name); g_hash_table_unref(config); return al; } -ObActionsList* parse_filter(ObActionsParser *p, gboolean *e) +ObActionList* parse_filter(ObActionParser *p, gboolean *e) { GTokenType t; - ObActionsList *al, *thendo, *elsedo; - ObActionsListTest *test; + ObActionList *al, *thendo, *elsedo; + ObActionListTest *test; /* read the filter tests */ test = parse_filter_test(p, e); if (*e) { - actions_list_test_destroy(test); + action_list_test_destroy(test); return NULL; } @@ -300,7 +299,7 @@ ObActionsList* parse_filter(ObActionsParser *p, gboolean *e) } } - al = g_slice_new(ObActionsList); + al = g_slice_new(ObActionList); al->ref = 1; al->isfilter = TRUE; al->u.f.test = test; @@ -310,13 +309,13 @@ ObActionsList* parse_filter(ObActionsParser *p, gboolean *e) return al; } -ObActionsListTest* parse_filter_test(ObActionsParser *p, gboolean *e) +ObActionListTest* parse_filter_test(ObActionParser *p, gboolean *e) { GTokenType t; gchar *key; - ObActionsValue *value; + ObActionValue *value; gboolean and; - ObActionsListTest *next; + ObActionListTest *next; t = g_scanner_get_next_token(p->scan); if (t == ']') /* empty */ @@ -342,7 +341,7 @@ ObActionsListTest* parse_filter_test(ObActionsParser *p, gboolean *e) /* don't allow any errors (but value can be null if not present) */ if (*e) { g_free(key); - actions_value_unref(value); + action_value_unref(value); return NULL; } @@ -364,14 +363,14 @@ ObActionsListTest* parse_filter_test(ObActionsParser *p, gboolean *e) /* don't allow any errors */ if (*e) { g_free(key); - actions_value_unref(value); - actions_list_test_destroy(next); + action_value_unref(value); + action_list_test_destroy(next); return NULL; } else { - ObActionsListTest *test; + ObActionListTest *test; - test = g_slice_new(ObActionsListTest); + test = g_slice_new(ObActionListTest); test->key = key; test->value = value; test->and = and; @@ -380,25 +379,25 @@ ObActionsListTest* parse_filter_test(ObActionsParser *p, gboolean *e) } } -ObActionsValue* parse_value(ObActionsParser *p, - gboolean allow_actions, - gboolean *e) +ObActionValue* parse_value(ObActionParser *p, + gboolean allow_actions, + gboolean *e) { GTokenType t; - ObActionsValue *v; + ObActionValue *v; v = NULL; t = g_scanner_get_next_token(p->scan); if (t == G_TOKEN_IDENTIFIER) { - v = actions_value_new_string(p->scan->value.v_string); + v = action_value_new_string(p->scan->value.v_string); } else if (t == '"') - v = actions_value_new_string(parse_string(p, '"', e)); + v = action_value_new_string(parse_string(p, '"', e)); else if (t == '(') - v = actions_value_new_string(parse_string(p, ')', e)); + v = action_value_new_string(parse_string(p, ')', e)); else if (t == '{' && allow_actions) { - ObActionsList *l = parse_list(p, '}', e); - if (l) v = actions_value_new_actions_list(l); + ObActionList *l = parse_list(p, '}', e); + if (l) v = action_value_new_action_list(l); } else parse_error(p, G_TOKEN_NONE, _("Expected an option value"), e); @@ -406,7 +405,7 @@ ObActionsValue* parse_value(ObActionsParser *p, } -gchar* parse_string(ObActionsParser *p, guchar end, gboolean *e) +gchar* parse_string(ObActionParser *p, guchar end, gboolean *e) { GString *buf; GTokenType t; diff --git a/openbox/actions_parser.h b/openbox/action_parser.h similarity index 54% rename from openbox/actions_parser.h rename to openbox/action_parser.h index 44a19723..1c070bd6 100644 --- a/openbox/actions_parser.h +++ b/openbox/action_parser.h @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions_parser.h for the Openbox window manager + action_parser.h for the Openbox window manager Copyright (c) 2011 Dana Jansens This program is free software; you can redistribute it and/or modify @@ -18,17 +18,17 @@ #include -struct _ObActionsList; +struct _ObActionList; -typedef struct _ObActionsParser ObActionsParser; +typedef struct _ObActionParser ObActionParser; -ObActionsParser* actions_parser_new(void); +ObActionParser* action_parser_new(void); -void actions_parser_ref(ObActionsParser *p); -void actions_parser_unref(ObActionsParser *p); +void action_parser_ref(ObActionParser *p); +void action_parser_unref(ObActionParser *p); -struct _ObActionsList* actions_parser_read_string(ObActionsParser *p, - const gchar *text); -struct _ObActionsList* actions_parser_read_file(ObActionsParser *p, - const gchar *file, - GError **error); +struct _ObActionList* action_parser_read_string(ObActionParser *p, + const gchar *text); +struct _ObActionList* action_parser_read_file(ObActionParser *p, + const gchar *file, + GError **error); diff --git a/openbox/actions_value.c b/openbox/action_value.c similarity index 64% rename from openbox/actions_value.c rename to openbox/action_value.c index 5603adef..ed8d691a 100644 --- a/openbox/actions_value.c +++ b/openbox/action_value.c @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions_value.c for the Openbox window manager + action_value.c for the Openbox window manager Copyright (c) 2011 Dana Jansens This program is free software; you can redistribute it and/or modify @@ -16,87 +16,87 @@ See the COPYING file for a copy of the GNU General Public License. */ -#include "actions_value.h" -#include "actions_list.h" +#include "action_value.h" +#include "action_list.h" #include "geom.h" #include "stdlib.h" -struct _ObActionsValue { +struct _ObActionValue { gint ref; enum { OB_AV_STRING, - OB_AV_ACTIONSLIST + OB_AV_ACTIONLIST } type; union { gchar *string; gboolean boolean; guint integer; - ObActionsList *actions; + ObActionList *actions; } v; }; -ObActionsValue* actions_value_new_string(const gchar *s) +ObActionValue* action_value_new_string(const gchar *s) { - return actions_value_new_string_steal(g_strdup(s)); + return action_value_new_string_steal(g_strdup(s)); } -ObActionsValue* actions_value_new_string_steal(gchar *s) +ObActionValue* action_value_new_string_steal(gchar *s) { - ObActionsValue *v = g_slice_new(ObActionsValue); + ObActionValue *v = g_slice_new(ObActionValue); v->ref = 1; v->type = OB_AV_STRING; v->v.string = s; return v; } -ObActionsValue* actions_value_new_actions_list(ObActionsList *al) +ObActionValue* action_value_new_action_list(ObActionList *al) { - ObActionsValue *v = g_slice_new(ObActionsValue); + ObActionValue *v = g_slice_new(ObActionValue); v->ref = 1; - v->type = OB_AV_ACTIONSLIST; + v->type = OB_AV_ACTIONLIST; v->v.actions = al; - actions_list_ref(al); + action_list_ref(al); return v; } -void actions_value_ref(ObActionsValue *v) +void action_value_ref(ObActionValue *v) { ++v->ref; } -void actions_value_unref(ObActionsValue *v) +void action_value_unref(ObActionValue *v) { if (v && --v->ref < 1) { switch (v->type) { case OB_AV_STRING: g_free(v->v.string); break; - case OB_AV_ACTIONSLIST: - actions_list_unref(v->v.actions); + case OB_AV_ACTIONLIST: + action_list_unref(v->v.actions); break; } - g_slice_free(ObActionsValue, v); + g_slice_free(ObActionValue, v); } } -gboolean actions_value_is_string(ObActionsValue *v) +gboolean action_value_is_string(ObActionValue *v) { return v->type == OB_AV_STRING; } -gboolean actions_value_is_actions_list(ObActionsValue *v) +gboolean action_value_is_action_list(ObActionValue *v) { - return v->type == OB_AV_ACTIONSLIST; + return v->type == OB_AV_ACTIONLIST; } -const gchar* actions_value_string(ObActionsValue *v) +const gchar* action_value_string(ObActionValue *v) { g_return_val_if_fail(v->type == OB_AV_STRING, NULL); return v->v.string; } -gboolean actions_value_bool(ObActionsValue *v) +gboolean action_value_bool(ObActionValue *v) { g_return_val_if_fail(v->type == OB_AV_STRING, FALSE); if (g_strcasecmp(v->v.string, "true") == 0 || @@ -106,7 +106,7 @@ gboolean actions_value_bool(ObActionsValue *v) return FALSE; } -gint actions_value_int(ObActionsValue *v) +gint action_value_int(ObActionValue *v) { gchar *s; @@ -115,7 +115,7 @@ gint actions_value_int(ObActionsValue *v) return strtol(s, &s, 10); } -void actions_value_fraction(ObActionsValue *v, gint *numer, gint *denom) +void action_value_fraction(ObActionValue *v, gint *numer, gint *denom) { gchar *s; @@ -131,7 +131,7 @@ void actions_value_fraction(ObActionsValue *v, gint *numer, gint *denom) *denom = atoi(s+1); } -void actions_value_gravity_coord(ObActionsValue *v, GravityCoord *c) +void action_value_gravity_coord(ObActionValue *v, GravityCoord *c) { gchar *s; @@ -159,8 +159,8 @@ void actions_value_gravity_coord(ObActionsValue *v, GravityCoord *c) } } -ObActionsList* actions_value_actions_list(ObActionsValue *v) +ObActionList* action_value_action_list(ObActionValue *v) { - g_return_val_if_fail(v->type == OB_AV_ACTIONSLIST, NULL); + g_return_val_if_fail(v->type == OB_AV_ACTIONLIST, NULL); return v->v.actions; } diff --git a/openbox/actions_value.h b/openbox/action_value.h similarity index 52% rename from openbox/actions_value.h rename to openbox/action_value.h index 681a00cc..2a2fd9f0 100644 --- a/openbox/actions_value.h +++ b/openbox/action_value.h @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - actions_value.h for the Openbox window manager + action_value.h for the Openbox window manager Copyright (c) 2011 Dana Jansens This program is free software; you can redistribute it and/or modify @@ -19,27 +19,27 @@ #include struct _GravityCoord; -struct _ObActionsList; +struct _ObActionList; -typedef struct _ObActionsValue ObActionsValue; +typedef struct _ObActionValue ObActionValue; /*! Creates a new value by making a copy of the given string. */ -ObActionsValue* actions_value_new_string(const gchar *s); +ObActionValue* action_value_new_string(const gchar *s); /*! Creates a new value from a string, and steals ownership of the string. It will be freed when then value is destroyed. */ -ObActionsValue* actions_value_new_string_steal(gchar *s); +ObActionValue* action_value_new_string_steal(gchar *s); /*! Creates a new value with a given actions list. */ -ObActionsValue* actions_value_new_actions_list(struct _ObActionsList *al); +ObActionValue* action_value_new_action_list(struct _ObActionList *al); -void actions_value_ref(ObActionsValue *v); -void actions_value_unref(ObActionsValue *v); +void action_value_ref(ObActionValue *v); +void action_value_unref(ObActionValue *v); -gboolean actions_value_is_string(ObActionsValue *v); -gboolean actions_value_is_actions_list(ObActionsValue *v); +gboolean action_value_is_string(ObActionValue *v); +gboolean action_value_is_action_list(ObActionValue *v); -const gchar* actions_value_string(ObActionsValue *v); -gboolean actions_value_bool(ObActionsValue *v); -gint actions_value_int(ObActionsValue *v); -void actions_value_fraction(ObActionsValue *v, gint *numer, gint *denom); -void actions_value_gravity_coord(ObActionsValue *v, struct _GravityCoord *c); -struct _ObActionsList* actions_value_actions_list(ObActionsValue *v); +const gchar* action_value_string(ObActionValue *v); +gboolean action_value_bool(ObActionValue *v); +gint action_value_int(ObActionValue *v); +void action_value_fraction(ObActionValue *v, gint *numer, gint *denom); +void action_value_gravity_coord(ObActionValue *v, struct _GravityCoord *c); +struct _ObActionList* action_value_action_list(ObActionValue *v); diff --git a/openbox/actions.h b/openbox/actions.h deleted file mode 100644 index 82d35056..00000000 --- a/openbox/actions.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - - actions.h for the Openbox window manager - Copyright (c) 2007 Dana Jansens - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - See the COPYING file for a copy of the GNU General Public License. -*/ - -#include "misc.h" -#include "frame.h" -#include "obt/xml.h" -#include "obt/keyboard.h" - -#include -#include - -struct _ObActionsList; - -typedef struct _ObActionsDefinition ObActionsDefinition; -typedef struct _ObActionsAct ObActionsAct; -typedef struct _ObActionsData ObActionsData; - -typedef void (*ObActionsDataFreeFunc)(gpointer options); -typedef gboolean (*ObActionsRunFunc)(ObActionsData *data, - gpointer options); -typedef gpointer (*ObActionsDataSetupFunc)(GHashTable *config); -typedef void (*ObActionsShutdownFunc)(void); - -/* functions for interactive actions */ -/* return TRUE if the action is going to be interactive, or false to change - your mind and make it not */ -typedef gboolean (*ObActionsIPreFunc)(guint initial_state, gpointer options); -typedef void (*ObActionsIPostFunc)(gpointer options); -typedef gboolean (*ObActionsIInputFunc)(guint initial_state, - XEvent *e, - ObtIC *ic, - gpointer options, - gboolean *used); -typedef void (*ObActionsICancelFunc)(gpointer options); -typedef gpointer (*ObActionsIDataSetupFunc)(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post); - -struct _ObActionsData { - ObUserAction uact; - guint state; - gint x; - gint y; - gint button; - - struct _ObClient *client; - ObFrameContext context; -}; - -void actions_startup(gboolean reconfigure); -void actions_shutdown(gboolean reconfigure); - -/*! Use this if the actions created from this name may be interactive */ -gboolean actions_register_i(const gchar *name, - ObActionsIDataSetupFunc setup, - ObActionsDataFreeFunc free, - ObActionsRunFunc run); - -gboolean actions_register(const gchar *name, - ObActionsDataSetupFunc setup, - ObActionsDataFreeFunc free, - ObActionsRunFunc run); - -gboolean actions_set_shutdown(const gchar *name, - ObActionsShutdownFunc shutdown); - -gboolean actions_act_is_interactive(ObActionsAct *act); - -/*! Create a new ObActionAct structure. - @name The name of the action. - @keys The names of the options passed to the action. - @values The values of the options passed to the action, paired with the - keys. These are ObActionsListValue objects. -*/ -ObActionsAct* actions_act_new(const gchar *name, GHashTable *config); - -void actions_act_ref(ObActionsAct *act); -void actions_act_unref(ObActionsAct *act); - -/*! Runs a list of actions. - @return TRUE if an interactive action was started, FALSE otherwise. -*/ -gboolean actions_run_acts(struct _ObActionsList *acts, - ObUserAction uact, - guint state, - gint x, - gint y, - gint button, - ObFrameContext con, - struct _ObClient *client); - -gboolean actions_interactive_act_running(void); -void actions_interactive_cancel_act(void); - -gboolean actions_interactive_input_event(XEvent *e); - -/*! Function for actions to call when they are moving a client around */ -void actions_client_move(ObActionsData *data, gboolean start); diff --git a/openbox/actions/addremovedesktop.c b/openbox/actions/addremovedesktop.c index 10458d57..85923e39 100644 --- a/openbox/actions/addremovedesktop.c +++ b/openbox/actions/addremovedesktop.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/screen.h" #include @@ -12,7 +12,7 @@ static gpointer setup_func(GHashTable *config); static gpointer setup_add_func(GHashTable *config); static gpointer setup_remove_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); /* 3.4-compatibility */ static gpointer setup_addcurrent_func(GHashTable *config); static gpointer setup_addlast_func(GHashTable *config); @@ -21,30 +21,30 @@ static gpointer setup_removelast_func(GHashTable *config); void action_addremovedesktop_startup(void) { - actions_register("AddDesktop", setup_add_func, free_func, run_func); - actions_register("RemoveDesktop", setup_remove_func, free_func, run_func); + action_register("AddDesktop", setup_add_func, free_func, run_func); + action_register("RemoveDesktop", setup_remove_func, free_func, run_func); /* 3.4-compatibility */ - actions_register("AddDesktopLast", setup_addlast_func, - free_func, run_func); - actions_register("RemoveDesktopLast", setup_removelast_func, - free_func, run_func); - actions_register("AddDesktopCurrent", setup_addcurrent_func, - free_func, run_func); - actions_register("RemoveDesktopCurrent", setup_removecurrent_func, - free_func, run_func); + action_register("AddDesktopLast", setup_addlast_func, + free_func, run_func); + action_register("RemoveDesktopLast", setup_removelast_func, + free_func, run_func); + action_register("AddDesktopCurrent", setup_addcurrent_func, + free_func, run_func); + action_register("RemoveDesktopCurrent", setup_removecurrent_func, + free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "where"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "last")) o->current = FALSE; else if (!g_ascii_strcasecmp(s, "current")) @@ -74,18 +74,18 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; - actions_client_move(data, TRUE); + action_client_move(data, TRUE); if (o->add) screen_add_desktop(o->current); else screen_remove_desktop(o->current); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); return FALSE; } diff --git a/openbox/actions/all.c b/openbox/actions/all.c index 06e3074a..26bf8bbe 100644 --- a/openbox/actions/all.c +++ b/openbox/actions/all.c @@ -1,6 +1,6 @@ #include "all.h" -void action_all_startup(void) +void actions_all_startup(void) { action_execute_startup(); action_debug_startup(); @@ -38,6 +38,4 @@ void action_all_startup(void) action_movetoedge_startup(); action_growtoedge_startup(); action_focustobottom_startup(); - /* 3.4-compatibility */ - action_shadelowerraise_startup(); } diff --git a/openbox/actions/all.h b/openbox/actions/all.h index 5bc337aa..3fbda6b8 100644 --- a/openbox/actions/all.h +++ b/openbox/actions/all.h @@ -1,7 +1,7 @@ #ifndef __actions_all_h #define __actions_all_h -void action_all_startup(void); +void actions_all_startup(void); void action_execute_startup(void); void action_debug_startup(void); @@ -39,7 +39,5 @@ void action_layer_startup(void); void action_movetoedge_startup(void); void action_growtoedge_startup(void); void action_focustobottom_startup(void); -/* 3.4-compatibility */ -void action_shadelowerraise_startup(void); #endif diff --git a/openbox/actions/breakchroot.c b/openbox/actions/breakchroot.c index 8c004582..c46fa930 100644 --- a/openbox/actions/breakchroot.c +++ b/openbox/actions/breakchroot.c @@ -1,17 +1,17 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/keyboard.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_breakchroot_startup(void) { - actions_register("BreakChroot", - NULL, NULL, - run_func); + action_register("BreakChroot", + NULL, NULL, + run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { /* break out of one chroot */ keyboard_reset_chains(1); diff --git a/openbox/actions/close.c b/openbox/actions/close.c index d2bc96c2..b8f799bd 100644 --- a/openbox/actions/close.c +++ b/openbox/actions/close.c @@ -1,17 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_close_startup(void) { - actions_register("Close", - NULL, NULL, - run_func); + action_register("Close", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) client_close(data->client); diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c index ab3cbbc0..b1f59b81 100644 --- a/openbox/actions/cyclewindows.c +++ b/openbox/actions/cyclewindows.c @@ -1,7 +1,7 @@ -#include "openbox/actions.h" -#include "openbox/actions_list.h" -#include "openbox/actions_parser.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_list.h" +#include "openbox/action_parser.h" +#include "openbox/action_value.h" #include "openbox/stacking.h" #include "openbox/window.h" #include "openbox/event.h" @@ -20,7 +20,7 @@ typedef struct { gboolean bar; gboolean raise; ObFocusCyclePopupMode dialog_mode; - ObActionsList *actions; + ObActionList *actions; /* options for after we're done */ @@ -29,22 +29,22 @@ typedef struct { } Options; static gpointer setup_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *in, + ObActionICancelFunc *c, + ObActionIPostFunc *post); static gpointer setup_forward_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *in, + ObActionICancelFunc *c, + ObActionIPostFunc *post); static gpointer setup_backward_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *in, + ObActionICancelFunc *c, + ObActionIPostFunc *post); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); static gboolean i_input_func(guint initial_state, XEvent *e, ObtIC *ic, @@ -55,18 +55,18 @@ static void i_post_func(gpointer options); void action_cyclewindows_startup(void) { - actions_register_i("NextWindow", setup_forward_func, free_func, run_func); - actions_register_i("PreviousWindow", setup_backward_func, free_func, - run_func); + action_register_i("NextWindow", setup_forward_func, free_func, run_func); + action_register_i("PreviousWindow", setup_backward_func, free_func, + run_func); } static gpointer setup_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); @@ -74,11 +74,11 @@ static gpointer setup_func(GHashTable *config, o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_LIST; v = g_hash_table_lookup(config, "linear"); - if (v && actions_value_is_string(v)) - o->linear = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->linear = action_value_bool(v); v = g_hash_table_lookup(config, "dialog"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (g_strcasecmp(s, "none") == 0) o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_NONE; else if (g_strcasecmp(s, "no") == 0) @@ -87,36 +87,36 @@ static gpointer setup_func(GHashTable *config, o->dialog_mode = OB_FOCUS_CYCLE_POPUP_MODE_ICONS; } v = g_hash_table_lookup(config, "bar"); - if (v && actions_value_is_string(v)) - o->bar = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->bar = action_value_bool(v); v = g_hash_table_lookup(config, "raise"); - if (v && actions_value_is_string(v)) - o->raise = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->raise = action_value_bool(v); v = g_hash_table_lookup(config, "panels"); - if (v && actions_value_is_string(v)) - o->dock_windows = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->dock_windows = action_value_bool(v); v = g_hash_table_lookup(config, "hilite"); - if (v && actions_value_is_string(v)) - o->only_hilite_windows = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->only_hilite_windows = action_value_bool(v); v = g_hash_table_lookup(config, "desktop"); - if (v && actions_value_is_string(v)) - o->desktop_windows = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->desktop_windows = action_value_bool(v); v = g_hash_table_lookup(config, "allDesktops"); - if (v && actions_value_is_string(v)) - o->all_desktops = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->all_desktops = action_value_bool(v); v = g_hash_table_lookup(config, "finalactions"); - if (v && actions_value_is_actions_list(v)) { - o->actions = actions_value_actions_list(v); - actions_list_ref(o->actions); + if (v && action_value_is_action_list(v)) { + o->actions = action_value_action_list(v); + action_list_ref(o->actions); } else { - ObActionsParser *p = actions_parser_new(); - o->actions = actions_parser_read_string(p, + ObActionParser *p = action_parser_new(); + o->actions = action_parser_read_string(p, "focus\n" "raise\n" "unshade\n"); - actions_parser_unref(p); + action_parser_unref(p); } *input = i_input_func; @@ -126,10 +126,10 @@ static gpointer setup_func(GHashTable *config, } static gpointer setup_forward_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { Options *o = setup_func(config, pre, input, cancel, post); o->forward = TRUE; @@ -137,10 +137,10 @@ static gpointer setup_forward_func(GHashTable *config, } static gpointer setup_backward_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { Options *o = setup_func(config, pre, input, cancel, post); o->forward = FALSE; @@ -151,11 +151,11 @@ static void free_func(gpointer options) { Options *o = options; - actions_list_unref(o->actions); + action_list_unref(o->actions); g_slice_free(Options, o); } -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; struct _ObClient *ft; @@ -246,8 +246,8 @@ static void i_post_func(gpointer options) TRUE, o->cancel); if (ft) - actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY, - o->state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); + action_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY, + o->state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); stacking_restore(); } diff --git a/openbox/actions/debug.c b/openbox/actions/debug.c index 2ffd4f6e..6f729205 100644 --- a/openbox/actions/debug.c +++ b/openbox/actions/debug.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include typedef struct { @@ -8,23 +8,23 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_debug_startup(void) { - actions_register("Debug", setup_func, free_func, run_func); + action_register("Debug", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "string"); - if (v && actions_value_is_string(v)) - o->str = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->str = g_strdup(action_value_string(v)); return o; } @@ -36,7 +36,7 @@ static void free_func(gpointer options) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; diff --git a/openbox/actions/decorations.c b/openbox/actions/decorations.c index f6fd2cbe..dd80122a 100644 --- a/openbox/actions/decorations.c +++ b/openbox/actions/decorations.c @@ -1,46 +1,46 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func_on(ObActionsData *data, gpointer options); -static gboolean run_func_off(ObActionsData *data, gpointer options); -static gboolean run_func_toggle(ObActionsData *data, gpointer options); +static gboolean run_func_on(ObActionData *data, gpointer options); +static gboolean run_func_off(ObActionData *data, gpointer options); +static gboolean run_func_toggle(ObActionData *data, gpointer options); void action_decorations_startup(void) { - actions_register("Decorate", NULL, NULL, run_func_on); - actions_register("Undecorate", NULL, NULL, run_func_off); - actions_register("ToggleDecorations", NULL, NULL, run_func_toggle); + action_register("Decorate", NULL, NULL, run_func_on); + action_register("Undecorate", NULL, NULL, run_func_off); + action_register("ToggleDecorations", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */ -static gboolean run_func_on(ObActionsData *data, gpointer options) +static gboolean run_func_on(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_set_undecorated(data->client, FALSE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_off(ObActionsData *data, gpointer options) +static gboolean run_func_off(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_set_undecorated(data->client, TRUE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_toggle(ObActionsData *data, gpointer options) +static gboolean run_func_toggle(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_set_undecorated(data->client, !data->client->undecorated); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c index 863ab4a9..4d365be6 100644 --- a/openbox/actions/desktop.c +++ b/openbox/actions/desktop.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/screen.h" #include "openbox/client.h" #include "openbox/openbox.h" @@ -31,17 +31,17 @@ typedef struct { } Options; static gpointer setup_go_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post); static gpointer setup_send_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); static gboolean i_pre_func(guint state, gpointer options); static gboolean i_input_func(guint initial_state, @@ -54,17 +54,17 @@ static void i_post_func(gpointer options); void action_desktop_startup(void) { - actions_register_i("GoToDesktop", setup_go_func, free_func, run_func); - actions_register_i("SendToDesktop", setup_send_func, free_func, run_func); + action_register_i("GoToDesktop", setup_go_func, free_func, run_func); + action_register_i("SendToDesktop", setup_send_func, free_func, run_func); } static gpointer setup_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); @@ -75,8 +75,8 @@ static gpointer setup_func(GHashTable *config, o->u.rel.wrap = TRUE; v = g_hash_table_lookup(config, "to"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "last")) o->type = LAST; else if (!g_ascii_strcasecmp(s, "current")) @@ -118,18 +118,18 @@ static gpointer setup_func(GHashTable *config, } v = g_hash_table_lookup(config, "wrap"); - if (v && actions_value_is_string(v)) - o->u.rel.wrap = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->u.rel.wrap = action_value_bool(v); return o; } static gpointer setup_go_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { Options *o; @@ -145,12 +145,12 @@ static gpointer setup_go_func(GHashTable *config, } static gpointer setup_send_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = setup_func(config, pre, input, cancel, post); @@ -158,8 +158,8 @@ static gpointer setup_send_func(GHashTable *config, o->follow = TRUE; v = g_hash_table_lookup(config, "follow"); - if (v && actions_value_is_string(v)) - o->follow = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->follow = action_value_bool(v); if (o->type == RELATIVE && o->follow) { o->interactive = TRUE; @@ -176,7 +176,7 @@ static void free_func(gpointer o) g_slice_free(Options, o); } -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; guint d; @@ -204,7 +204,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) (data->client && data->client->desktop != screen_desktop))) { gboolean go = TRUE; - actions_client_move(data, TRUE); + action_client_move(data, TRUE); if (o->send && data->client && client_normal(data->client)) { client_set_desktop(data->client, d, o->follow, FALSE); go = o->follow; @@ -216,7 +216,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) client_bring_helper_windows(data->client); } - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return o->interactive; diff --git a/openbox/actions/directionalwindows.c b/openbox/actions/directionalwindows.c index 857a9ad0..aa416d0e 100644 --- a/openbox/actions/directionalwindows.c +++ b/openbox/actions/directionalwindows.c @@ -1,7 +1,7 @@ -#include "openbox/actions.h" -#include "openbox/actions_list.h" -#include "openbox/actions_parser.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_list.h" +#include "openbox/action_parser.h" +#include "openbox/action_value.h" #include "openbox/event.h" #include "openbox/stacking.h" #include "openbox/window.h" @@ -19,20 +19,20 @@ typedef struct { ObDirection direction; gboolean bar; gboolean raise; - ObActionsList *actions; + ObActionList *actions; } Options; static gboolean cycling = FALSE; static gpointer setup_func(GHashTable *config); static gpointer setup_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post); + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post); static gpointer setup_target_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); static gboolean i_input_func(guint initial_state, XEvent *e, ObtIC *ic, @@ -42,100 +42,17 @@ static void i_cancel_func(gpointer options); static void end_cycle(gboolean cancel, guint state, Options *o); -/* 3.4-compatibility */ -static gpointer setup_north_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_south_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_east_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_west_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_northwest_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_northeast_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_southwest_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_southeast_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *in, - ObActionsICancelFunc *c, - ObActionsIPostFunc *post); -static gpointer setup_north_target_func(GHashTable *config); -static gpointer setup_south_target_func(GHashTable *config); -static gpointer setup_east_target_func(GHashTable *config); -static gpointer setup_west_target_func(GHashTable *config); -static gpointer setup_northwest_target_func(GHashTable *config); -static gpointer setup_northeast_target_func(GHashTable *config); -static gpointer setup_southwest_target_func(GHashTable *config); -static gpointer setup_southeast_target_func(GHashTable *config); - void action_directionalwindows_startup(void) { - actions_register_i("DirectionalCycleWindows", setup_cycle_func, free_func, - run_func); - actions_register("DirectionalTargetWindow", setup_target_func, free_func, - run_func); - /* 3.4-compatibility */ - actions_register_i("DirectionalFocusNorth", setup_north_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusSouth", setup_south_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusWest", setup_west_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusEast", setup_east_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusNorthWest", setup_northwest_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusNorthEast", setup_northeast_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusSouthWest", setup_southwest_cycle_func, - free_func, run_func); - actions_register_i("DirectionalFocusSouthEast", setup_southeast_cycle_func, - free_func, run_func); - actions_register("DirectionalTargetNorth", setup_north_target_func, - free_func, run_func); - actions_register("DirectionalTargetSouth", setup_south_target_func, - free_func, run_func); - actions_register("DirectionalTargetWest", setup_west_target_func, - free_func, run_func); - actions_register("DirectionalTargetEast", setup_east_target_func, - free_func, run_func); - actions_register("DirectionalTargetNorthWest", setup_northwest_target_func, - free_func, run_func); - actions_register("DirectionalTargetNorthEast", setup_northeast_target_func, - free_func, run_func); - actions_register("DirectionalTargetSouthWest", setup_southwest_target_func, - free_func, run_func); - actions_register("DirectionalTargetSouthEast", setup_southeast_target_func, - free_func, run_func); + action_register_i("DirectionalCycleWindows", setup_cycle_func, free_func, + run_func); + action_register("DirectionalTargetWindow", setup_target_func, free_func, + run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); @@ -143,23 +60,23 @@ static gpointer setup_func(GHashTable *config) o->bar = TRUE; v = g_hash_table_lookup(config, "dialog"); - if (v && actions_value_is_string(v)) - o->dialog = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->dialog = action_value_bool(v); v = g_hash_table_lookup(config, "bar"); - if (v && actions_value_is_string(v)) - o->bar = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->bar = action_value_bool(v); v = g_hash_table_lookup(config, "raise"); - if (v && actions_value_is_string(v)) - o->raise = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->raise = action_value_bool(v); v = g_hash_table_lookup(config, "panels"); - if (v && actions_value_is_string(v)) - o->dock_windows = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->dock_windows = action_value_bool(v); v = g_hash_table_lookup(config, "desktop"); - if (v && actions_value_is_string(v)) - o->desktop_windows = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->desktop_windows = action_value_bool(v); v = g_hash_table_lookup(config, "direction"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->direction = OB_DIRECTION_NORTH; @@ -183,27 +100,27 @@ static gpointer setup_func(GHashTable *config) } v = g_hash_table_lookup(config, "finalactions"); - if (v && actions_value_is_actions_list(v)) { - o->actions = actions_value_actions_list(v); - actions_list_ref(o->actions); + if (v && action_value_is_action_list(v)) { + o->actions = action_value_action_list(v); + action_list_ref(o->actions); } else { - ObActionsParser *p = actions_parser_new(); - o->actions = actions_parser_read_string(p, + ObActionParser *p = action_parser_new(); + o->actions = action_parser_read_string(p, "focus\n" "raise\n" "unshade\n"); - actions_parser_unref(p); + action_parser_unref(p); } return o; } static gpointer setup_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) + ObActionIPreFunc *pre, + ObActionIInputFunc *input, + ObActionICancelFunc *cancel, + ObActionIPostFunc *post) { Options *o = setup_func(config); o->interactive = TRUE; @@ -223,11 +140,11 @@ static void free_func(gpointer options) { Options *o = options; - actions_list_unref(o->actions); + action_list_unref(o->actions); g_slice_free(Options, o); } -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -314,154 +231,8 @@ static void end_cycle(gboolean cancel, guint state, Options *o) cycling = FALSE; if (ft) - actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY, - state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); + action_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY, + state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); stacking_restore(); } - -/* 3.4-compatibility */ -static gpointer setup_north_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_NORTH; - return o; -} - -static gpointer setup_south_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_SOUTH; - return o; -} - -static gpointer setup_east_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_EAST; - return o; -} - -static gpointer setup_west_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_WEST; - return o; -} - -static gpointer setup_northwest_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_NORTHWEST; - return o; -} - -static gpointer setup_northeast_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_EAST; - return o; -} - -static gpointer setup_southwest_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_SOUTHWEST; - return o; -} - -static gpointer setup_southeast_cycle_func(GHashTable *config, - ObActionsIPreFunc *pre, - ObActionsIInputFunc *input, - ObActionsICancelFunc *cancel, - ObActionsIPostFunc *post) -{ - Options *o = setup_cycle_func(config, pre, input, cancel, post); - o->direction = OB_DIRECTION_SOUTHEAST; - return o; -} - -static gpointer setup_north_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_NORTH; - return o; -} - -static gpointer setup_south_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_SOUTH; - return o; -} - -static gpointer setup_east_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_EAST; - return o; -} - -static gpointer setup_west_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_WEST; - return o; -} - -static gpointer setup_northwest_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_NORTHWEST; - return o; -} - -static gpointer setup_northeast_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_NORTHEAST; - return o; -} - -static gpointer setup_southwest_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_SOUTHWEST; - return o; -} - -static gpointer setup_southeast_target_func(GHashTable *config) -{ - Options *o = setup_target_func(config); - o->direction = OB_DIRECTION_SOUTHEAST; - return o; -} - diff --git a/openbox/actions/dock.c b/openbox/actions/dock.c index a1f68373..730e61cc 100644 --- a/openbox/actions/dock.c +++ b/openbox/actions/dock.c @@ -1,37 +1,33 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/stacking.h" #include "openbox/window.h" #include "openbox/dock.h" -static gboolean raise_func(ObActionsData *data, gpointer options); -static gboolean lower_func(ObActionsData *data, gpointer options); +static gboolean raise_func(ObActionData *data, gpointer options); +static gboolean lower_func(ObActionData *data, gpointer options); void action_dock_startup(void) { - actions_register("RaiseDock", - NULL, NULL, - raise_func); - actions_register("LowerDock", - NULL, NULL, - lower_func); + action_register("RaiseDock", NULL, NULL, raise_func); + action_register("LowerDock", NULL, NULL, lower_func); } /* Always return FALSE because its not interactive */ -static gboolean raise_func(ObActionsData *data, gpointer options) +static gboolean raise_func(ObActionData *data, gpointer options) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); dock_raise_dock(); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean lower_func(ObActionsData *data, gpointer options) +static gboolean lower_func(ObActionData *data, gpointer options) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); dock_lower_dock(); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); return FALSE; } diff --git a/openbox/actions/dockautohide.c b/openbox/actions/dockautohide.c index 4a750b2c..2ade0278 100644 --- a/openbox/actions/dockautohide.c +++ b/openbox/actions/dockautohide.c @@ -1,18 +1,16 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/dock.h" #include "openbox/config.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_dockautohide_startup(void) { - actions_register("ToggleDockAutoHide", - NULL, NULL, - run_func); + action_register("ToggleDockAutoHide", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { config_dock_hide = !config_dock_hide; dock_configure(); diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index c995829a..64945a1a 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/event.h" #include "openbox/startupnotify.h" #include "openbox/client.h" @@ -19,12 +19,12 @@ typedef struct { gchar *sn_icon; gchar *sn_wmclass; gchar *prompt; - ObActionsData *data; + ObActionData *data; } Options; static gpointer setup_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); static void shutdown_func(void); static void client_dest(ObClient *client, gpointer data); @@ -32,8 +32,8 @@ static GSList *prompt_opts = NULL; void action_execute_startup(void) { - actions_register("Execute", setup_func, free_func, run_func); - actions_set_shutdown("Execute", shutdown_func); + action_register("Execute", setup_func, free_func, run_func); + action_set_shutdown("Execute", shutdown_func); client_add_destroy_notify(client_dest, NULL); } @@ -51,31 +51,31 @@ static void client_dest(ObClient *client, gpointer data) static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "command"); - if (v && actions_value_is_string(v)) - o->cmd = obt_paths_expand_tilde(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->cmd = obt_paths_expand_tilde(action_value_string(v)); v = g_hash_table_lookup(config, "prompt"); - if (v && actions_value_is_string(v)) - o->prompt = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->prompt = g_strdup(action_value_string(v)); v = g_hash_table_lookup(config, "startupnotify"); - if (v && actions_value_is_string(v) && actions_value_bool(v)) { + if (v && action_value_is_string(v) && action_value_bool(v)) { o->sn = TRUE; v = g_hash_table_lookup(config, "name"); - if (v && actions_value_is_string(v)) - o->sn_name = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->sn_name = g_strdup(action_value_string(v)); v = g_hash_table_lookup(config, "icon"); - if (v && actions_value_is_string(v)) - o->sn_icon = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->sn_icon = g_strdup(action_value_string(v)); v = g_hash_table_lookup(config, "wmclass"); - if (v && actions_value_is_string(v)) - o->sn_wmclass = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->sn_wmclass = g_strdup(action_value_string(v)); } return o; } @@ -97,12 +97,12 @@ static void free_func(gpointer options) g_free(o->sn_icon); g_free(o->sn_wmclass); g_free(o->prompt); - if (o->data) g_slice_free(ObActionsData, o->data); + if (o->data) g_slice_free(ObActionData, o->data); g_slice_free(Options, o); } } -static Options* dup_options(Options *in, ObActionsData *data) +static Options* dup_options(Options *in, ObActionData *data) { Options *o = g_slice_new(Options); o->cmd = g_strdup(in->cmd); @@ -111,8 +111,8 @@ static Options* dup_options(Options *in, ObActionsData *data) o->sn_icon = g_strdup(in->sn_icon); o->sn_wmclass = g_strdup(in->sn_wmclass); o->prompt = NULL; - o->data = g_slice_new(ObActionsData); - memcpy(o->data, data, sizeof(ObActionsData)); + o->data = g_slice_new(ObActionData); + memcpy(o->data, data, sizeof(ObActionData)); return o; } @@ -131,7 +131,7 @@ static void prompt_cleanup(ObPrompt *p, gpointer options) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { GError *e; gchar **argv = NULL; diff --git a/openbox/actions/exit.c b/openbox/actions/exit.c index f2785014..25d410e7 100644 --- a/openbox/actions/exit.c +++ b/openbox/actions/exit.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/openbox.h" #include "openbox/prompt.h" #include "openbox/session.h" @@ -11,25 +11,24 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_exit_startup(void) { - actions_register("Exit", setup_func, free_func, run_func); - actions_register("SessionLogout", setup_func, free_func, run_func); + action_register("Exit", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); o->prompt = TRUE; v = g_hash_table_lookup(config, "prompt"); - if (v && actions_value_is_string(v)) - o->prompt = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->prompt = action_value_bool(v); return o; } @@ -61,7 +60,7 @@ static void prompt_cleanup(ObPrompt *p, gpointer data) /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c index e5e5cc53..01d367c4 100644 --- a/openbox/actions/focus.c +++ b/openbox/actions/focus.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/event.h" #include "openbox/client.h" #include "openbox/focus.h" @@ -12,27 +12,27 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_focus_startup(void) { - actions_register("Focus", setup_func, free_func, run_func); + action_register("Focus", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); o->stop_int = TRUE; v = g_hash_table_lookup(config, "here"); - if (v && actions_value_is_string(v)) - o->here = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->here = action_value_bool(v); v = g_hash_table_lookup(config, "stopInteractive"); - if (v && actions_value_is_string(v)) - o->stop_int = actions_value_bool(v); + if (v && action_value_is_string(v)) + o->stop_int = action_value_bool(v); return o; } @@ -42,7 +42,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -58,15 +58,15 @@ static gboolean run_func(ObActionsData *data, gpointer options) data->context != OB_FRAME_CONTEXT_FRAME)) { if (o->stop_int) - actions_interactive_cancel_act(); + action_interactive_cancel_act(); - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) { if (o->stop_int) - actions_interactive_cancel_act(); + action_interactive_cancel_act(); /* focus action on the root window. make keybindings work for this openbox instance, but don't focus any specific client */ diff --git a/openbox/actions/focustobottom.c b/openbox/actions/focustobottom.c index a3e5b5ac..17d635af 100644 --- a/openbox/actions/focustobottom.c +++ b/openbox/actions/focustobottom.c @@ -1,15 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/focus.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_focustobottom_startup(void) { - actions_register("FocusToBottom", NULL, NULL, run_func); + action_register("FocusToBottom", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) focus_order_to_bottom(data->client); diff --git a/openbox/actions/fullscreen.c b/openbox/actions/fullscreen.c index e1fdf232..9072c8c2 100644 --- a/openbox/actions/fullscreen.c +++ b/openbox/actions/fullscreen.c @@ -1,20 +1,20 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func_toggle(ObActionsData *data, gpointer options); +static gboolean run_func_toggle(ObActionData *data, gpointer options); void action_fullscreen_startup(void) { - actions_register("ToggleFullscreen", NULL, NULL, run_func_toggle); + action_register("ToggleFullscreen", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */ -static gboolean run_func_toggle(ObActionsData *data, gpointer options) +static gboolean run_func_toggle(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_fullscreen(data->client, !data->client->fullscreen); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } diff --git a/openbox/actions/growtoedge.c b/openbox/actions/growtoedge.c index d7618321..c43e33e6 100644 --- a/openbox/actions/growtoedge.c +++ b/openbox/actions/growtoedge.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/misc.h" #include "openbox/client.h" #include "openbox/frame.h" @@ -14,29 +14,17 @@ typedef struct { static gpointer setup_func(GHashTable *config); static gpointer setup_shrink_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); -/* 3.4-compatibility */ -static gpointer setup_north_func(GHashTable *config); -static gpointer setup_south_func(GHashTable *config); -static gpointer setup_east_func(GHashTable *config); -static gpointer setup_west_func(GHashTable *config); +static gboolean run_func(ObActionData *data, gpointer options); void action_growtoedge_startup(void) { - actions_register("GrowToEdge", setup_func, - free_func, run_func); - actions_register("ShrinkToEdge", setup_shrink_func, - free_func, run_func); - /* 3.4-compatibility */ - actions_register("GrowToEdgeNorth", setup_north_func, free_func, run_func); - actions_register("GrowToEdgeSouth", setup_south_func, free_func, run_func); - actions_register("GrowToEdgeEast", setup_east_func, free_func, run_func); - actions_register("GrowToEdgeWest", setup_west_func, free_func, run_func); + action_register("GrowToEdge", setup_func, free_func, run_func); + action_register("ShrinkToEdge", setup_shrink_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); @@ -44,8 +32,8 @@ static gpointer setup_func(GHashTable *config) o->shrink = FALSE; v = g_hash_table_lookup(config, "direction"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->dir = OB_DIRECTION_NORTH; @@ -73,7 +61,7 @@ static gpointer setup_shrink_func(GHashTable *config) return o; } -static gboolean do_grow(ObActionsData *data, gint x, gint y, gint w, gint h) +static gboolean do_grow(ObActionData *data, gint x, gint y, gint w, gint h) { gint realw, realh, lw, lh; @@ -90,9 +78,9 @@ static gboolean do_grow(ObActionsData *data, gint x, gint y, gint w, gint h) realw != data->client->area.width || realh != data->client->area.height) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_move_resize(data->client, x, y, realw, realh); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); return TRUE; } return FALSE; @@ -104,7 +92,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; gint x, y, w, h; @@ -166,36 +154,3 @@ static gboolean run_func(ObActionsData *data, gpointer options) return FALSE; } - -/* 3.4-compatibility */ -static gpointer setup_north_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->shrink = FALSE; - o->dir = OB_DIRECTION_NORTH; - return o; -} - -static gpointer setup_south_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->shrink = FALSE; - o->dir = OB_DIRECTION_SOUTH; - return o; -} - -static gpointer setup_east_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->shrink = FALSE; - o->dir = OB_DIRECTION_EAST; - return o; -} - -static gpointer setup_west_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->shrink = FALSE; - o->dir = OB_DIRECTION_WEST; - return o; -} diff --git a/openbox/actions/iconify.c b/openbox/actions/iconify.c index e6bdbb7b..7179a788 100644 --- a/openbox/actions/iconify.c +++ b/openbox/actions/iconify.c @@ -1,22 +1,20 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_iconify_startup(void) { - actions_register("Iconify", - NULL, NULL, - run_func); + action_register("Iconify", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_iconify(data->client, TRUE, TRUE, FALSE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/kill.c b/openbox/actions/kill.c index b7d547b9..d0b31a15 100644 --- a/openbox/actions/kill.c +++ b/openbox/actions/kill.c @@ -1,17 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_kill_startup(void) { - actions_register("Kill", - NULL, NULL, - run_func); + action_register("Kill", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) client_kill(data->client); diff --git a/openbox/actions/layer.c b/openbox/actions/layer.c index 7baa5ab0..ff183205 100644 --- a/openbox/actions/layer.c +++ b/openbox/actions/layer.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/client.h" typedef struct { @@ -11,27 +11,16 @@ static gpointer setup_func_top(GHashTable *config); static gpointer setup_func_bottom(GHashTable *config); static gpointer setup_func_send(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); -/* 3.4-compatibility */ -static gpointer setup_sendtop_func(GHashTable *config); -static gpointer setup_sendbottom_func(GHashTable *config); -static gpointer setup_sendnormal_func(GHashTable *config); +static gboolean run_func(ObActionData *data, gpointer options); void action_layer_startup(void) { - actions_register("ToggleAlwaysOnTop", setup_func_top, free_func, - run_func); - actions_register("ToggleAlwaysOnBottom", setup_func_bottom, free_func, - run_func); - actions_register("SendToLayer", setup_func_send, free_func, - run_func); - /* 3.4-compatibility */ - actions_register("SendToTopLayer", setup_sendtop_func, free_func, - run_func); - actions_register("SendToBottomLayer", setup_sendbottom_func, free_func, - run_func); - actions_register("SendToNormalLayer", setup_sendnormal_func, free_func, - run_func); + action_register("ToggleAlwaysOnTop", setup_func_top, free_func, + run_func); + action_register("ToggleAlwaysOnBottom", setup_func_bottom, free_func, + run_func); + action_register("SendToLayer", setup_func_send, free_func, + run_func); } static gpointer setup_func_top(GHashTable *config) @@ -52,14 +41,14 @@ static gpointer setup_func_bottom(GHashTable *config) static gpointer setup_func_send(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "layer"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "above") || !g_ascii_strcasecmp(s, "top")) o->layer = 1; @@ -80,14 +69,14 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; if (data->client) { ObClient *c = data->client; - actions_client_move(data, TRUE); + action_client_move(data, TRUE); if (o->layer < 0) { if (o->toggle || !c->below) @@ -100,34 +89,8 @@ static gboolean run_func(ObActionsData *data, gpointer options) else if (c->above || c->below) client_set_layer(c, 0); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } - -/* 3.4-compatibility */ -static gpointer setup_sendtop_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->layer = 1; - o->toggle = FALSE; - return o; -} - -static gpointer setup_sendbottom_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->layer = -1; - o->toggle = FALSE; - return o; -} - -static gpointer setup_sendnormal_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->layer = 0; - o->toggle = FALSE; - return o; -} - diff --git a/openbox/actions/lower.c b/openbox/actions/lower.c index 80ca6b8b..b08e6d91 100644 --- a/openbox/actions/lower.c +++ b/openbox/actions/lower.c @@ -1,23 +1,21 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/stacking.h" #include "openbox/window.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_lower_startup(void) { - actions_register("Lower", - NULL, NULL, - run_func); + action_register("Lower", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); stacking_lower(CLIENT_AS_WINDOW(data->client)); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/maximize.c b/openbox/actions/maximize.c index 2bb6a62b..4854492f 100644 --- a/openbox/actions/maximize.c +++ b/openbox/actions/maximize.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/client.h" /* These match the values for client_maximize */ @@ -15,28 +15,28 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func_on(ObActionsData *data, gpointer options); -static gboolean run_func_off(ObActionsData *data, gpointer options); -static gboolean run_func_toggle(ObActionsData *data, gpointer options); +static gboolean run_func_on(ObActionData *data, gpointer options); +static gboolean run_func_off(ObActionData *data, gpointer options); +static gboolean run_func_toggle(ObActionData *data, gpointer options); void action_maximize_startup(void) { - actions_register("Maximize", setup_func, free_func, run_func_on); - actions_register("Unmaximize", setup_func, free_func, run_func_off); - actions_register("ToggleMaximize", setup_func, free_func, run_func_toggle); + action_register("Maximize", setup_func, free_func, run_func_on); + action_register("Unmaximize", setup_func, free_func, run_func_off); + action_register("ToggleMaximize", setup_func, free_func, run_func_toggle); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); o->dir = BOTH; v = g_hash_table_lookup(config, "dir"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "vertical") || !g_ascii_strcasecmp(s, "vert")) o->dir = VERT; @@ -54,42 +54,42 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func_on(ObActionsData *data, gpointer options) +static gboolean run_func_on(ObActionData *data, gpointer options) { Options *o = options; if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_maximize(data->client, TRUE, o->dir); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_off(ObActionsData *data, gpointer options) +static gboolean run_func_off(ObActionData *data, gpointer options) { Options *o = options; if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_maximize(data->client, FALSE, o->dir); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_toggle(ObActionsData *data, gpointer options) +static gboolean run_func_toggle(ObActionData *data, gpointer options) { Options *o = options; if (data->client) { gboolean toggle; - actions_client_move(data, TRUE); + action_client_move(data, TRUE); toggle = ((o->dir == HORZ && !data->client->max_horz) || (o->dir == VERT && !data->client->max_vert) || (o->dir == BOTH && !(data->client->max_horz && data->client->max_vert))); client_maximize(data->client, toggle, o->dir); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } diff --git a/openbox/actions/move.c b/openbox/actions/move.c index ba8372a5..14778caf 100644 --- a/openbox/actions/move.c +++ b/openbox/actions/move.c @@ -1,18 +1,16 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/moveresize.h" #include "obt/prop.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_move_startup(void) { - actions_register("Move", - NULL, NULL, - run_func); + action_register("Move", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) { guint32 corner; diff --git a/openbox/actions/moverelative.c b/openbox/actions/moverelative.c index 4b3a0c5a..059a5cf5 100644 --- a/openbox/actions/moverelative.c +++ b/openbox/actions/moverelative.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/client.h" #include "openbox/screen.h" #include "openbox/frame.h" @@ -14,26 +14,26 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_moverelative_startup(void) { - actions_register("MoveRelative", setup_func, free_func, run_func); + action_register("MoveRelative", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "x"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->x, &o->x_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->x, &o->x_denom); v = g_hash_table_lookup(config, "y"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->y, &o->y_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->y, &o->y_denom); return o; } @@ -44,7 +44,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -71,9 +71,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE); client_find_onscreen(c, &x, &y, w, h, FALSE); - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_configure(c, x, y, w, h, TRUE, TRUE, FALSE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index 410fc709..c443a7a3 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/client.h" #include "openbox/screen.h" #include "openbox/frame.h" @@ -24,20 +24,16 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); -/* 3.4-compatibility */ -static gpointer setup_center_func(GHashTable *config); +static gboolean run_func(ObActionData *data, gpointer options); void action_moveresizeto_startup(void) { - actions_register("MoveResizeTo", setup_func, free_func, run_func); - /* 3.4-compatibility */ - actions_register("MoveToCenter", setup_center_func, free_func, run_func); + action_register("MoveResizeTo", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); @@ -48,24 +44,24 @@ static gpointer setup_func(GHashTable *config) o->monitor = CURRENT_MONITOR; v = g_hash_table_lookup(config, "x"); - if (v && actions_value_is_string(v)) - actions_value_gravity_coord(v, &o->x); + if (v && action_value_is_string(v)) + action_value_gravity_coord(v, &o->x); v = g_hash_table_lookup(config, "y"); - if (v && actions_value_is_string(v)) - actions_value_gravity_coord(v, &o->y); + if (v && action_value_is_string(v)) + action_value_gravity_coord(v, &o->y); v = g_hash_table_lookup(config, "width"); - if (v && actions_value_is_string(v)) - if (g_ascii_strcasecmp(actions_value_string(v), "current") != 0) - actions_value_fraction(v, &o->w, &o->w_denom); + if (v && action_value_is_string(v)) + if (g_ascii_strcasecmp(action_value_string(v), "current") != 0) + action_value_fraction(v, &o->w, &o->w_denom); v = g_hash_table_lookup(config, "height"); - if (v && actions_value_is_string(v)) - if (g_ascii_strcasecmp(actions_value_string(v), "current") != 0) - actions_value_fraction(v, &o->h, &o->h_denom); + if (v && action_value_is_string(v)) + if (g_ascii_strcasecmp(action_value_string(v), "current") != 0) + action_value_fraction(v, &o->h, &o->h_denom); v = g_hash_table_lookup(config, "monitor"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (g_ascii_strcasecmp(s, "current") != 0) { if (!g_ascii_strcasecmp(s, "all")) o->monitor = ALL_MONITORS; @@ -74,7 +70,7 @@ static gpointer setup_func(GHashTable *config) else if(!g_ascii_strcasecmp(s, "prev")) o->monitor = PREV_MONITOR; else - o->monitor = actions_value_int(v) - 1; + o->monitor = action_value_int(v) - 1; } } @@ -87,7 +83,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -159,9 +155,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) /* force it on screen if its moving to another monitor */ client_find_onscreen(c, &x, &y, w, h, mon != cmon); - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_configure(c, x, y, w, h, TRUE, TRUE, FALSE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); g_slice_free(Rect, area); g_slice_free(Rect, carea); @@ -169,19 +165,3 @@ static gboolean run_func(ObActionsData *data, gpointer options) return FALSE; } - -/* 3.4-compatibility */ -static gpointer setup_center_func(GHashTable *config) -{ - Options *o; - - o = g_slice_new0(Options); - o->x.pos = G_MININT; - o->y.pos = G_MININT; - o->w = G_MININT; - o->h = G_MININT; - o->monitor = -1; - o->x.center = TRUE; - o->y.center = TRUE; - return o; -} diff --git a/openbox/actions/movetoedge.c b/openbox/actions/movetoedge.c index cff299ec..809c54ed 100644 --- a/openbox/actions/movetoedge.c +++ b/openbox/actions/movetoedge.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/misc.h" #include "openbox/client.h" #include "openbox/frame.h" @@ -12,34 +12,24 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); -/* 3.4-compatibility */ -static gpointer setup_north_func(GHashTable *config); -static gpointer setup_south_func(GHashTable *config); -static gpointer setup_east_func(GHashTable *config); -static gpointer setup_west_func(GHashTable *config); +static gboolean run_func(ObActionData *data, gpointer options); void action_movetoedge_startup(void) { - actions_register("MoveToEdge", setup_func, free_func, run_func); - /* 3.4-compatibility */ - actions_register("MoveToEdgeNorth", setup_north_func, free_func, run_func); - actions_register("MoveToEdgeSouth", setup_south_func, free_func, run_func); - actions_register("MoveToEdgeEast", setup_east_func, free_func, run_func); - actions_register("MoveToEdgeWest", setup_west_func, free_func, run_func); + action_register("MoveToEdge", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); o->dir = OB_DIRECTION_NORTH; v = g_hash_table_lookup(config, "direction"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); if (!g_ascii_strcasecmp(s, "north") || !g_ascii_strcasecmp(s, "up")) o->dir = OB_DIRECTION_NORTH; @@ -63,7 +53,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -72,41 +62,11 @@ static gboolean run_func(ObActionsData *data, gpointer options) client_find_move_directional(data->client, o->dir, &x, &y); if (x != data->client->area.x || y != data->client->area.y) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_move(data->client, x, y); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } } return FALSE; } - -/* 3.4-compatibility */ -static gpointer setup_north_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->dir = OB_DIRECTION_NORTH; - return o; -} - -static gpointer setup_south_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->dir = OB_DIRECTION_SOUTH; - return o; -} - -static gpointer setup_east_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->dir = OB_DIRECTION_EAST; - return o; -} - -static gpointer setup_west_func(GHashTable *config) -{ - Options *o = g_slice_new0(Options); - o->dir = OB_DIRECTION_WEST; - return o; -} - diff --git a/openbox/actions/omnipresent.c b/openbox/actions/omnipresent.c index 4309acc6..042e3bd0 100644 --- a/openbox/actions/omnipresent.c +++ b/openbox/actions/omnipresent.c @@ -1,23 +1,23 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" #include "openbox/screen.h" -static gboolean run_func_toggle(ObActionsData *data, gpointer options); +static gboolean run_func_toggle(ObActionData *data, gpointer options); void action_omnipresent_startup(void) { - actions_register("ToggleOmnipresent", NULL, NULL, run_func_toggle); + action_register("ToggleOmnipresent", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */ -static gboolean run_func_toggle(ObActionsData *data, gpointer options) +static gboolean run_func_toggle(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_set_desktop(data->client, data->client->desktop == DESKTOP_ALL ? screen_desktop : DESKTOP_ALL, FALSE, TRUE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } diff --git a/openbox/actions/raise.c b/openbox/actions/raise.c index f6ac1452..272b3da6 100644 --- a/openbox/actions/raise.c +++ b/openbox/actions/raise.c @@ -1,21 +1,21 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/stacking.h" #include "openbox/window.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_raise_startup(void) { - actions_register("Raise", NULL, NULL, run_func); + action_register("Raise", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); stacking_raise(CLIENT_AS_WINDOW(data->client)); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/raiselower.c b/openbox/actions/raiselower.c index dbe41d85..2e7fbc33 100644 --- a/openbox/actions/raiselower.c +++ b/openbox/actions/raiselower.c @@ -1,20 +1,20 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/stacking.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_raiselower_startup(void) { - actions_register("RaiseLower", NULL, NULL, run_func); + action_register("RaiseLower", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); stacking_restack_request(data->client, NULL, Opposite); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/reconfigure.c b/openbox/actions/reconfigure.c index 813a1221..22f104e3 100644 --- a/openbox/actions/reconfigure.c +++ b/openbox/actions/reconfigure.c @@ -1,15 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/openbox.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_reconfigure_startup(void) { - actions_register("Reconfigure", NULL, NULL, run_func); + action_register("Reconfigure", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { ob_reconfigure(); diff --git a/openbox/actions/resize.c b/openbox/actions/resize.c index 5d6054d8..b6b9487e 100644 --- a/openbox/actions/resize.c +++ b/openbox/actions/resize.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/moveresize.h" #include "openbox/client.h" #include "openbox/frame.h" @@ -12,26 +12,26 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer o); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch, gboolean shaded); void action_resize_startup(void) { - actions_register("Resize", setup_func, free_func, run_func); + action_register("Resize", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "edge"); - if (v && actions_value_is_string(v)) { - const gchar *s = actions_value_string(v); + if (v && action_value_is_string(v)) { + const gchar *s = action_value_string(v); o->corner_specified = TRUE; if (!g_ascii_strcasecmp(s, "top")) @@ -62,7 +62,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; diff --git a/openbox/actions/resizerelative.c b/openbox/actions/resizerelative.c index 98b3c5e0..10adaf21 100644 --- a/openbox/actions/resizerelative.c +++ b/openbox/actions/resizerelative.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/client.h" #include "openbox/screen.h" #include "openbox/frame.h" @@ -18,32 +18,32 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_resizerelative_startup(void) { - actions_register("ResizeRelative", setup_func, free_func, run_func); + action_register("ResizeRelative", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "left"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->left, &o->left_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->left, &o->left_denom); v = g_hash_table_lookup(config, "right"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->right, &o->right_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->right, &o->right_denom); v = g_hash_table_lookup(config, "top"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->top, &o->top_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->top, &o->top_denom); v = g_hash_table_lookup(config, "bottom"); - if (v && actions_value_is_string(v)) - actions_value_fraction(v, &o->bottom, &o->bottom_denom); + if (v && action_value_is_string(v)) + action_value_fraction(v, &o->bottom, &o->bottom_denom); return o; } @@ -54,7 +54,7 @@ static void free_func(gpointer o) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; @@ -90,9 +90,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) yoff = yoff == 0 ? 0 : (yoff < 0 ? MAX(yoff, oh-nh) : MIN(yoff, oh-nh)); - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_move_resize(c, x + xoff, y + yoff, nw, nh); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; diff --git a/openbox/actions/restart.c b/openbox/actions/restart.c index 7387ba83..94b5934d 100644 --- a/openbox/actions/restart.c +++ b/openbox/actions/restart.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/openbox.h" #include "obt/paths.h" @@ -9,23 +9,23 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_restart_startup(void) { - actions_register("Restart", setup_func, free_func, run_func); + action_register("Restart", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "command"); - if (v && actions_value_is_string(v)) - o->cmd = obt_paths_expand_tilde(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->cmd = obt_paths_expand_tilde(action_value_string(v)); return o; } @@ -37,7 +37,7 @@ static void free_func(gpointer options) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; diff --git a/openbox/actions/shade.c b/openbox/actions/shade.c index 502781dd..5e8da07b 100644 --- a/openbox/actions/shade.c +++ b/openbox/actions/shade.c @@ -1,46 +1,46 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/client.h" -static gboolean run_func_on(ObActionsData *data, gpointer options); -static gboolean run_func_off(ObActionsData *data, gpointer options); -static gboolean run_func_toggle(ObActionsData *data, gpointer options); +static gboolean run_func_on(ObActionData *data, gpointer options); +static gboolean run_func_off(ObActionData *data, gpointer options); +static gboolean run_func_toggle(ObActionData *data, gpointer options); void action_shade_startup(void) { - actions_register("Shade", NULL, NULL, run_func_on); - actions_register("Unshade", NULL, NULL, run_func_off); - actions_register("ToggleShade", NULL, NULL, run_func_toggle); + action_register("Shade", NULL, NULL, run_func_on); + action_register("Unshade", NULL, NULL, run_func_off); + action_register("ToggleShade", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */ -static gboolean run_func_on(ObActionsData *data, gpointer options) +static gboolean run_func_on(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_shade(data->client, TRUE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_off(ObActionsData *data, gpointer options) +static gboolean run_func_off(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_shade(data->client, FALSE); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } /* Always return FALSE because its not interactive */ -static gboolean run_func_toggle(ObActionsData *data, gpointer options) +static gboolean run_func_toggle(ObActionData *data, gpointer options) { if (data->client) { - actions_client_move(data, TRUE); + action_client_move(data, TRUE); client_shade(data->client, !data->client->shaded); - actions_client_move(data, FALSE); + action_client_move(data, FALSE); } return FALSE; } diff --git a/openbox/actions/shadelowerraise.c b/openbox/actions/shadelowerraise.c deleted file mode 100644 index 414e2817..00000000 --- a/openbox/actions/shadelowerraise.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "openbox/actions.h" -#include "openbox/client.h" - -static gboolean run_func_sl(ObActionsData *data, gpointer options); -static gboolean run_func_ur(ObActionsData *data, gpointer options); - -void action_shadelowerraise_startup() -{ - /* 3.4-compatibility */ - actions_register("ShadeLower", NULL, NULL, run_func_sl); - actions_register("UnshadeRaise", NULL, NULL, run_func_ur); -} - -/* Always return FALSE because its not interactive */ -static gboolean run_func_sl(ObActionsData *data, gpointer options) -{ - if (data->client) { - actions_client_move(data, TRUE); - if (data->client->shaded) - stacking_lower(CLIENT_AS_WINDOW(data->client)); - else - client_shade(data->client, TRUE); - actions_client_move(data, FALSE); - } - return FALSE; -} - -/* Always return FALSE because its not interactive */ -static gboolean run_func_ur(ObActionsData *data, gpointer options) -{ - if (data->client) { - actions_client_move(data, TRUE); - if (data->client->shaded) - client_shade(data->client, FALSE); - else - stacking_raise(CLIENT_AS_WINDOW(data->client)); - actions_client_move(data, FALSE); - } - return FALSE; -} diff --git a/openbox/actions/showdesktop.c b/openbox/actions/showdesktop.c index 6dc77d5e..99ca1058 100644 --- a/openbox/actions/showdesktop.c +++ b/openbox/actions/showdesktop.c @@ -1,15 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/screen.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_showdesktop_startup(void) { - actions_register("ToggleShowDesktop", NULL, NULL, run_func); + action_register("ToggleShowDesktop", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { screen_show_desktop(!screen_showing_desktop, NULL); diff --git a/openbox/actions/showmenu.c b/openbox/actions/showmenu.c index 1687f2a4..99aab19f 100644 --- a/openbox/actions/showmenu.c +++ b/openbox/actions/showmenu.c @@ -1,5 +1,5 @@ -#include "openbox/actions.h" -#include "openbox/actions_value.h" +#include "openbox/action.h" +#include "openbox/action_value.h" #include "openbox/menu.h" #include @@ -9,23 +9,23 @@ typedef struct { static gpointer setup_func(GHashTable *config); static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_showmenu_startup(void) { - actions_register("ShowMenu", setup_func, free_func, run_func); + action_register("ShowMenu", setup_func, free_func, run_func); } static gpointer setup_func(GHashTable *config) { - ObActionsValue *v; + ObActionValue *v; Options *o; o = g_slice_new0(Options); v = g_hash_table_lookup(config, "menu"); - if (v && actions_value_is_string(v)) - o->name = g_strdup(actions_value_string(v)); + if (v && action_value_is_string(v)) + o->name = g_strdup(action_value_string(v)); return o; } @@ -37,7 +37,7 @@ static void free_func(gpointer options) } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { Options *o = options; diff --git a/openbox/actions/unfocus.c b/openbox/actions/unfocus.c index 3db00ca3..b1e3335d 100644 --- a/openbox/actions/unfocus.c +++ b/openbox/actions/unfocus.c @@ -1,15 +1,15 @@ -#include "openbox/actions.h" +#include "openbox/action.h" #include "openbox/focus.h" -static gboolean run_func(ObActionsData *data, gpointer options); +static gboolean run_func(ObActionData *data, gpointer options); void action_unfocus_startup(void) { - actions_register("Unfocus", NULL, NULL, run_func); + action_register("Unfocus", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) +static gboolean run_func(ObActionData *data, gpointer options) { if (data->client && data->client == focus_client) focus_fallback(FALSE, FALSE, TRUE, FALSE); diff --git a/openbox/actions_list.h b/openbox/actions_list.h deleted file mode 100644 index 6b84666e..00000000 --- a/openbox/actions_list.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - - actions_list.h for the Openbox window manager - Copyright (c) 2011 Dana Jansens - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - See the COPYING file for a copy of the GNU General Public License. -*/ - -#include - -struct _ObActionsAct; -struct _ObActionsValue; - -typedef struct _ObActionsList ObActionsList; -typedef struct _ObActionsListTest ObActionsListTest; - -/*! Each node of the Actions list is an action itself (or a filter bound to - an action). */ -struct _ObActionsList { - gint ref; - gboolean isfilter; - union { - struct _ObActionsListFilter { - ObActionsListTest *test; /* can be null */ - ObActionsList *thendo; /* can be null */ - ObActionsList *elsedo; /* can be null */ - } f; - struct _ObActionsAct *action; - } u; - ObActionsList *next; -}; - -struct _ObActionsListTest { - gchar *key; - struct _ObActionsValue *value; /* can be null */ - gboolean and; - ObActionsListTest *next; -}; - -void actions_list_ref(ObActionsList *l); -void actions_list_unref(ObActionsList *l); - -void actions_list_test_destroy(ObActionsListTest *t); - -ObActionsList* actions_list_concat(ObActionsList *a, ObActionsList *b); diff --git a/openbox/config.c b/openbox/config.c index 8fda459d..d1a2be85 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -20,9 +20,9 @@ #include "config.h" #include "keyboard.h" #include "mouse.h" -#include "actions.h" -#include "actions_list.h" -#include "actions_parser.h" +#include "action.h" +#include "action_list.h" +#include "action_parser.h" #include "translate.h" #include "client.h" #include "screen.h" @@ -422,20 +422,20 @@ static void parse_key(xmlNodePtr node, GList *keylist) } else if ((n = obt_xml_find_node(node->children, "action"))) { while (n) { - ObActionsParser *p; - ObActionsList *actions; + ObActionParser *p; + ObActionList *actions; xmlChar *c; c = xmlNodeGetContent(node); - p = actions_parser_new(); - actions = actions_parser_read_string(p, (gchar*)c); + p = action_parser_new(); + actions = action_parser_read_string(p, (gchar*)c); xmlFree(c); - actions_parser_unref(p); + action_parser_unref(p); if (actions) keyboard_bind(keylist, actions); - actions_list_unref(actions); + action_list_unref(actions); n = obt_xml_find_node(n->next, "action"); } } @@ -546,18 +546,18 @@ static void parse_mouse(xmlNodePtr node, gpointer d) nact = obt_xml_find_node(nbut->children, "action"); while (nact) { - ObActionsList *actions; - ObActionsParser *p; + ObActionList *actions; + ObActionParser *p; xmlChar *c; c = xmlNodeGetContent(nact); - p = actions_parser_new(); - if ((actions = actions_parser_read_string(p, (gchar*)c))) + p = action_parser_new(); + if ((actions = action_parser_read_string(p, (gchar*)c))) mouse_bind(buttonstr, cx, mact, actions); nact = obt_xml_find_node(nact->next, "action"); - actions_list_unref(actions); + action_list_unref(actions); xmlFree(c); - actions_parser_unref(p); + action_parser_unref(p); } g_free(buttonstr); next_nbut: @@ -948,16 +948,16 @@ static void bind_default_keyboard(void) { "A-F4", "Close" }, { NULL, NULL } }; - ObActionsParser *p; + ObActionParser *p; - p = actions_parser_new(); + p = action_parser_new(); for (it = binds; it->key; ++it) { GList *l = g_list_append(NULL, g_strdup(it->key)); - ObActionsList *actions = actions_parser_read_string(p, it->actiontext); + ObActionList *actions = action_parser_read_string(p, it->actiontext); keyboard_bind(l, actions); - actions_list_unref(actions); + action_list_unref(actions); } - actions_parser_unref(p); + action_parser_unref(p); } typedef struct @@ -1021,17 +1021,17 @@ static void bind_default_mouse(void) { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION, "Resize" }, { NULL, NULL, 0, NULL } }; - ObActionsParser *p; - ObActionsList *actions; + ObActionParser *p; + ObActionList *actions; - p = actions_parser_new(); + p = action_parser_new(); for (it = binds; it->button; ++it) { - actions = actions_parser_read_string(p, it->actname); + actions = action_parser_read_string(p, it->actname); mouse_bind(it->button, frame_context_from_string(it->context), it->mact, actions); - actions_list_unref(actions); + action_list_unref(actions); } - actions_parser_unref(p); + action_parser_unref(p); } void config_startup(ObtXmlInst *i) diff --git a/openbox/event.c b/openbox/event.c index cb65d7c4..88845e36 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -22,7 +22,7 @@ #include "window.h" #include "openbox.h" #include "dock.h" -#include "actions.h" +#include "action.h" #include "client.h" #include "config.h" #include "screen.h" @@ -2061,7 +2061,7 @@ static gboolean event_handle_user_input(ObClient *client, XEvent *e) /* if the keyboard interactive action uses the event then dont use it for bindings. likewise is moveresize uses the event. */ - if (actions_interactive_input_event(e) || moveresize_event(e)) + if (action_interactive_input_event(e) || moveresize_event(e)) return TRUE; if (moveresize_in_progress) @@ -2196,8 +2196,8 @@ static gboolean is_enter_focus_event_ignored(gulong serial) void event_cancel_all_key_grabs(void) { - if (actions_interactive_act_running()) { - actions_interactive_cancel_act(); + if (action_interactive_act_running()) { + action_interactive_cancel_act(); ob_debug("KILLED interactive action"); } else if (menu_frame_visible) { diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 25d3b310..8515ff64 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -24,8 +24,8 @@ #include "event.h" #include "grab.h" #include "client.h" -#include "actions.h" -#include "actions_list.h" +#include "action.h" +#include "action_list.h" #include "menuframe.h" #include "config.h" #include "keytree.h" @@ -140,7 +140,7 @@ void keyboard_chroot(GList *keylist) } } -gboolean keyboard_bind(GList *keylist, ObActionsList *actions) +gboolean keyboard_bind(GList *keylist, ObActionList *actions) { KeyBindingTree *tree, *t; gboolean conflict; @@ -170,8 +170,8 @@ gboolean keyboard_bind(GList *keylist, ObActionsList *actions) for (; t->first_child; t = t->first_child); /* set the action */ - actions_list_ref(actions); - t->actions = actions_list_concat(t->actions, actions); + action_list_ref(actions); + t->actions = action_list_concat(t->actions, actions); /* assimilate this built tree into the main tree. assimilation destroys/uses the tree */ @@ -266,10 +266,10 @@ gboolean keyboard_event(ObClient *client, const XEvent *e) else { gboolean i; - i = actions_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY, - e->xkey.state, - e->xkey.x_root, e->xkey.y_root, - 0, OB_FRAME_CONTEXT_NONE, client); + i = action_run_acts(p->actions, OB_USER_ACTION_KEYBOARD_KEY, + e->xkey.state, + e->xkey.x_root, e->xkey.y_root, + 0, OB_FRAME_CONTEXT_NONE, client); if (!i) /* reset if an interactive was not run */ keyboard_reset_chains(0); } diff --git a/openbox/keyboard.h b/openbox/keyboard.h index 07059a26..300a9106 100644 --- a/openbox/keyboard.h +++ b/openbox/keyboard.h @@ -27,7 +27,7 @@ #include struct _ObClient; -struct _ObActionsAct; +struct _ObActionList; extern KeyBindingTree *keyboard_firstnode; @@ -37,7 +37,7 @@ void keyboard_shutdown(gboolean reconfig); void keyboard_rebind(void); void keyboard_chroot(GList *keylist); -gboolean keyboard_bind(GList *keylist, struct _ObActionsList *actions); +gboolean keyboard_bind(GList *keylist, struct _ObActionList *actions); void keyboard_unbind_all(void); gboolean keyboard_event(struct _ObClient *client, const XEvent *e); diff --git a/openbox/keytree.c b/openbox/keytree.c index 7b4b0f72..7e14df82 100644 --- a/openbox/keytree.c +++ b/openbox/keytree.c @@ -19,8 +19,8 @@ #include "keyboard.h" #include "translate.h" -#include "actions.h" -#include "actions_list.h" +#include "action.h" +#include "action_list.h" #include void tree_destroy(KeyBindingTree *tree) @@ -35,7 +35,7 @@ void tree_destroy(KeyBindingTree *tree) for (it = tree->keylist; it != NULL; it = it->next) g_free(it->data); g_list_free(tree->keylist); - actions_list_unref(tree->actions); + action_list_unref(tree->actions); } g_slice_free(KeyBindingTree, tree); tree = c; diff --git a/openbox/keytree.h b/openbox/keytree.h index 8504772f..1971393c 100644 --- a/openbox/keytree.h +++ b/openbox/keytree.h @@ -21,13 +21,13 @@ #include -struct _ObActionsList; +struct _ObActionList; typedef struct KeyBindingTree { guint state; guint key; GList *keylist; - struct _ObActionsList *actions; + struct _ObActionList *actions; gboolean chroot; /* the level up in the tree */ diff --git a/openbox/menu.c b/openbox/menu.c index 30313881..b5d92870 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -24,9 +24,9 @@ #include "grab.h" #include "client.h" #include "config.h" -#include "actions.h" -#include "actions_list.h" -#include "actions_parser.h" +#include "action.h" +#include "action_list.h" +#include "action_parser.h" #include "screen.h" #include "menuframe.h" #include "keyboard.h" @@ -284,23 +284,23 @@ static void parse_menu_item(xmlNodePtr node, gpointer data) if (obt_xml_attr_string(node, "label", &label)) { xmlNodePtr c; xmlChar *cc; - ObActionsList *acts = NULL; - ObActionsParser *p; + ObActionList *acts = NULL; + ObActionParser *p; c = obt_xml_find_node(node->children, "action"); - p = actions_parser_new(); + p = action_parser_new(); while (c) { - ObActionsList *al; + ObActionList *al; cc = xmlNodeGetContent(c); - al = actions_parser_read_string(p, (gchar*)cc); + al = action_parser_read_string(p, (gchar*)cc); xmlFree(cc); - acts = actions_list_concat(acts, al); + acts = action_list_concat(acts, al); c = obt_xml_find_node(c->next, "action"); } e = menu_add_normal(state->parent, -1, label, acts, TRUE); - actions_list_unref(acts); + action_list_unref(acts); if (config_menu_show_icons && obt_xml_attr_string(node, "icon", &icon)) @@ -555,7 +555,7 @@ void menu_entry_unref(ObMenuEntry *self) RrImageUnref(self->data.normal.icon); g_free(self->data.normal.label); g_free(self->data.normal.collate_key); - actions_list_unref(self->data.normal.actions); + action_list_unref(self->data.normal.actions); break; case OB_MENU_ENTRY_TYPE_SUBMENU: RrImageUnref(self->data.submenu.icon); @@ -599,13 +599,13 @@ void menu_entry_remove(ObMenuEntry *self) } ObMenuEntry* menu_add_normal(ObMenu *self, gint id, const gchar *label, - ObActionsList *actions, gboolean allow_shortcut) + ObActionList *actions, gboolean allow_shortcut) { ObMenuEntry *e; e = menu_entry_new(self, OB_MENU_ENTRY_TYPE_NORMAL, id); e->data.normal.actions = actions; - actions_list_ref(actions); + action_list_ref(actions); menu_entry_set_label(e, label, allow_shortcut); diff --git a/openbox/menu.h b/openbox/menu.h index c20addb1..dfa5131b 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -25,7 +25,7 @@ #include -struct _ObActionsList; +struct _ObActionList; struct _ObClient; struct _ObMenuFrame; struct _ObMenuEntryFrame; @@ -121,7 +121,7 @@ struct _ObNormalMenuEntry { /* state */ gboolean enabled; - struct _ObActionsList *actions; + struct _ObActionList *actions; /* Mask icon */ RrPixmapMask *mask; @@ -209,7 +209,7 @@ void menu_set_place_func(ObMenu *menu, ObMenuPlaceFunc func); /*! @param allow_shortcut this should be false when the label is coming from outside data like window or desktop titles */ ObMenuEntry* menu_add_normal(ObMenu *menu, gint id, const gchar *label, - struct _ObActionsList *actions, + struct _ObActionList *actions, gboolean allow_shortcut); ObMenuEntry* menu_add_submenu(ObMenu *menu, gint id, const gchar *submenu); ObMenuEntry* menu_add_separator(ObMenu *menu, gint id, const gchar *label); diff --git a/openbox/menuframe.c b/openbox/menuframe.c index bb6c5d21..40265266 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -21,8 +21,8 @@ #include "client.h" #include "menu.h" #include "screen.h" -#include "actions.h" -#include "actions_list.h" +#include "action.h" +#include "action_list.h" #include "event.h" #include "grab.h" #include "openbox.h" @@ -1291,7 +1291,7 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state) ObMenuEntry *entry = self->entry; ObMenuExecuteFunc func = self->frame->menu->execute_func; gpointer data = self->frame->menu->data; - ObActionsList *acts = self->entry->data.normal.actions; + ObActionList *acts = self->entry->data.normal.actions; ObClient *client = self->frame->client; ObMenuFrame *frame = self->frame; guint mods = obt_keyboard_only_modmasks(state); @@ -1305,8 +1305,8 @@ void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state) if (func) func(entry, frame, client, state, data); else - actions_run_acts(acts, OB_USER_ACTION_MENU_SELECTION, - state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, client); + action_run_acts(acts, OB_USER_ACTION_MENU_SELECTION, + state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, client); } } diff --git a/openbox/mouse.c b/openbox/mouse.c index 74b8b760..f0b869c1 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -19,8 +19,8 @@ #include "openbox.h" #include "config.h" -#include "actions.h" -#include "actions_list.h" +#include "action.h" +#include "action_list.h" #include "event.h" #include "client.h" #include "grab.h" @@ -35,7 +35,7 @@ typedef struct { guint state; guint button; - ObActionsList *actions[OB_NUM_MOUSE_ACTIONS]; + ObActionList *actions[OB_NUM_MOUSE_ACTIONS]; } ObMouseBinding; /* Array of GSList*s of ObMouseBinding*s. */ @@ -151,7 +151,7 @@ void mouse_unbind_all(void) gint j; for (j = 0; j < OB_NUM_MOUSE_ACTIONS; ++j) - actions_list_unref(b->actions[j]); + action_list_unref(b->actions[j]); g_slice_free(ObMouseBinding, b); } g_slist_free(bound_contexts[i]); @@ -188,8 +188,8 @@ static gboolean fire_binding(ObMouseAction a, ObFrameContext context, /* if not bound, then nothing to do! */ if (it == NULL) return FALSE; - actions_run_acts(b->actions[a], mouse_action_to_user_action(a), - state, x, y, button, context, c); + action_run_acts(b->actions[a], mouse_action_to_user_action(a), + state, x, y, button, context, c); return TRUE; } @@ -366,7 +366,7 @@ gboolean mouse_event(ObClient *client, XEvent *e) } gboolean mouse_bind(const gchar *buttonstr, ObFrameContext context, - ObMouseAction mact, ObActionsList *actions) + ObMouseAction mact, ObActionList *actions) { guint state, button; ObMouseBinding *b; @@ -382,8 +382,8 @@ gboolean mouse_bind(const gchar *buttonstr, ObFrameContext context, for (it = bound_contexts[context]; it; it = g_slist_next(it)) { b = it->data; if (b->state == state && b->button == button) { - actions_list_ref(actions); - b->actions[mact] = actions_list_concat(b->actions[mact], actions); + action_list_ref(actions); + b->actions[mact] = action_list_concat(b->actions[mact], actions); return TRUE; } } @@ -393,7 +393,7 @@ gboolean mouse_bind(const gchar *buttonstr, ObFrameContext context, b->state = state; b->button = button; b->actions[mact] = actions; - actions_list_ref(actions); + action_list_ref(actions); bound_contexts[context] = g_slist_append(bound_contexts[context], b); return TRUE; diff --git a/openbox/mouse.h b/openbox/mouse.h index b683cdf0..5f38c9f4 100644 --- a/openbox/mouse.h +++ b/openbox/mouse.h @@ -24,13 +24,13 @@ #include -struct _ObActionsList; +struct _ObActionList; void mouse_startup(gboolean reconfig); void mouse_shutdown(gboolean reconfig); gboolean mouse_bind(const gchar *buttonstr, ObFrameContext context, - ObMouseAction mact, struct _ObActionsList *actions); + ObMouseAction mact, struct _ObActionList *actions); void mouse_unbind_all(void); gboolean mouse_event(struct _ObClient *client, XEvent *e); diff --git a/openbox/openbox.c b/openbox/openbox.c index fdf1c023..cdd5566a 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -25,7 +25,7 @@ #include "menu.h" #include "client.h" #include "screen.h" -#include "actions.h" +#include "action.h" #include "startupnotify.h" #include "focus.h" #include "focus_cycle.h" @@ -236,7 +236,7 @@ gint main(gint argc, gchar **argv) i = obt_xml_instance_new(); /* register all the available actions */ - actions_startup(reconfigure); + action_startup(reconfigure); /* start up config which sets up with the parser */ config_startup(i); @@ -407,7 +407,7 @@ gint main(gint argc, gchar **argv) sn_shutdown(reconfigure); event_shutdown(reconfigure); config_shutdown(); - actions_shutdown(reconfigure); + action_shutdown(reconfigure); } while (reconfigure); } -- 2.39.2