UI: fix event handling direction

Correct arrow key direction in popovers,
also de-duplicate menu callback,
This commit is contained in:
2018-05-25 15:46:22 +02:00
parent dd22080b9a
commit 5901c1ca42
3 changed files with 9 additions and 7 deletions

View File

@@ -794,6 +794,8 @@ void ui_resources_free(void);
void ui_layout_add_but(uiLayout *layout, uiBut *but);
void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop);
void ui_layout_list_set_labels_active(uiLayout *layout);
/* menu callback */
void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *arg_pt);
/* interface_align.c */
bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT;

View File

@@ -1848,10 +1848,13 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
layout->root->block->flag ^= UI_BLOCK_IS_FLIP;
}
static void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt)
void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt)
{
PanelType *pt = (PanelType *)arg_pt;
UI_paneltype_draw(C, pt, layout);
/* panels are created flipped (from event handling pov) */
layout->root->block->flag ^= UI_BLOCK_IS_FLIP;
}
static uiBut *ui_item_menu(

View File

@@ -265,12 +265,6 @@ uiPopupBlockHandle *ui_popover_panel_create(
/** \name Standard Popover Panels
* \{ */
static void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt)
{
PanelType *pt = (PanelType *)arg_pt;
UI_paneltype_draw(C, pt, layout);
}
int UI_popover_panel_invoke(
bContext *C, int space_id, int region_id, const char *idname,
bool keep_open, ReportList *reports)
@@ -367,6 +361,9 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
* The begin/end stype of calling popups doesn't allow to 'can_refresh' to be set.
* For now close this style of popvers when accessed. */
UI_block_flag_disable(pup->block, UI_BLOCK_KEEP_OPEN);
/* panels are created flipped (from event handling pov) */
pup->block->flag ^= UI_BLOCK_IS_FLIP;
}
uiLayout *UI_popover_layout(uiPopover *pup)