aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortodd2007-11-13 23:08:49 +0000
committertodd2007-11-13 23:08:49 +0000
commitc641c916398e9b9368c59ef7052d88ba40c9ee5f (patch)
tree8b607e6be0124c9acdefd527afd0a5eab66616fb
parentf53c46c25991a5bc2b29f1a3a2469e1e1b446a4d (diff)
downloadcwm-c641c916398e9b9368c59ef7052d88ba40c9ee5f.tar.gz
enable pointer movement in cwm via C-<arrowkeys>
looked over by oga@
-rw-r--r--calmwm.h3
-rw-r--r--conf.c30
-rw-r--r--cwm.110
-rw-r--r--kbfunc.c40
4 files changed, 79 insertions, 4 deletions
diff --git a/calmwm.h b/calmwm.h
index 7382835..97893a6 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: calmwm.h,v 1.9 2007/11/07 21:58:03 oga Exp $
+ * $Id: calmwm.h,v 1.10 2007/11/13 23:08:49 todd Exp $
*/
#ifndef _CALMWM_H_
@@ -435,6 +435,7 @@ void kbfunc_client_move(struct client_ctx *, void *);
void kbfunc_client_resize(struct client_ctx *, void *);
void kbfunc_menu_search(struct client_ctx *, void *);
void kbfunc_exec(struct client_ctx *, void *);
+void kbfunc_ptrmove(struct client_ctx *, void *);
void kbfunc_ssh(struct client_ctx *, void *);
void kbfunc_term(struct client_ctx *cc, void *arg);
void kbfunc_lock(struct client_ctx *cc, void *arg);
diff --git a/conf.c b/conf.c
index eb40dbc..0192884 100644
--- a/conf.c
+++ b/conf.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
* All rights reserved.
*
- * $Id: conf.c,v 1.10 2007/11/07 22:00:26 oga Exp $
+ * $Id: conf.c,v 1.11 2007/11/13 23:08:49 todd Exp $
*/
#include "headers.h"
@@ -282,6 +282,26 @@ conf_setup(struct conf *c)
conf_bindkey(c, kbfunc_client_resize,
XK_H, ControlMask|Mod1Mask, KBFLAG_NEEDCLIENT,
(void *)(CWM_LEFT|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Up, ControlMask, 0, (void *)CWM_UP);
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Down, ControlMask, 0, (void *)CWM_DOWN);
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Right, ControlMask, 0, (void *)CWM_RIGHT);
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Left, ControlMask, 0, (void *)CWM_LEFT);
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Up, ControlMask|ShiftMask, 0,
+ (void *)(CWM_UP|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Left, ControlMask|ShiftMask, 0,
+ (void *)(CWM_LEFT|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Right, ControlMask|ShiftMask, 0,
+ (void *)(CWM_RIGHT|CWM_BIGMOVE));
+ conf_bindkey(c, kbfunc_ptrmove,
+ XK_Down, ControlMask|ShiftMask, 0,
+ (void *)(CWM_DOWN|CWM_BIGMOVE));
}
snprintf(dir_settings, sizeof(dir_settings),
@@ -392,6 +412,14 @@ struct {
{ "rcycle", kbfunc_client_rcycle, KBFLAG_NEEDCLIENT, 0 },
{ "label", kbfunc_client_label, KBFLAG_NEEDCLIENT, 0 },
{ "delete", kbfunc_client_delete, KBFLAG_NEEDCLIENT, 0 },
+ { "ptru", kbfunc_ptrmove, 0, (void *)CWM_UP },
+ { "ptrd", kbfunc_ptrmove, 0, (void *)CWM_DOWN },
+ { "ptrl", kbfunc_ptrmove, 0, (void *)CWM_LEFT },
+ { "ptrr", kbfunc_ptrmove, 0, (void *)CWM_RIGHT },
+ { "bigptru", kbfunc_ptrmove, 0, (void *)(CWM_UP|CWM_BIGMOVE) },
+ { "bigptrd", kbfunc_ptrmove, 0, (void *)(CWM_DOWN|CWM_BIGMOVE) },
+ { "bigptrl", kbfunc_ptrmove, 0, (void *)(CWM_LEFT|CWM_BIGMOVE) },
+ { "bigptrr", kbfunc_ptrmove, 0, (void *)(CWM_RIGHT|CWM_BIGMOVE) },
{ "groupselect", kbfunc_client_groupselect, 0, 0 },
{ "group1", kbfunc_client_group, 0, (void *)1 },
{ "group2", kbfunc_client_group, 0, (void *)2 },
diff --git a/cwm.1 b/cwm.1
index b10ecf5..e8d14ae 100644
--- a/cwm.1
+++ b/cwm.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwm.1,v 1.13 2007/11/08 13:03:22 oga Exp $
+.\" $OpenBSD: cwm.1,v 1.14 2007/11/13 23:08:49 todd Exp $
.\"
.\" The following requests are required for all man pages.
.Dd June 29, 2007
@@ -132,6 +132,14 @@ Set sticky group mode on.
The default behavior for new windows is to not assign any group.
This changes the default behavior to assigning the currrently selected
group to any newly created windows.
+.Pp
+.Sh POINTER MOVEMENT
+The pointer can be moved with the use of the keyboard through bindings.
+C-[UP|DOWN|LEFT|RIGHT] moves the pointer a small amount, while
+C-shift-[UP|DOWN|LEFT|RIGHT] moves the current window a larger amount.
+For example, to move the pointer to the left by a small amount,
+press C-LEFT.
+To move the pointer down by a larger amount, press C-shift-DOWN.
.El
.Sh WINDOW MOVEMENT AND RESIZING
.Nm
diff --git a/kbfunc.c b/kbfunc.c
index 923e00c..b748f60 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.9 2007/11/07 22:02:04 oga Exp $
+ * $Id: kbfunc.c,v 1.10 2007/11/13 23:08:49 todd Exp $
*/
#include <paths.h>
@@ -113,6 +113,44 @@ kbfunc_client_resize(struct client_ctx *cc, void *arg)
}
void
+kbfunc_ptrmove(struct client_ctx *cc, void *arg)
+{
+ int px,py,mx,my,flags,amt;
+ struct screen_ctx *sc = screen_current();
+ my = mx = 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;
+ }
+
+ if (cc) {
+ xu_ptr_getpos(cc->pwin, &px, &py);
+ xu_ptr_setpos(cc->pwin, px + mx, py + my);
+ } else {
+ xu_ptr_getpos(sc->rootwin, &px, &py);
+ xu_ptr_setpos(sc->rootwin, px + mx, py + my);
+ }
+}
+
+void
kbfunc_client_search(struct client_ctx *scratch, void *arg)
{
struct menu_q menuq;