diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-07 21:58:04 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2007-11-07 21:58:04 +0000 |
commit | 379780af0474330adc114ff8f8a187ba946d4bb7 (patch) | |
tree | 011d96f1586cc43ee45b7c5df1a5e291720f40a0 /app/cwm/kbfunc.c | |
parent | 4d85406f294e338756cc783a988255193db34c89 (diff) |
Add support to cwm for resizing the windows using Control-Meta-[hjkl].
Please note that this remaps Control-Meta-L (label) to Control-Meta-N (name).
ok jasper@, todd@.
Diffstat (limited to 'app/cwm/kbfunc.c')
-rw-r--r-- | app/cwm/kbfunc.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index ca2e13ba5..f784c2614 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -4,7 +4,7 @@ * Copyright (c) 2004 Martin Murray <mmurray@monkey.org> * All rights reserved. * - * $Id: kbfunc.c,v 1.7 2007/09/06 06:01:14 jasper Exp $ + * $Id: kbfunc.c,v 1.8 2007/11/07 21:58:03 oga Exp $ */ #include <paths.h> @@ -67,6 +67,51 @@ kbfunc_client_move(struct client_ctx *cc, void *arg) cc->ptr.x = x + mx; client_ptrwarp(cc); } + +void +kbfunc_client_resize(struct client_ctx *cc, void *arg) +{ + int flags,mx,my; + u_int amt; + + mx = my = 0; + + flags = (int)arg; + amt = MOVE_AMOUNT; + + if (flags & CWM_BIGMOVE) { + flags -= CWM_BIGMOVE; + amt = amt*10; + } + + switch(flags) { + case CWM_UP: + my -= amt; + break; + case CWM_DOWN: + my += amt; + break; + case CWM_RIGHT: + mx += amt; + break; + case CWM_LEFT: + mx -= amt; + break; + } + + cc->geom.height += my; + cc->geom.width += mx; + client_resize(cc); + + /* + * Moving the cursor while resizing is problematic. Just place + * it in the middle of the window. + */ + cc->ptr.x = -1; + cc->ptr.y = -1; + client_ptrwarp(cc); +} + void kbfunc_client_search(struct client_ctx *scratch, void *arg) { |