Fix T65350: scrolling popovers with trackpad not working on macOS

Differential Revision: https://developer.blender.org/D6483
This commit is contained in:
Yevgeny Makarov 2020-01-28 10:27:40 +01:00 committed by Brecht Van Lommel
parent 50d65d5a2e
commit cdd223039b
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by issue #65350, Popovers scroll with trackpad
1 changed files with 18 additions and 8 deletions

View File

@ -9549,18 +9549,29 @@ static int ui_handle_menu_event(bContext *C,
break;
case WHEELUPMOUSE:
case WHEELDOWNMOUSE: {
case WHEELDOWNMOUSE:
case MOUSEPAN: {
if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) {
/* pass */
}
else if (!ui_block_is_menu(block)) {
const int scroll_dir = (event->type == WHEELUPMOUSE) ? 1 : -1;
if (ui_menu_scroll_step(ar, block, scroll_dir)) {
if (but) {
but->active->cancel = true;
button_activate_exit(C, but, but->active, false, false);
int type = event->type;
int val = event->val;
/* convert pan to scrollwheel */
if (type == MOUSEPAN) {
ui_pan_to_scroll(event, &type, &val);
}
if (type != MOUSEPAN) {
const int scroll_dir = (type == WHEELUPMOUSE) ? 1 : -1;
if (ui_menu_scroll_step(ar, block, scroll_dir)) {
if (but) {
but->active->cancel = true;
button_activate_exit(C, but, but->active, false, false);
}
WM_event_add_mousemove(C);
}
WM_event_add_mousemove(C);
}
break;
}
@ -9572,7 +9583,6 @@ static int ui_handle_menu_event(bContext *C,
case PAGEDOWNKEY:
case HOMEKEY:
case ENDKEY:
case MOUSEPAN:
/* arrowkeys: only handle for block_loop blocks */
if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) {
/* pass */