summaryrefslogtreecommitdiff
path: root/mcwm.c
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2010-07-21 11:26:33 +0200
committerMichael Cardell Widerkrantz <mc@hack.org>2010-07-21 11:26:33 +0200
commit8bc5126791b4e3a5940a593ba4944ae7ed954ab5 (patch)
tree5db6ea871fb729a0f46773f55a33f900e15688e2 /mcwm.c
parent6eb5f2920a7b7d6e39cac07076564c20a000639c (diff)
downloadmcwm-8bc5126791b4e3a5940a593ba4944ae7ed954ab5.zip
Only warp pointer when moving by keyboard if the pointer is inside the
window to begin with.
Diffstat (limited to 'mcwm.c')
-rw-r--r--mcwm.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/mcwm.c b/mcwm.c
index c12830b..a30b6fb 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -1583,7 +1583,7 @@ void movestep(struct client *client, char direction)
uint16_t width;
uint16_t height;
xcb_drawable_t win;
-
+
if (NULL == client)
{
return;
@@ -1605,20 +1605,6 @@ void movestep(struct client *client, char direction)
width = width + BORDERWIDTH * 2;
height = height + BORDERWIDTH * 2;
- /*
- * ...but if the pointer is outside the window, move in, otherwise
- * we might happen to focus on another window when passing.
- */
- if (start_x > width)
- {
- start_x = width / 2;
- }
-
- if (start_y > height)
- {
- start_y = height / 2;
- }
-
raisewindow(win);
switch (direction)
@@ -1667,11 +1653,16 @@ void movestep(struct client *client, char direction)
break;
} /* switch direction */
- /* Move pointer back to where it was, relative to the window. */
- xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0,
- start_x, start_y);
-
- xcb_flush(conn);
+ /*
+ * If the pointer was inside the window to begin with, move
+ * pointer back to where it was, relative to the window.
+ */
+ if (start_x > 0 && start_x < width && start_y > 0 && start_y < height )
+ {
+ xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0,
+ start_x, start_y);
+ xcb_flush(conn);
+ }
}
void unmax(struct client *client)