summaryrefslogtreecommitdiff
path: root/app/cwm/kbfunc.c
diff options
context:
space:
mode:
authorTodd T. Fries <todd@cvs.openbsd.org>2007-06-27 13:28:23 +0000
committerTodd T. Fries <todd@cvs.openbsd.org>2007-06-27 13:28:23 +0000
commitdfb2208eff8966db26e0ab1e8ea587aa86c6a3e9 (patch)
tree20a2c122aff4ee6e5ad000c1ebe67907027d24c8 /app/cwm/kbfunc.c
parentde1fa057edd8619c185b2484482260f899d097e7 (diff)
implement keyboard initiated movement of windows
enhanced version of diff originally from niallo@ man bits from niallo@ ok niallo@ japser@
Diffstat (limited to 'app/cwm/kbfunc.c')
-rw-r--r--app/cwm/kbfunc.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index a2063209a..adb4d8261 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.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;