From beac2ba833b912b819fae48ec268373ee994efbd Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 8 Feb 2025 00:29:10 -0800 Subject: key: early support for XK_m modifier to chase focus Particularly on large multi-head display setups it can be annoying to have to find the mouse pointer after long periods of not using it, on the rare occasion one must bring it to the currently focused window to do a pointer operation. This commit introduces XK_m for controlling a "chase_it" flag, which future commits will utilize for augmenting focus-changing operations, and maybe window configuring operations, by warping the pointer to the center of the focused window /after/ the augmented operation has been performed. --- src/key.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/key.c b/src/key.c index e40a3d1..4061236 100644 --- a/src/key.c +++ b/src/key.c @@ -32,6 +32,7 @@ static int key_is_grabbed; /* flag for tracking keyboard grab state */ static vwm_direction_t direction = VWM_DIRECTION_FORWARD; /* flag for reversing directional actions */ static int send_it; /* flag for "sending" a migration operation without following it */ +static int chase_it; /* flag for "chasing" a focus operation with the pointer */ /* Poll the keyboard state to see if _any_ keys are pressed */ static int keys_pressed(vwm_t *vwm) @@ -80,6 +81,12 @@ void vwm_key_released(vwm_t *vwm, Window win, XKeyReleasedEvent *keyrelease) break; + case XK_m: + VWM_TRACE("XK_m released with chase_it=%i", chase_it); + chase_it = 0; + break; + + case XK_r: VWM_TRACE("XK_r released with direction=%i", direction); direction = VWM_DIRECTION_FORWARD; @@ -144,6 +151,11 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress) VWM_TRACE("aborting with origin %p", vwm->focused_origin); break; + case XK_m: /* "chase" focus actions with pointer */ + VWM_TRACE("XK_r pressed with chase_it=%i", chase_it); + chase_it = 1; + break; + case XK_r: /* reverse directional actions */ VWM_TRACE("XK_r pressed with direction=%i", direction); direction = VWM_DIRECTION_REVERSE; -- cgit v1.2.3