diff options
author | oga <oga> | 2007-11-07 21:58:03 +0000 |
---|---|---|
committer | oga <oga> | 2007-11-07 21:58:03 +0000 |
commit | 699b04895988048447b0b80c2d751db4de4d18c0 (patch) | |
tree | f37bb3cbd49475d041233ae8b44355f8c1efb465 /kbfunc.c | |
parent | af71fc930af0ef837a0a06f98cdd77d9c704a171 (diff) | |
download | cwm-699b04895988048447b0b80c2d751db4de4d18c0.tar.gz cwm-699b04895988048447b0b80c2d751db4de4d18c0.tar.xz cwm-699b04895988048447b0b80c2d751db4de4d18c0.zip |
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 'kbfunc.c')
-rw-r--r-- | kbfunc.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/kbfunc.c b/kbfunc.c index 85fee93..32dbb28 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -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) { |