From c641c916398e9b9368c59ef7052d88ba40c9ee5f Mon Sep 17 00:00:00 2001 From: todd Date: Tue, 13 Nov 2007 23:08:49 +0000 Subject: enable pointer movement in cwm via C- looked over by oga@ --- kbfunc.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'kbfunc.c') 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 * 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 @@ -112,6 +112,44 @@ kbfunc_client_resize(struct client_ctx *cc, void *arg) client_ptrwarp(cc); } +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) { -- cgit v1.2.3-2-gb3c3