9 static GSList
*hooks
[OB_NUM_HOOKS
];
10 static const gchar
*names
[OB_NUM_HOOKS
];
12 void hooks_startup(gboolean reconfig
)
16 for (i
= 0; i
< OB_NUM_HOOKS
; ++i
)
19 names
[OB_HOOK_WIN_NEW
] = "WindowNew";
20 names
[OB_HOOK_WIN_CLOSE
] = "WindowClosed";
21 names
[OB_HOOK_WIN_VISIBLE
] = "WindowVisible";
22 names
[OB_HOOK_WIN_INVISIBLE
] = "WindowInvisible";
23 names
[OB_HOOK_WIN_ICONIC
] = "WindowIconified";
24 names
[OB_HOOK_WIN_UNICONIC
] = "WindowUniconified";
25 names
[OB_HOOK_WIN_MAX
] = "WindowMaximized";
26 names
[OB_HOOK_WIN_UNMAX
] = "WindowUnmaximized";
27 names
[OB_HOOK_WIN_SHADE
] = "WindowShaded";
28 names
[OB_HOOK_WIN_UNSHADE
] = "WindowUnshaded";
29 names
[OB_HOOK_WIN_FOCUS
] = "WindowFocused";
30 names
[OB_HOOK_WIN_UNFOCUS
] = "WindowUnfocused";
31 names
[OB_HOOK_WIN_DESK_CHANGE
] = "WindowOnNewDesktop";
32 names
[OB_HOOK_WIN_DECORATED
] = "WindowDecorated";
33 names
[OB_HOOK_WIN_UNDECORATED
] = "WindowUndecorated";
34 names
[OB_HOOK_SCREEN_DESK_CHANGE
] = "DesktopChanged";
37 void hooks_shutdown(gboolean reconfig
)
41 for (i
= 0; i
< OB_NUM_HOOKS
; ++i
)
43 actions_act_unref(hooks
[i
]->data
);
44 hooks
[i
] = g_slist_delete_link(hooks
[i
], hooks
[i
]);
48 ObHook
hooks_hook_from_name(const gchar
*n
)
52 for (i
= 1; i
< OB_NUM_HOOKS
; ++i
)
53 if (!g_ascii_strcasecmp(n
, names
[i
]))
55 return OB_HOOK_INVALID
;
58 void hooks_run(ObHook hook
, struct _ObClient
*client
)
62 g_assert(hook
< OB_NUM_HOOKS
&& hook
> OB_HOOK_INVALID
);
64 ob_debug("Running hook %s for client 0x%x", names
[hook
],
65 (client
? client
->window
: 0));
66 actions_run_acts(hooks
[hook
],
69 OB_FRAME_CONTEXT_NONE
,
73 void hooks_add(ObHook hook
, struct _ObActionsAct
*act
)
75 g_assert(hook
< OB_NUM_HOOKS
&& hook
> OB_HOOK_INVALID
);
77 /* append so they are executed in the same order as they appear in the
79 hooks
[hook
] = g_slist_append(hooks
[hook
], act
);