diff options
| author | Dana Jansens <danakj@orodu.net> | 2009-11-21 13:34:33 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2009-11-21 13:56:55 -0500 |
| commit | c828154886a40fa48b0545fd5d22e277f6d210e9 (patch) | |
| tree | 5244d4a5acc0166260eaa81c6258ac3c2a41fae9 /openbox/hooks.c | |
| parent | fa0ae17adbc8f73b707c33836d37841e81b9303a (diff) | |
Revert all commits for the Hooks feature to move it to a topic branch.
This reverts commit fd2f617be7ff57fcb187daa737f66d243544c8cd.
This reverts commit a47d0a53652a96ca1df96fc9268757df1431ae55.
This reverts commit a1908e076736e1a618bd305c5963dbfecaa30497.
This reverts commit dc2e6f6bf7143a56de360a393b33906735e63625.
This reverts commit 985e7dadf9a3ebf4bd265d955c3198e96405e5d2.
This reverts commit db781556d63d1a50bd1b1b4b6b5423ef703bf2c7.
This reverts commit feec8f663f0a11546c2da87575fecc8a88d97ca1.
Diffstat (limited to 'openbox/hooks.c')
| -rw-r--r-- | openbox/hooks.c | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/openbox/hooks.c b/openbox/hooks.c deleted file mode 100644 index 53586db8..00000000 --- a/openbox/hooks.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "hooks.h" -#include "actions.h" -#include "client.h" -#include "focus.h" -#include "debug.h" -#include "obt/display.h" - -#include <glib.h> - -static GSList *hooks[OB_NUM_HOOKS]; -static const gchar *names[OB_NUM_HOOKS]; - -typedef struct { - ObHook hook; - struct _ObClient *client; -} ObHookQueue; - -#define QUEUE_SIZE 20 -ObHookQueue run_queue[QUEUE_SIZE]; -gint queue_size; - -void hooks_startup(gboolean reconfig) -{ - gint i; - - for (i = 0; i < OB_NUM_HOOKS; ++i) - hooks[i] = NULL; - - queue_size = 0; - - names[OB_HOOK_WIN_NEW] = "WindowNew"; - names[OB_HOOK_WIN_CLOSE] = "WindowClosed"; - names[OB_HOOK_WIN_VISIBLE] = "WindowVisible"; - names[OB_HOOK_WIN_INVISIBLE] = "WindowInvisible"; - names[OB_HOOK_WIN_ICONIC] = "WindowIconified"; - names[OB_HOOK_WIN_UNICONIC] = "WindowUniconified"; - names[OB_HOOK_WIN_MAX] = "WindowMaximized"; - names[OB_HOOK_WIN_UNMAX] = "WindowUnmaximized"; - names[OB_HOOK_WIN_SHADE] = "WindowShaded"; - names[OB_HOOK_WIN_UNSHADE] = "WindowUnshaded"; - names[OB_HOOK_WIN_FOCUS] = "WindowFocused"; - names[OB_HOOK_WIN_UNFOCUS] = "WindowUnfocused"; - names[OB_HOOK_WIN_DESK_CHANGE] = "WindowOnNewDesktop"; - names[OB_HOOK_WIN_DECORATED] = "WindowDecorated"; - names[OB_HOOK_WIN_UNDECORATED] = "WindowUndecorated"; - names[OB_HOOK_SCREEN_DESK_CHANGE] = "DesktopChanged"; -} - -void hooks_shutdown(gboolean reconfig) -{ - gint 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]); - } -} - -ObHook hooks_hook_from_name(const gchar *n) -{ - gint i; - - for (i = 1; i < OB_NUM_HOOKS; ++i) - if (!g_ascii_strcasecmp(n, names[i])) - return (ObHook)i; - return OB_HOOK_INVALID; -} - -void hooks_queue(ObHook hook, struct _ObClient *client) -{ - ObHookQueue *q; - - g_assert(hook < OB_NUM_HOOKS && hook > OB_HOOK_INVALID); - - //ob_debug("Queing hook %s for client 0x%x", names[hook], - // (client ? client->window : 0)); - q = &run_queue[queue_size++]; - q->hook = hook; - q->client = client; - - if (queue_size == QUEUE_SIZE) - /* queue is full */ - hooks_run_queue(); -} - -void hooks_run(ObHook hook, struct _ObClient *c) -{ - hooks_queue(hook, c); - hooks_run_queue(); -} - -void hooks_add(ObHook hook, struct _ObActionsAct *act) -{ - g_assert(hook < OB_NUM_HOOKS && hook > OB_HOOK_INVALID); - - /* append so they are executed in the same order as they appear in the - config file */ - hooks[hook] = g_slist_append(hooks[hook], act); -} - -void hooks_run_queue(void) -{ - gint i; - - for (i = 0; i < queue_size; ++i) { - const ObHookQueue *q = &run_queue[i]; - - //ob_debug("Running hook %s for client 0x%x", names[q->hook], - // (q->client ? q->client->window : 0)); - actions_run_acts(hooks[q->hook], - OB_USER_ACTION_HOOK, - 0, -1, -1, 0, - OB_FRAME_CONTEXT_NONE, - q->client); - } - queue_size = 0; -} |
