From 87387d9bcaf92813d3dd4ed8e389aa98725f3b19 Mon Sep 17 00:00:00 2001 From: todd Date: Wed, 27 Jun 2007 13:28:22 +0000 Subject: implement keyboard initiated movement of windows enhanced version of diff originally from niallo@ man bits from niallo@ ok niallo@ japser@ --- kbfunc.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'kbfunc.c') 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 * 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 @@ -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) @@ -27,6 +28,45 @@ kbfunc_client_raise(struct client_ctx *cc, void *arg) client_raise(cc); } +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) { -- cgit v1.2.3-2-gb3c3