Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-06-21 10:32:16 +02:00
commit 66263905ae
2 changed files with 25 additions and 8 deletions

View File

@ -9595,6 +9595,11 @@ static int ui_handle_menu_event(
}
#endif
/* Don't handle double click events, rehandle as regular press/release. */
if (retval == WM_UI_HANDLER_CONTINUE && event->val == KM_DBL_CLICK) {
return retval;
}
/* if we set a menu return value, ensure we continue passing this on to
* lower menus and buttons, so always set continue then, and if we are
* inside the region otherwise, ensure we swallow the event */
@ -10175,6 +10180,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
{
ARegion *ar;
uiBut *but;
int retval = WM_UI_HANDLER_CONTINUE;
ar = CTX_wm_menu(C);
if (!ar)
@ -10218,29 +10224,32 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
if ((but_other->flag & UI_BUT_DISABLED) == 0) {
ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER);
button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
retval = WM_UI_HANDLER_BREAK;
}
}
else if (data->state == BUTTON_STATE_MENU_OPEN) {
int retval;
/* handle events for menus and their buttons recursively,
* this will handle events from the top to the bottom menu */
if (data->menu)
if (data->menu) {
retval = ui_handle_menus_recursive(C, event, data->menu, 0, false, false, false);
}
/* handle events for the activated button */
if ((data->menu && (retval == WM_UI_HANDLER_CONTINUE)) ||
(event->type == TIMER))
{
if (data->menu && data->menu->menuretval)
if (data->menu && data->menu->menuretval) {
ui_handle_button_return_submenu(C, event, but);
else
ui_handle_button_event(C, event, but);
retval = WM_UI_HANDLER_BREAK;
}
else {
retval = ui_handle_button_event(C, event, but);
}
}
}
else {
/* handle events for the activated button */
ui_handle_button_event(C, event, but);
retval = ui_handle_button_event(C, event, but);
}
}
@ -10251,6 +10260,14 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
/* delayed apply callbacks */
ui_apply_but_funcs_after(C);
/* Don't handle double-click events,
* these will be converted into regular clicks which we handle. */
if (retval == WM_UI_HANDLER_CONTINUE) {
if (event->val == KM_DBL_CLICK) {
return WM_UI_HANDLER_CONTINUE;
}
}
/* we block all events, this is modal interaction */
return WM_UI_HANDLER_BREAK;
}

View File

@ -521,7 +521,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
/* UI code doesn't handle return values - it just always returns break.
* to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
if (((handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
(event->type != LEFTMOUSE) &&
!ISMOUSE_BUTTON(event->type) &&
(event->val == KM_DBL_CLICK))
{
return WM_HANDLER_CONTINUE;