diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2013-07-08 18:19:23 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2013-07-08 18:19:23 +0000 |
commit | f6ffd81276f31f2bd3c111ff62a876dd219e7659 (patch) | |
tree | b59764b950bc8f86ddfbdc8683dd6ca63b107d9a /app | |
parent | 9261b2142e168d06a205d022fc0cb67d2cc4d5f0 (diff) |
move kbfunc and mousefunc closer together
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 21 | ||||
-rw-r--r-- | app/cwm/conf.c | 73 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 4 | ||||
-rw-r--r-- | app/cwm/mousefunc.c | 14 | ||||
-rw-r--r-- | app/cwm/xevents.c | 6 |
5 files changed, 61 insertions, 57 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index dbf26758d..c3a68d9e0 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.214 2013/07/08 16:32:51 okan Exp $ + * $OpenBSD: calmwm.h,v 1.215 2013/07/08 18:19:22 okan Exp $ */ #ifndef _CALMWM_H_ @@ -258,7 +258,7 @@ struct mousebinding { u_int button; #define MOUSEBIND_CTX_ROOT 0x0001 #define MOUSEBIND_CTX_WIN 0x0002 - int context; + int flags; }; TAILQ_HEAD(mousebinding_q, mousebinding); @@ -403,6 +403,8 @@ void kbfunc_client_label(struct client_ctx *, union arg *); void kbfunc_client_lower(struct client_ctx *, union arg *); void kbfunc_client_maximize(struct client_ctx *, union arg *); +void kbfunc_client_moveresize(struct client_ctx *, + union arg *); void kbfunc_client_movetogroup(struct client_ctx *, union arg *); void kbfunc_client_nogroup(struct client_ctx *, @@ -416,23 +418,22 @@ void kbfunc_cmdexec(struct client_ctx *, union arg *); void kbfunc_exec(struct client_ctx *, union arg *); void kbfunc_lock(struct client_ctx *, union arg *); void kbfunc_menu_search(struct client_ctx *, union arg *); -void kbfunc_moveresize(struct client_ctx *, union arg *); void kbfunc_quit_wm(struct client_ctx *, union arg *); void kbfunc_restart(struct client_ctx *, union arg *); void kbfunc_ssh(struct client_ctx *, union arg *); void kbfunc_term(struct client_ctx *, union arg *); void kbfunc_tile(struct client_ctx *, 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 *); +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 *); -void mousefunc_window_grouptoggle(struct client_ctx *, - void *); -void mousefunc_window_hide(struct client_ctx *, void *); -void mousefunc_window_lower(struct client_ctx *, void *); -void mousefunc_window_move(struct client_ctx *, void *); -void mousefunc_window_raise(struct client_ctx *, void *); -void mousefunc_window_resize(struct client_ctx *, void *); 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 421afffae..cdb797204 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.139 2013/07/08 16:32:51 okan Exp $ + * $OpenBSD: conf.c,v 1.140 2013/07/08 18:19:22 okan Exp $ */ #include <sys/param.h> @@ -32,8 +32,8 @@ #include "calmwm.h" static const char *conf_bind_getmask(const char *, u_int *); -static void conf_unbind_mouse(struct conf *, struct mousebinding *); static void conf_unbind_kbd(struct conf *, struct keybinding *); +static void conf_unbind_mouse(struct conf *, struct mousebinding *); /* Add an command menu entry to the end of the menu */ void @@ -382,50 +382,53 @@ static struct { { "ssh", kbfunc_ssh, 0, {0} }, { "terminal", kbfunc_term, 0, {0} }, { "lock", kbfunc_lock, 0, {0} }, - { "moveup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "moveup", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_UP|CWM_MOVE)} }, - { "movedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "movedown", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_DOWN|CWM_MOVE)} }, - { "moveright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "moveright", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_RIGHT|CWM_MOVE)} }, - { "moveleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "moveleft", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_LEFT|CWM_MOVE)} }, - { "bigmoveup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigmoveup", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_UP|CWM_MOVE|CWM_BIGMOVE)} }, - { "bigmovedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigmovedown", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_DOWN|CWM_MOVE|CWM_BIGMOVE)} }, - { "bigmoveright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigmoveright", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_RIGHT|CWM_MOVE|CWM_BIGMOVE)} }, - { "bigmoveleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigmoveleft", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_LEFT|CWM_MOVE|CWM_BIGMOVE)} }, - { "resizeup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "resizeup", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_UP|CWM_RESIZE)} }, - { "resizedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "resizedown", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_DOWN|CWM_RESIZE)} }, - { "resizeright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "resizeright", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_RIGHT|CWM_RESIZE)} }, - { "resizeleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "resizeleft", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_LEFT|CWM_RESIZE)} }, - { "bigresizeup", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigresizeup", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_UP|CWM_RESIZE|CWM_BIGMOVE)} }, - { "bigresizedown", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigresizedown", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_DOWN|CWM_RESIZE|CWM_BIGMOVE)} }, - { "bigresizeright", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigresizeright", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.i = (CWM_RIGHT|CWM_RESIZE|CWM_BIGMOVE)} }, - { "bigresizeleft", kbfunc_moveresize, KBFLAG_NEEDCLIENT, + { "bigresizeleft", kbfunc_client_moveresize, KBFLAG_NEEDCLIENT, {.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, + { "ptrmoveup", kbfunc_client_moveresize, 0, + {.i = (CWM_UP|CWM_PTRMOVE)} }, + { "ptrmovedown", kbfunc_client_moveresize, 0, + {.i = (CWM_DOWN|CWM_PTRMOVE)} }, + { "ptrmoveleft", kbfunc_client_moveresize, 0, + {.i = (CWM_LEFT|CWM_PTRMOVE)} }, + { "ptrmoveright", kbfunc_client_moveresize, 0, {.i = (CWM_RIGHT|CWM_PTRMOVE)} }, - { "bigptrmoveup", kbfunc_moveresize, 0, + { "bigptrmoveup", kbfunc_client_moveresize, 0, {.i = (CWM_UP|CWM_PTRMOVE|CWM_BIGMOVE)} }, - { "bigptrmovedown", kbfunc_moveresize, 0, + { "bigptrmovedown", kbfunc_client_moveresize, 0, {.i = (CWM_DOWN|CWM_PTRMOVE|CWM_BIGMOVE)} }, - { "bigptrmoveleft", kbfunc_moveresize, 0, + { "bigptrmoveleft", kbfunc_client_moveresize, 0, {.i = (CWM_LEFT|CWM_PTRMOVE|CWM_BIGMOVE)} }, - { "bigptrmoveright", kbfunc_moveresize, 0, + { "bigptrmoveright", kbfunc_client_moveresize, 0, {.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "htile", kbfunc_tile, KBFLAG_NEEDCLIENT, {.i = CWM_TILE_HORIZ } }, @@ -538,15 +541,15 @@ conf_unbind_kbd(struct conf *c, struct keybinding *unbind) static struct { char *tag; void (*handler)(struct client_ctx *, void *); - int context; + int flags; } name_to_mousefunc[] = { - { "window_move", mousefunc_window_move, MOUSEBIND_CTX_WIN }, - { "window_resize", mousefunc_window_resize, MOUSEBIND_CTX_WIN }, - { "window_grouptoggle", mousefunc_window_grouptoggle, + { "window_move", mousefunc_client_move, MOUSEBIND_CTX_WIN }, + { "window_resize", mousefunc_client_resize, MOUSEBIND_CTX_WIN }, + { "window_grouptoggle", mousefunc_client_grouptoggle, MOUSEBIND_CTX_WIN }, - { "window_lower", mousefunc_window_lower, MOUSEBIND_CTX_WIN }, - { "window_raise", mousefunc_window_raise, MOUSEBIND_CTX_WIN }, - { "window_hide", mousefunc_window_hide, 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 }, { "menu_group", mousefunc_menu_group, MOUSEBIND_CTX_ROOT }, { "menu_unhide", mousefunc_menu_unhide, MOUSEBIND_CTX_ROOT }, { "menu_cmd", mousefunc_menu_cmd, MOUSEBIND_CTX_ROOT }, @@ -594,8 +597,8 @@ conf_bind_mouse(struct conf *c, char *name, char *binding) if (strcmp(name_to_mousefunc[i].tag, binding) != 0) continue; - current_binding->context = name_to_mousefunc[i].context; current_binding->callback = name_to_mousefunc[i].handler; + current_binding->flags = name_to_mousefunc[i].flags; TAILQ_INSERT_TAIL(&c->mousebindingq, current_binding, entry); return (1); } @@ -642,7 +645,7 @@ conf_grab_mouse(Window win) struct mousebinding *mb; TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { - if (mb->context != MOUSEBIND_CTX_WIN) + if (mb->flags != MOUSEBIND_CTX_WIN) continue; xu_btn_grab(win, mb->modmask, mb->button); } diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 8cec31157..419c0965d 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.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: kbfunc.c,v 1.78 2013/05/11 22:03:17 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.79 2013/07/08 18:19:22 okan Exp $ */ #include <sys/param.h> @@ -53,7 +53,7 @@ kbfunc_client_raise(struct client_ctx *cc, union arg *arg) #define TYPEMASK (CWM_MOVE | CWM_RESIZE | CWM_PTRMOVE) #define MOVEMASK (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT) void -kbfunc_moveresize(struct client_ctx *cc, union arg *arg) +kbfunc_client_moveresize(struct client_ctx *cc, union arg *arg) { struct screen_ctx *sc = cc->sc; int x, y, flags, amt; diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index 1872aefcc..c44c3fcc7 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.53 2013/06/17 17:11:10 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.54 2013/07/08 18:19:22 okan Exp $ */ #include <sys/param.h> @@ -68,7 +68,7 @@ mousefunc_sweep_draw(struct client_ctx *cc) } void -mousefunc_window_resize(struct client_ctx *cc, void *arg) +mousefunc_client_resize(struct client_ctx *cc, void *arg) { XEvent ev; Time ltime = 0; @@ -125,7 +125,7 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg) } void -mousefunc_window_move(struct client_ctx *cc, void *arg) +mousefunc_client_move(struct client_ctx *cc, void *arg) { XEvent ev; Time ltime = 0; @@ -177,26 +177,26 @@ mousefunc_window_move(struct client_ctx *cc, void *arg) } void -mousefunc_window_grouptoggle(struct client_ctx *cc, void *arg) +mousefunc_client_grouptoggle(struct client_ctx *cc, void *arg) { group_sticky_toggle_enter(cc); } void -mousefunc_window_lower(struct client_ctx *cc, void *arg) +mousefunc_client_lower(struct client_ctx *cc, void *arg) { client_ptrsave(cc); client_lower(cc); } void -mousefunc_window_raise(struct client_ctx *cc, void *arg) +mousefunc_client_raise(struct client_ctx *cc, void *arg) { client_raise(cc); } void -mousefunc_window_hide(struct client_ctx *cc, void *arg) +mousefunc_client_hide(struct client_ctx *cc, void *arg) { client_hide(cc); } diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index c222e3eb2..bd2b715c4 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.86 2013/07/08 15:46:16 okan Exp $ + * $OpenBSD: xevents.c,v 1.87 2013/07/08 18:19:22 okan Exp $ */ /* @@ -253,12 +253,12 @@ xev_handle_buttonpress(XEvent *ee) if (mb == NULL) return; - if (mb->context == MOUSEBIND_CTX_ROOT) { + if (mb->flags == MOUSEBIND_CTX_ROOT) { if (e->window != sc->rootwin) return; cc = &fakecc; cc->sc = screen_fromroot(e->window); - } else if (cc == NULL) /* (mb->context == MOUSEBIND_CTX_WIN */ + } else if (cc == NULL) /* (mb->flags == MOUSEBIND_CTX_WIN */ return; (*mb->callback)(cc, e); |