aboutsummaryrefslogtreecommitdiffstats
path: root/kbfunc.c
diff options
context:
space:
mode:
authortodd2007-06-27 13:28:22 +0000
committertodd2007-06-27 13:28:22 +0000
commit87387d9bcaf92813d3dd4ed8e389aa98725f3b19 (patch)
tree476b140e8a7449689c82a95b2d55fad4064a1499 /kbfunc.c
parentd159196cb5b6b857a36ebbc97e19e6205ab1c98d (diff)
downloadcwm-87387d9bcaf92813d3dd4ed8e389aa98725f3b19.tar.gz
implement keyboard initiated movement of windows
enhanced version of diff originally from niallo@ man bits from niallo@ ok niallo@ japser@
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/kbfunc.c b/kbfunc.c
index a206320..adb4d82 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Martin Murray <mmurray@monkey.org>
* All rights reserved.
*
- * $Id: kbfunc.c,v 1.5 2007/06/26 19:34:26 niallo Exp $
+ * $Id: kbfunc.c,v 1.6 2007/06/27 13:28:22 todd Exp $
*/
#include <paths.h>
@@ -14,6 +14,7 @@
#define KNOWN_HOSTS ".ssh/known_hosts"
#define HASH_MARKER "|1|"
+#define MOVE_AMOUNT 10
void
kbfunc_client_lower(struct client_ctx *cc, void *arg)
@@ -28,6 +29,45 @@ kbfunc_client_raise(struct client_ctx *cc, void *arg)
}
void
+kbfunc_client_move(struct client_ctx *cc, void *arg)
+{
+ int x,y,flags,amt;
+ u_int mx,my;
+
+ 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.y += my;
+ cc->geom.x += mx;
+ client_move(cc);
+ xu_ptr_getpos(cc->pwin, &x, &y);
+ cc->ptr.y = y + my;
+ cc->ptr.x = x + mx;
+ client_ptrwarp(cc);
+}
+void
kbfunc_client_search(struct client_ctx *scratch, void *arg)
{
struct menu_q menuq;