diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 20:05:01 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 20:05:01 +0400 |
commit | b00409e72d04fe9e710c25fb4f076d1e960328dc (patch) | |
tree | 17d44f7ea5541b926ed5fde5aaa82fd8fb201949 /source/blender/windowmanager | |
parent | 5e659c0b0895e07351bd2b2425deea342141e515 (diff) |
2.5: X11
* Pass on mouse location on window leave/enter too, fixing some
issues with button highlights and tooltips.
* When a modal operator runs, grab the mouse cursor so that for
example transform still works when you move your mouse outside
of the window, previously it would just stop then. This is
automatic now for all modal ops, perhaps not always needed?
* Fix for a trailing button highlight issue.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index ff3a2feb521..7fe98488ec0 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -65,6 +65,7 @@ void WM_cursor_set (struct wmWindow *win, int curs); void WM_cursor_modal (struct wmWindow *win, int curs); void WM_cursor_restore (struct wmWindow *win); void WM_cursor_wait (int val); +void WM_cursor_grab (struct wmWindow *win, int val); void WM_timecursor (struct wmWindow *win, int nr); void *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), void (*draw)(struct bContext *C, int, int, void *customdata), void *customdata); diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 9b64ad6d38c..5ddd8f5a1a9 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -156,6 +156,11 @@ void WM_cursor_wait(int val) } } +void WM_cursor_grab(wmWindow *win, int val) +{ + GHOST_SetCursorGrab(win->ghostwin, val); +} + /* afer this you can call restore too */ void WM_timecursor(wmWindow *win, int nr) { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index b5d51ef650b..5bcbf526460 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -378,9 +378,12 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P else WM_operator_free(op); } - else if(!(retval & OPERATOR_RUNNING_MODAL)) { - WM_operator_free(op); + else if(retval & OPERATOR_RUNNING_MODAL) { + /* automatically grab cursor during modal ops (X11) */ + WM_cursor_grab(CTX_wm_window(C), 1); } + else + WM_operator_free(op); } return retval; @@ -548,6 +551,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers) } WM_operator_free(handler->op); + WM_cursor_grab(CTX_wm_window(C), 0); } else if(handler->ui_remove) { ScrArea *area= CTX_wm_area(C); @@ -704,6 +708,8 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand /* remove modal handler, operator itself should have been cancelled and freed */ if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) { + WM_cursor_grab(CTX_wm_window(C), 0); + BLI_remlink(handlers, handler); wm_event_free_handler(handler); |