summaryrefslogtreecommitdiff
path: root/openbox/hooks.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-02-29 23:34:28 -0500
committerDana Jansens <danakj@orodu.net>2008-02-29 23:40:02 -0500
commit985e7dadf9a3ebf4bd265d955c3198e96405e5d2 (patch)
tree3e5f020b19a6f54d2439f340d3b18295d80105ee /openbox/hooks.c
parentdb781556d63d1a50bd1b1b4b6b5423ef703bf2c7 (diff)
change some of the hooks, and add all the hooks to the code so that they run
Diffstat (limited to 'openbox/hooks.c')
-rw-r--r--openbox/hooks.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/openbox/hooks.c b/openbox/hooks.c
index 4cf97c07..2a346c39 100644
--- a/openbox/hooks.c
+++ b/openbox/hooks.c
@@ -3,17 +3,21 @@
#include <glib.h>
-static GSList *hooks[OB_NUM_HOOKS*2];
+static GSList *hooks[OB_NUM_HOOKS];
void hooks_startup(gboolean reconfig)
{
+ gint i;
+
+ for (i = 0; i < OB_NUM_HOOKS; ++i)
+ hooks[i] = NULL;
}
void hooks_shutdown(gboolean reconfig)
{
gint i;
- for (i = 0; i < OB_NUM_HOOKS*2; ++i)
+ for (i = 0; i < OB_NUM_HOOKS; ++i)
while (hooks[i]) {
actions_act_unref(hooks[i]->data);
hooks[i] = g_slist_delete_link(hooks[i], hooks[i]);
@@ -46,29 +50,28 @@ ObHook hooks_hook_from_name(const gchar *n)
return OB_HOOK_WIN_FOCUS;
if (!g_ascii_strcasecmp(n, "WindowUnfocused"))
return OB_HOOK_WIN_UNFOCUS;
- if (!g_ascii_strcasecmp(n, "WindowOnCurrentDesktop"))
- return OB_HOOK_WIN_CURRENT_DESK;
- if (!g_ascii_strcasecmp(n, "WindowOnOtherDesktop"))
- return OB_HOOK_WIN_OTHER_DESK;
+ if (!g_ascii_strcasecmp(n, "WindowOnNewDesktop"))
+ return OB_HOOK_WIN_DESK_CHANGE;
if (!g_ascii_strcasecmp(n, "WindowDecorated"))
return OB_HOOK_WIN_DECORATED;
if (!g_ascii_strcasecmp(n, "WindowUndecorated"))
return OB_HOOK_WIN_UNDECORATED;
+ if (!g_ascii_strcasecmp(n, "DesktopChanged"))
+ return OB_HOOK_SCREEN_DESK_CHANGE;
return OB_HOOK_INVALID;
}
-void hooks_fire(ObHook hook, struct _ObClient *c)
+void hooks_run(ObHook hook, struct _ObClient *c)
{
GSList *it;
g_assert(hook < OB_NUM_HOOKS);
- for (it = hooks[hook]; it; it = g_slist_next(it))
- actions_run_acts(it->data,
- OB_USER_ACTION_HOOK,
- 0, -1, -1, 0,
- OB_FRAME_CONTEXT_NONE,
- c);
+ actions_run_acts(hooks[hook],
+ OB_USER_ACTION_HOOK,
+ 0, -1, -1, 0,
+ OB_FRAME_CONTEXT_NONE,
+ c);
}
void hooks_add(ObHook hook, struct _ObActionsAct *act)