From f766a2baaec283eabcfa26f0c60e9a596b43459d Mon Sep 17 00:00:00 2001 From: oga Date: Fri, 23 Jan 2009 18:58:40 +0000 Subject: Move the keybinding argument to a union to prevent warnings where sizeof(int) != sizeof(void *). This has been annoying me for ages. ok okan@, todd@ --- conf.c | 124 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 7726412..7c075c1 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. * - * $Id: conf.c,v 1.53 2009/01/21 15:04:38 todd Exp $ + * $Id: conf.c,v 1.54 2009/01/23 18:58:40 oga Exp $ */ #include "headers.h" @@ -207,88 +207,88 @@ conf_client(struct client_ctx *cc) } struct { - char *tag; - void (*handler)(struct client_ctx *, void *); - int flags; - void *argument; + char *tag; + void (*handler)(struct client_ctx *, union arg *); + int flags; + union arg argument; } name_to_kbfunc[] = { - { "lower", kbfunc_client_lower, KBFLAG_NEEDCLIENT, 0 }, - { "raise", kbfunc_client_raise, KBFLAG_NEEDCLIENT, 0 }, - { "search", kbfunc_client_search, 0, 0 }, - { "menusearch", kbfunc_menu_search, 0, 0 }, - { "hide", kbfunc_client_hide, KBFLAG_NEEDCLIENT, 0 }, - { "cycle", kbfunc_client_cycle, 0, (void *)CWM_CYCLE }, - { "rcycle", kbfunc_client_cycle, 0, (void *)CWM_RCYCLE }, - { "label", kbfunc_client_label, KBFLAG_NEEDCLIENT, 0 }, - { "delete", kbfunc_client_delete, KBFLAG_NEEDCLIENT, 0 }, - { "group1", kbfunc_client_group, 0, (void *)1 }, - { "group2", kbfunc_client_group, 0, (void *)2 }, - { "group3", kbfunc_client_group, 0, (void *)3 }, - { "group4", kbfunc_client_group, 0, (void *)4 }, - { "group5", kbfunc_client_group, 0, (void *)5 }, - { "group6", kbfunc_client_group, 0, (void *)6 }, - { "group7", kbfunc_client_group, 0, (void *)7 }, - { "group8", kbfunc_client_group, 0, (void *)8 }, - { "group9", kbfunc_client_group, 0, (void *)9 }, - { "nogroup", kbfunc_client_nogroup, 0, 0 }, - { "cyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_CYCLEGROUP }, - { "rcyclegroup", kbfunc_client_cyclegroup, 0, (void *)CWM_RCYCLEGROUP }, - { "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, 0}, - { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 }, - { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 }, - { "reload", kbfunc_reload, 0, 0 }, - { "quit", kbfunc_quit_wm, 0, 0 }, - { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM }, - { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM }, - { "ssh", kbfunc_ssh, 0, 0 }, - { "terminal", kbfunc_term, 0, 0 }, - { "lock", kbfunc_lock, 0, 0 }, + { "lower", kbfunc_client_lower, KBFLAG_NEEDCLIENT, {0} }, + { "raise", kbfunc_client_raise, KBFLAG_NEEDCLIENT, {0} }, + { "search", kbfunc_client_search, 0, {0} }, + { "menusearch", kbfunc_menu_search, 0, {0} }, + { "hide", kbfunc_client_hide, KBFLAG_NEEDCLIENT, {0} }, + { "cycle", kbfunc_client_cycle, 0, {.i = CWM_CYCLE} }, + { "rcycle", kbfunc_client_cycle, 0, {.i = CWM_RCYCLE} }, + { "label", kbfunc_client_label, KBFLAG_NEEDCLIENT, {0} }, + { "delete", kbfunc_client_delete, KBFLAG_NEEDCLIENT, {0} }, + { "group1", kbfunc_client_group, 0, {.i = 1} }, + { "group2", kbfunc_client_group, 0, {.i = 2} }, + { "group3", kbfunc_client_group, 0, {.i = 3} }, + { "group4", kbfunc_client_group, 0, {.i = 4} }, + { "group5", kbfunc_client_group, 0, {.i = 5} }, + { "group6", kbfunc_client_group, 0, {.i = 6} }, + { "group7", kbfunc_client_group, 0, {.i = 7} }, + { "group8", kbfunc_client_group, 0, {.i = 8} }, + { "group9", kbfunc_client_group, 0, {.i = 9} }, + { "nogroup", kbfunc_client_nogroup, 0, {0} }, + { "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLEGROUP} }, + { "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLEGROUP} }, + { "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, {0}}, + { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} }, + { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, + { "reload", kbfunc_reload, 0, {0} }, + { "quit", kbfunc_quit_wm, 0, {0} }, + { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, + { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, + { "ssh", kbfunc_ssh, 0, {0} }, + { "terminal", kbfunc_term, 0, {0} }, + { "lock", kbfunc_lock, 0, {0} }, { "moveup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_UP|CWM_MOVE) }, + {.i = (CWM_UP|CWM_MOVE)} }, { "movedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_DOWN|CWM_MOVE) }, + {.i = (CWM_DOWN|CWM_MOVE)} }, { "moveright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_RIGHT|CWM_MOVE) }, + {.i = (CWM_RIGHT|CWM_MOVE)} }, { "moveleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_LEFT|CWM_MOVE) }, + {.i = (CWM_LEFT|CWM_MOVE)} }, { "bigmoveup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_UP|CWM_MOVE|CWM_BIGMOVE) }, + {.i = (CWM_UP|CWM_MOVE|CWM_BIGMOVE)} }, { "bigmovedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_DOWN|CWM_MOVE|CWM_BIGMOVE) }, + {.i = (CWM_DOWN|CWM_MOVE|CWM_BIGMOVE)} }, { "bigmoveright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_RIGHT|CWM_MOVE|CWM_BIGMOVE) }, + {.i = (CWM_RIGHT|CWM_MOVE|CWM_BIGMOVE)} }, { "bigmoveleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_LEFT|CWM_MOVE|CWM_BIGMOVE) }, + {.i = (CWM_LEFT|CWM_MOVE|CWM_BIGMOVE)} }, { "resizeup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_UP|CWM_RESIZE) }, + {.i = (CWM_UP|CWM_RESIZE)} }, { "resizedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_DOWN|CWM_RESIZE) }, + {.i = (CWM_DOWN|CWM_RESIZE)} }, { "resizeright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_RIGHT|CWM_RESIZE) }, + {.i = (CWM_RIGHT|CWM_RESIZE)} }, { "resizeleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_LEFT|CWM_RESIZE) }, + {.i = (CWM_LEFT|CWM_RESIZE)} }, { "bigresizeup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_UP|CWM_RESIZE|CWM_BIGMOVE) }, + {.i = (CWM_UP|CWM_RESIZE|CWM_BIGMOVE)} }, { "bigresizedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_DOWN|CWM_RESIZE|CWM_BIGMOVE) }, + {.i = (CWM_DOWN|CWM_RESIZE|CWM_BIGMOVE)} }, { "bigresizeright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_RIGHT|CWM_RESIZE|CWM_BIGMOVE) }, + {.i = (CWM_RIGHT|CWM_RESIZE|CWM_BIGMOVE)} }, { "bigresizeleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, - (void *)(CWM_LEFT|CWM_RESIZE|CWM_BIGMOVE) }, - { "ptrmoveup", kbfunc_moveresize, 0, (void *)(CWM_UP|CWM_PTRMOVE) }, - { "ptrmovedown", kbfunc_moveresize, 0, (void *)(CWM_DOWN|CWM_PTRMOVE) }, - { "ptrmoveleft", kbfunc_moveresize, 0, (void *)(CWM_LEFT|CWM_PTRMOVE) }, + {.i = (CWM_LEFT|CWM_RESIZE|CWM_BIGMOVE)} }, + { "ptrmoveup", kbfunc_moveresize, 0, {.i = (CWM_UP|CWM_PTRMOVE)} }, + { "ptrmovedown", kbfunc_moveresize, 0, {.i = (CWM_DOWN|CWM_PTRMOVE)} }, + { "ptrmoveleft", kbfunc_moveresize, 0, {.i = (CWM_LEFT|CWM_PTRMOVE)} }, { "ptrmoveright", kbfunc_moveresize, 0, - (void *)(CWM_RIGHT|CWM_PTRMOVE) }, + {.i = (CWM_RIGHT|CWM_PTRMOVE)} }, { "bigptrmoveup", kbfunc_moveresize, 0, - (void *)(CWM_UP|CWM_PTRMOVE|CWM_BIGMOVE) }, + {.i = (CWM_UP|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "bigptrmovedown", kbfunc_moveresize, 0, - (void *)(CWM_DOWN|CWM_PTRMOVE|CWM_BIGMOVE) }, + {.i = (CWM_DOWN|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "bigptrmoveleft", kbfunc_moveresize, 0, - (void *)(CWM_LEFT|CWM_PTRMOVE|CWM_BIGMOVE) }, + {.i = (CWM_LEFT|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "bigptrmoveright", kbfunc_moveresize, 0, - (void *)(CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE) }, - { NULL, NULL, 0, 0}, + {.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} }, + { NULL, NULL, 0, {0}}, }; /* @@ -388,7 +388,7 @@ conf_bindname(struct conf *c, char *name, char *binding) } current_binding->callback = kbfunc_cmdexec; - current_binding->argument = xstrdup(binding); + current_binding->argument.c = xstrdup(binding); current_binding->flags = 0; conf_grab(c, current_binding); TAILQ_INSERT_TAIL(&c->keybindingq, current_binding, entry); -- cgit v1.2.3-2-gb3c3