* 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.
This commit is contained in:
Brecht Van Lommel
2009-07-09 16:05:01 +00:00
parent 5e659c0b08
commit b00409e72d
12 changed files with 112 additions and 4 deletions

View File

@@ -3775,8 +3775,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}
else {
but= ui_but_find_activated(data->region);
if(but) {
if(event->type != MOUSEMOVE) {
but->active->used_mouse= 0;
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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);