]>
Dogcows Code - chaz/openbox/blob - openbox/hooks.c
4cf97c07c4d42413169bada399ce83e1828011a6
6 static GSList
*hooks
[OB_NUM_HOOKS
*2];
8 void hooks_startup(gboolean reconfig
)
12 void hooks_shutdown(gboolean reconfig
)
16 for (i
= 0; i
< OB_NUM_HOOKS
*2; ++i
)
18 actions_act_unref(hooks
[i
]->data
);
19 hooks
[i
] = g_slist_delete_link(hooks
[i
], hooks
[i
]);
23 ObHook
hooks_hook_from_name(const gchar
*n
)
25 if (!g_ascii_strcasecmp(n
, "WindowNew"))
26 return OB_HOOK_WIN_NEW
;
27 if (!g_ascii_strcasecmp(n
, "WindowClosed"))
28 return OB_HOOK_WIN_CLOSE
;
29 if (!g_ascii_strcasecmp(n
, "WindowVisible"))
30 return OB_HOOK_WIN_VISIBLE
;
31 if (!g_ascii_strcasecmp(n
, "WindowInvisible"))
32 return OB_HOOK_WIN_INVISIBLE
;
33 if (!g_ascii_strcasecmp(n
, "WindowIconified"))
34 return OB_HOOK_WIN_ICONIC
;
35 if (!g_ascii_strcasecmp(n
, "WindowUniconified"))
36 return OB_HOOK_WIN_UNICONIC
;
37 if (!g_ascii_strcasecmp(n
, "WindowMaximized"))
38 return OB_HOOK_WIN_MAX
;
39 if (!g_ascii_strcasecmp(n
, "WindowUnmaximized"))
40 return OB_HOOK_WIN_UNMAX
;
41 if (!g_ascii_strcasecmp(n
, "WindowShaded"))
42 return OB_HOOK_WIN_SHADE
;
43 if (!g_ascii_strcasecmp(n
, "WindowUnshaded"))
44 return OB_HOOK_WIN_UNSHADE
;
45 if (!g_ascii_strcasecmp(n
, "WindowFocused"))
46 return OB_HOOK_WIN_FOCUS
;
47 if (!g_ascii_strcasecmp(n
, "WindowUnfocused"))
48 return OB_HOOK_WIN_UNFOCUS
;
49 if (!g_ascii_strcasecmp(n
, "WindowOnCurrentDesktop"))
50 return OB_HOOK_WIN_CURRENT_DESK
;
51 if (!g_ascii_strcasecmp(n
, "WindowOnOtherDesktop"))
52 return OB_HOOK_WIN_OTHER_DESK
;
53 if (!g_ascii_strcasecmp(n
, "WindowDecorated"))
54 return OB_HOOK_WIN_DECORATED
;
55 if (!g_ascii_strcasecmp(n
, "WindowUndecorated"))
56 return OB_HOOK_WIN_UNDECORATED
;
57 return OB_HOOK_INVALID
;
60 void hooks_fire(ObHook hook
, struct _ObClient
*c
)
64 g_assert(hook
< OB_NUM_HOOKS
);
66 for (it
= hooks
[hook
]; it
; it
= g_slist_next(it
))
67 actions_run_acts(it
->data
,
70 OB_FRAME_CONTEXT_NONE
,
74 void hooks_add(ObHook hook
, struct _ObActionsAct
*act
)
76 g_assert(hook
< OB_NUM_HOOKS
);
78 /* append so they are executed in the same order as they appear in the
80 hooks
[hook
] = g_slist_append(hooks
[hook
], act
);
This page took 0.03821 seconds and 4 git commands to generate.