From 985e7dadf9a3ebf4bd265d955c3198e96405e5d2 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 29 Feb 2008 23:34:28 -0500 Subject: change some of the hooks, and add all the hooks to the code so that they run --- openbox/hooks.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'openbox/hooks.c') 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 -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) -- cgit v1.2.3