Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-27 05:30:09 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-27 05:30:09 +0400
commitabaa4cd4902524c950469a87063b2e0ba742961f (patch)
tree74e153ca49865dd280b5e7f0aa38da89eb98ef27 /source/blender/windowmanager/intern/wm_cursors.c
parent79f7a78637d4b1691ab1469ee2785d66712c28fb (diff)
fix [#36409] Continuous Grab problem with arrow keys.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_cursors.c')
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 515f80b0ade..e76d38dd0e2 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -49,6 +49,7 @@
#include "WM_types.h"
#include "WM_api.h"
#include "wm_cursors.h"
+#include "wm_window.h"
/* XXX this still is mess from old code */
@@ -233,25 +234,32 @@ void WM_cursor_grab_disable(wmWindow *win, int mouse_ungrab_xy[2])
}
}
+static void wm_cursor_warp_relative(wmWindow *win, int x, int y)
+{
+ /* note: don't use wmEvent coords because of continuous grab [#36409] */
+ int cx, cy;
+ wm_get_cursor_position(win, &cx, &cy);
+ WM_cursor_warp(win, cx + x, cy + y);
+}
+
/* give it a modal keymap one day? */
int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
{
if (win && event->val == KM_PRESS) {
-
if (event->type == UPARROWKEY) {
- WM_cursor_warp(win, event->x, event->y + 1);
+ wm_cursor_warp_relative(win, 0, 1);
return 1;
}
else if (event->type == DOWNARROWKEY) {
- WM_cursor_warp(win, event->x, event->y - 1);
+ wm_cursor_warp_relative(win, 0, -1);
return 1;
}
else if (event->type == LEFTARROWKEY) {
- WM_cursor_warp(win, event->x - 1, event->y);
+ wm_cursor_warp_relative(win, -1, 0);
return 1;
}
else if (event->type == RIGHTARROWKEY) {
- WM_cursor_warp(win, event->x + 1, event->y);
+ wm_cursor_warp_relative(win, 1, 0);
return 1;
}
}