patch [#23675] fix #22787 with workaround

from Shane Ambler (sambler)
This commit is contained in:
Campbell Barton
2010-09-22 17:13:23 +00:00
parent e2c0777828
commit 725c8dde92

View File

@@ -5404,20 +5404,44 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
if(event->val==KM_PRESS) {
but= ui_but_find_activated(ar);
if(but) {
if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE))
but= ui_but_next(but);
else
but= ui_but_prev(but);
/* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */
/* UI_TOP and UI_DOWN are inconsistant - should be UI_UP and UI_DOWN or UI_TOP and UI_BOTTOM */
if( ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))
) {
/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built
* opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
if(but->type & BUT)
but= ui_but_next(but);
else
but= ui_but_prev(but);
}
else {
if(but->type & BUT)
but= ui_but_prev(but);
else
but= ui_but_next(but);
}
if(but)
ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
}
if(!but) {
if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
bt= ui_but_last(block);
else
bt= ui_but_first(block);
if( ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
) {
if(ui_but_first(block)->type & BUT)
bt= ui_but_last(block);
else
bt= ui_but_first(block);
}
else {
if(ui_but_first(block)->type & BUT)
bt= ui_but_first(block);
else
bt= ui_but_last(block);
}
if(bt)
ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);