diff options
author | Ton Roosendaal <ton@blender.org> | 2011-03-07 17:56:19 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-03-07 17:56:19 +0300 |
commit | 2818add58689b2c126662dc2db056a06a5f937ff (patch) | |
tree | bc7e776506d63f4a411989f07a10efb80831e26c /source/blender/windowmanager/intern/wm_cursors.c | |
parent | c9685af1ffc0ee4cfb5411de04fbfd317b05af4d (diff) |
From the OFTL:
Arrows-move-cursor is back!
It now works for any running modal operator that doesn't handle own
arrow keys. Might need to become more restricted though, some modal
ops don't need it. Want to investigate that still where conflicts are.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_cursors.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 5951393a497..32a4648c7f8 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -47,6 +47,7 @@ #include "BKE_main.h" #include "WM_api.h" +#include "WM_types.h" #include "wm_cursors.h" /* XXX this still is mess from old code */ @@ -211,6 +212,29 @@ void WM_cursor_ungrab(wmWindow *win) } } +/* 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); + return 1; + } else if(event->type==DOWNARROWKEY) { + WM_cursor_warp(win, event->x, event->y-1); + return 1; + } else if(event->type==LEFTARROWKEY) { + WM_cursor_warp(win, event->x-1, event->y); + return 1; + } else if(event->type==RIGHTARROWKEY) { + WM_cursor_warp(win, event->x+1, event->y); + return 1; + } + } + return 0; +} + + /* afer this you can call restore too */ void WM_timecursor(wmWindow *win, int nr) { |