From 9d358af1dd11a75cf4778e096df8f52cb1ca690b Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 6 Oct 2016 14:41:19 +0000 Subject: Add an argument to the callbacks to pass the xevent context, button or key press. This allows to remove a few hacks to duplicate functions only for behaviour changes; now differing behaviours are pushed down to the callback. Also will allow for previously unavailable actions to be bind-able down the road. --- conf.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index f1e8979..224e682 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.214 2016/10/05 13:35:17 okan Exp $ + * $OpenBSD: conf.c,v 1.215 2016/10/06 14:41:19 okan Exp $ */ #include @@ -351,7 +351,7 @@ conf_client(struct client_ctx *cc) static const struct { const char *tag; - void (*handler)(struct client_ctx *, union arg *); + void (*handler)(struct client_ctx *, union arg *, int); int context; union arg argument; } name_to_func[] = { @@ -412,8 +412,7 @@ static const struct { {.i = (CWM_CLIENT_CYCLE | CWM_CLIENT_CYCLE_INGRP)} }, { "rcycleingroup", kbfunc_client_cycle, CWM_CONTEXT_CLIENT, {.i = (CWM_CLIENT_RCYCLE | CWM_CLIENT_CYCLE_INGRP)} }, - { "grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT, - {.i = CWM_KBD}}, + { "grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT, {0}}, { "stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CLIENT, {0} }, { "fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CLIENT, {0} }, @@ -489,14 +488,10 @@ static const struct { { "window_hide", kbfunc_client_hide, CWM_CONTEXT_CLIENT, {0} }, { "window_move", mousefunc_client_move, CWM_CONTEXT_CLIENT, {0} }, { "window_resize", mousefunc_client_resize, CWM_CONTEXT_CLIENT, {0} }, - { "window_grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT, - {.i = CWM_MOUSE} }, - { "menu_group", kbfunc_menu_group, CWM_CONTEXT_SCREEN, - {.i = CWM_MOUSE} }, - { "menu_unhide", kbfunc_menu_client, CWM_CONTEXT_SCREEN, - {.i = CWM_MOUSE} }, - { "menu_cmd", kbfunc_menu_cmd, CWM_CONTEXT_SCREEN, - {.i = CWM_MOUSE} }, + { "window_grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT, {0} }, + { "menu_group", kbfunc_menu_group, CWM_CONTEXT_SCREEN, {0} }, + { "menu_unhide", kbfunc_menu_client, CWM_CONTEXT_SCREEN, {0} }, + { "menu_cmd", kbfunc_menu_cmd, CWM_CONTEXT_SCREEN, {0} }, }; static const struct { -- cgit v1.2.3-2-gb3c3