Fix #29895 Fast Alt-Mousewheel toggling of Mapping Modes scrubs timeline
Issue was caused by changing button state to EXIT, so there's no active button just after applying Alt-Wheel event. Setting this state is needed to prevent button trigger cancel callback when mouse is leaving hovered menu button. Using the same "post activate" trick used by Tab button allows to make prevent canceling button and makes this button active again after applying all handlers. There's still issues with Alt-Scroll if changing active element in menu leads to interface changes (like file format in render buttons) -- in this case button simple doesn't receive wheel events and it's actually not connected to this issue.
This commit is contained in:
@@ -3030,12 +3030,28 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
|
||||
data->value= ui_step_name_menu(but, -1);
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
ui_apply_button(C, but->block, but, data, 1);
|
||||
|
||||
/* button's state need to be changed to EXIT so moving mouse away from this mouse wouldn't lead
|
||||
* to cancel changes made to this button, but shanging state to EXIT also makes no button active for
|
||||
* a while which leads to triggering operator when doing fast scrolling mouse wheel.
|
||||
* using post activate stuff from button allows to make button be active again after checking for all
|
||||
* all that mouse leave and cancel stuff, so wuick scrool wouldnt't be an issue anumore.
|
||||
* same goes for scrolling wheel in another direction below (sergey)
|
||||
*/
|
||||
data->postbut= but;
|
||||
data->posttype= BUTTON_ACTIVATE_OVER;
|
||||
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
else if(event->type == WHEELUPMOUSE && event->alt) {
|
||||
data->value= ui_step_name_menu(but, 1);
|
||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||
ui_apply_button(C, but->block, but, data, 1);
|
||||
|
||||
/* why this is needed described above */
|
||||
data->postbut= but;
|
||||
data->posttype= BUTTON_ACTIVATE_OVER;
|
||||
|
||||
return WM_UI_HANDLER_BREAK;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user