diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2014-01-02 21:30:21 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2014-01-02 21:30:21 +0000 |
commit | 0a226b04d4c91535c2ac4eb148260dab02c9389c (patch) | |
tree | 9d4f79a521be68c9057cc14e75cade1a9518c1ea | |
parent | 4b2a75f4c049b0768035456d4b79ee80fefc2f3f (diff) |
bring mousefunc closer to kbfunc
-rw-r--r-- | app/cwm/calmwm.h | 33 | ||||
-rw-r--r-- | app/cwm/conf.c | 33 | ||||
-rw-r--r-- | app/cwm/mousefunc.c | 24 | ||||
-rw-r--r-- | app/cwm/xevents.c | 4 |
4 files changed, 52 insertions, 42 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 7679a299d..156b97c14 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -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: calmwm.h,v 1.238 2014/01/02 21:17:23 okan Exp $ + * $OpenBSD: calmwm.h,v 1.239 2014/01/02 21:30:20 okan Exp $ */ #ifndef _CALMWM_H_ @@ -255,7 +255,8 @@ TAILQ_HEAD(keybinding_q, keybinding); struct mousebinding { TAILQ_ENTRY(mousebinding) entry; - void (*callback)(struct client_ctx *, void *); + void (*callback)(struct client_ctx *, union arg *); + union arg argument; u_int modmask; u_int button; #define MOUSEBIND_CTX_ROOT 0x0001 @@ -483,19 +484,25 @@ void kbfunc_term(struct client_ctx *, union arg *); void kbfunc_tile(struct client_ctx *, union arg *); void mousefunc_client_cyclegroup(struct client_ctx *, - void *); + union arg *); void mousefunc_client_grouptoggle(struct client_ctx *, - void *); -void mousefunc_client_hide(struct client_ctx *, void *); -void mousefunc_client_lower(struct client_ctx *, void *); -void mousefunc_client_move(struct client_ctx *, void *); -void mousefunc_client_raise(struct client_ctx *, void *); + union arg *); +void mousefunc_client_hide(struct client_ctx *, + union arg *); +void mousefunc_client_lower(struct client_ctx *, + union arg *); +void mousefunc_client_move(struct client_ctx *, + union arg *); +void mousefunc_client_raise(struct client_ctx *, + union arg *); void mousefunc_client_rcyclegroup(struct client_ctx *, - void *); -void mousefunc_client_resize(struct client_ctx *, void *); -void mousefunc_menu_cmd(struct client_ctx *, void *); -void mousefunc_menu_group(struct client_ctx *, void *); -void mousefunc_menu_unhide(struct client_ctx *, void *); + union arg *); +void mousefunc_client_resize(struct client_ctx *, + union arg *); +void mousefunc_menu_cmd(struct client_ctx *, union arg *); +void mousefunc_menu_group(struct client_ctx *, union arg *); +void mousefunc_menu_unhide(struct client_ctx *, + union arg *); struct menu *menu_filter(struct screen_ctx *, struct menu_q *, char *, char *, int, diff --git a/app/cwm/conf.c b/app/cwm/conf.c index b651fc0c7..05432d3e8 100644 --- a/app/cwm/conf.c +++ b/app/cwm/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.153 2013/12/17 16:10:43 okan Exp $ + * $OpenBSD: conf.c,v 1.154 2014/01/02 21:30:20 okan Exp $ */ #include <sys/param.h> @@ -535,22 +535,24 @@ conf_unbind_kbd(struct conf *c, struct keybinding *unbind) } static struct { - char *tag; - void (*handler)(struct client_ctx *, void *); - int flags; + char *tag; + void (*handler)(struct client_ctx *, union arg *); + int flags; + union arg argument; } name_to_mousefunc[] = { - { "window_move", mousefunc_client_move, MOUSEBIND_CTX_WIN }, - { "window_resize", mousefunc_client_resize, MOUSEBIND_CTX_WIN }, + { "window_move", mousefunc_client_move, MOUSEBIND_CTX_WIN, {0} }, + { "window_resize", mousefunc_client_resize, MOUSEBIND_CTX_WIN, {0} }, { "window_grouptoggle", mousefunc_client_grouptoggle, - MOUSEBIND_CTX_WIN }, - { "window_lower", mousefunc_client_lower, MOUSEBIND_CTX_WIN }, - { "window_raise", mousefunc_client_raise, MOUSEBIND_CTX_WIN }, - { "window_hide", mousefunc_client_hide, MOUSEBIND_CTX_WIN }, - { "cyclegroup", mousefunc_client_cyclegroup, MOUSEBIND_CTX_ROOT }, - { "rcyclegroup", mousefunc_client_rcyclegroup, MOUSEBIND_CTX_ROOT }, - { "menu_group", mousefunc_menu_group, MOUSEBIND_CTX_ROOT }, - { "menu_unhide", mousefunc_menu_unhide, MOUSEBIND_CTX_ROOT }, - { "menu_cmd", mousefunc_menu_cmd, MOUSEBIND_CTX_ROOT }, + MOUSEBIND_CTX_WIN, {0} }, + { "window_lower", mousefunc_client_lower, MOUSEBIND_CTX_WIN, {0} }, + { "window_raise", mousefunc_client_raise, MOUSEBIND_CTX_WIN, {0} }, + { "window_hide", mousefunc_client_hide, MOUSEBIND_CTX_WIN, {0} }, + { "cyclegroup", mousefunc_client_cyclegroup, MOUSEBIND_CTX_ROOT, {0} }, + { "rcyclegroup", mousefunc_client_rcyclegroup, + MOUSEBIND_CTX_ROOT, {0} }, + { "menu_group", mousefunc_menu_group, MOUSEBIND_CTX_ROOT, {0} }, + { "menu_unhide", mousefunc_menu_unhide, MOUSEBIND_CTX_ROOT, {0} }, + { "menu_cmd", mousefunc_menu_cmd, MOUSEBIND_CTX_ROOT, {0} }, }; static unsigned int mouse_btns[] = { @@ -597,6 +599,7 @@ conf_bind_mouse(struct conf *c, char *name, char *binding) current_binding->callback = name_to_mousefunc[i].handler; current_binding->flags = name_to_mousefunc[i].flags; + current_binding->argument = name_to_mousefunc[i].argument; TAILQ_INSERT_TAIL(&c->mousebindingq, current_binding, entry); return (1); } diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index 4d974eb10..b7418ce91 100644 --- a/app/cwm/mousefunc.c +++ b/app/cwm/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.64 2013/12/13 22:39:13 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.65 2014/01/02 21:30:20 okan Exp $ */ #include <sys/param.h> @@ -66,7 +66,7 @@ mousefunc_sweep_draw(struct client_ctx *cc) } void -mousefunc_client_resize(struct client_ctx *cc, void *arg) +mousefunc_client_resize(struct client_ctx *cc, union arg *arg) { XEvent ev; Time ltime = 0; @@ -120,7 +120,7 @@ mousefunc_client_resize(struct client_ctx *cc, void *arg) } void -mousefunc_client_move(struct client_ctx *cc, void *arg) +mousefunc_client_move(struct client_ctx *cc, union arg *arg) { XEvent ev; Time ltime = 0; @@ -173,50 +173,50 @@ mousefunc_client_move(struct client_ctx *cc, void *arg) } void -mousefunc_client_grouptoggle(struct client_ctx *cc, void *arg) +mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg) { group_sticky_toggle_enter(cc); } void -mousefunc_client_lower(struct client_ctx *cc, void *arg) +mousefunc_client_lower(struct client_ctx *cc, union arg *arg) { client_ptrsave(cc); client_lower(cc); } void -mousefunc_client_raise(struct client_ctx *cc, void *arg) +mousefunc_client_raise(struct client_ctx *cc, union arg *arg) { client_raise(cc); } void -mousefunc_client_hide(struct client_ctx *cc, void *arg) +mousefunc_client_hide(struct client_ctx *cc, union arg *arg) { client_hide(cc); } void -mousefunc_client_cyclegroup(struct client_ctx *cc, void *arg) +mousefunc_client_cyclegroup(struct client_ctx *cc, union arg *arg) { group_cycle(cc->sc, CWM_CYCLE); } void -mousefunc_client_rcyclegroup(struct client_ctx *cc, void *arg) +mousefunc_client_rcyclegroup(struct client_ctx *cc, union arg *arg) { group_cycle(cc->sc, CWM_RCYCLE); } void -mousefunc_menu_group(struct client_ctx *cc, void *arg) +mousefunc_menu_group(struct client_ctx *cc, union arg *arg) { group_menu(cc->sc); } void -mousefunc_menu_unhide(struct client_ctx *cc, void *arg) +mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) { struct screen_ctx *sc = cc->sc; struct client_ctx *old_cc; @@ -258,7 +258,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg) } void -mousefunc_menu_cmd(struct client_ctx *cc, void *arg) +mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg) { struct screen_ctx *sc = cc->sc; struct menu *mi; diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index 20e6aee7d..78418244a 100644 --- a/app/cwm/xevents.c +++ b/app/cwm/xevents.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: xevents.c,v 1.100 2013/12/13 14:45:47 okan Exp $ + * $OpenBSD: xevents.c,v 1.101 2014/01/02 21:30:20 okan Exp $ */ /* @@ -246,7 +246,7 @@ xev_handle_buttonpress(XEvent *ee) cc->sc = screen_fromroot(e->window); } - (*mb->callback)(cc, e); + (*mb->callback)(cc, &mb->argument); } static void |