diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2016-11-15 00:07:04 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2016-11-15 00:07:04 +0000 |
commit | d82fa8a0d4a83b484abae9acd95480e80f857858 (patch) | |
tree | 142892f96442ae9856c3d59682c2e4b08a208386 /app | |
parent | 5fc21d5b625d618540cc1bb0daeb2e3aeb40c765 (diff) |
Add a wrapper based upon xevent handlers around client move/resize for key and
mouse bindings.
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.h | 4 | ||||
-rw-r--r-- | app/cwm/conf.c | 6 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 24 |
3 files changed, 29 insertions, 5 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 7867dc2fe..c948bf1be 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.331 2016/11/14 21:25:59 okan Exp $ + * $OpenBSD: calmwm.h,v 1.332 2016/11/15 00:07:03 okan Exp $ */ #ifndef _CALMWM_H_ @@ -463,7 +463,9 @@ void screen_assert_clients_within(struct screen_ctx *); void kbfunc_cwm_status(void *, union arg *, enum xev); void kbfunc_ptrmove(void *, union arg *, enum xev); void kbfunc_client_move(void *, union arg *, enum xev); +void kbfunc_client_move_key(void *, union arg *, enum xev); void kbfunc_client_resize(void *, union arg *, enum xev); +void kbfunc_client_resize_key(void *, union arg *, enum xev); void kbfunc_client_delete(void *, union arg *, enum xev); void kbfunc_client_lower(void *, union arg *, enum xev); void kbfunc_client_raise(void *, union arg *, enum xev); diff --git a/app/cwm/conf.c b/app/cwm/conf.c index bcae78df1..902fe9025 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.222 2016/11/14 21:25:59 okan Exp $ + * $OpenBSD: conf.c,v 1.223 2016/11/15 00:07:03 okan Exp $ */ #include <sys/types.h> @@ -177,8 +177,8 @@ static const struct { { "window_lower", kbfunc_client_lower, CWM_CONTEXT_CC, {0} }, { "window_raise", kbfunc_client_raise, CWM_CONTEXT_CC, {0} }, { "window_hide", kbfunc_client_hide, CWM_CONTEXT_CC, {0} }, - { "window_move", mousefunc_client_move, CWM_CONTEXT_CC, {0} }, - { "window_resize", mousefunc_client_resize, CWM_CONTEXT_CC, {0} }, + { "window_move", kbfunc_client_move, CWM_CONTEXT_CC, {0} }, + { "window_resize", kbfunc_client_resize, CWM_CONTEXT_CC, {0} }, { "window_grouptoggle", kbfunc_client_toggle_group, CWM_CONTEXT_CC, {0} }, { "menu_group", kbfunc_menu_group, CWM_CONTEXT_SC, {0} }, { "menu_unhide", kbfunc_menu_client, CWM_CONTEXT_SC, {0} }, diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 76f3d2e1b..a9d69391b 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.134 2016/10/24 20:44:08 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.135 2016/11/15 00:07:03 okan Exp $ */ #include <sys/types.h> @@ -86,6 +86,17 @@ kbfunc_ptrmove(void *ctx, union arg *arg, enum xev xev) void kbfunc_client_move(void *ctx, union arg *arg, enum xev xev) { + int m = (xev == CWM_XEV_BTN); + + if (m) + mousefunc_client_move(ctx, arg, xev); + else + kbfunc_client_move_key(ctx, arg, xev); +} + +void +kbfunc_client_move_key(void *ctx, union arg *arg, enum xev xev) +{ struct client_ctx *cc = ctx; struct screen_ctx *sc = cc->sc; struct geom area; @@ -140,6 +151,17 @@ kbfunc_client_move(void *ctx, union arg *arg, enum xev xev) void kbfunc_client_resize(void *ctx, union arg *arg, enum xev xev) { + int m = (xev == CWM_XEV_BTN); + + if (m) + mousefunc_client_resize(ctx, arg, xev); + else + kbfunc_client_resize_key(ctx, arg, xev); +} + +void +kbfunc_client_resize_key(void *ctx, union arg *arg, enum xev xev) +{ struct client_ctx *cc = ctx; unsigned int mx = 0, my = 0; int amt = 1; |