diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 34 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 5 |
2 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5b8b8ae5bdb..ff4e11ac58b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8436,6 +8436,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, uiListDyn *dyn_data; int retval = WM_UI_HANDLER_CONTINUE; int type = event->type, val = event->val; + bool redraw = false; int mx, my; ui_list = listbox->custom_data; @@ -8525,7 +8526,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, ui_apply_but_undo(listbox); ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM; - ED_region_tag_redraw(ar); + redraw = true; } retval = WM_UI_HANDLER_BREAK; } @@ -8537,8 +8538,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, ui_list->list_grip += (type == WHEELUPMOUSE) ? -1 : 1; ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM; - ED_region_tag_redraw(ar); + redraw = true; retval = WM_UI_HANDLER_BREAK; } else if (ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE)) { @@ -8546,13 +8547,22 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, /* list template will clamp */ ui_list->list_scroll += (type == WHEELUPMOUSE) ? -1 : 1; - ED_region_tag_redraw(ar); - + redraw = true; retval = WM_UI_HANDLER_BREAK; } } } + if (redraw) { + if (listbox->block->flag & UI_BLOCK_POPUP) { + /* popups need special refreshing */ + ED_region_tag_refresh_ui(ar); + } + else { + ED_region_tag_redraw(ar); + } + } + return retval; } @@ -9794,11 +9804,21 @@ static int ui_handle_menus_recursive( } else { uiBlock *block = menu->region->uiblocks.first; + uiBut *listbox = ui_list_find_mouse_over(menu->region, event); - if (block->flag & UI_BLOCK_RADIAL) + if (block->flag & UI_BLOCK_RADIAL) { retval = ui_pie_handler(C, event, menu); - else if (event->type == LEFTMOUSE || event->val != KM_DBL_CLICK) - retval = ui_handle_menu_event(C, event, menu, level, is_parent_inside, is_parent_menu, is_floating); + } + else if (event->type == LEFTMOUSE || event->val != KM_DBL_CLICK) { + if (listbox) { + retval = ui_handle_list_event(C, event, menu->region, listbox); + } + if (retval == WM_UI_HANDLER_CONTINUE) { + retval = ui_handle_menu_event( + C, event, menu, level, + is_parent_inside, is_parent_menu, is_floating); + } + } } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a3b04e1c9bc..9f0c4b16523 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2818,7 +2818,7 @@ static void uilist_prepare( layoutdata->end_idx = min_ii(layoutdata->start_idx + rows * columns, len); } -static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSED(arg2)) +static void uilist_resize_update_cb(bContext *C, void *arg1, void *UNUSED(arg2)) { uiList *ui_list = arg1; uiListDyn *dyn_data = ui_list->dyn_data; @@ -2831,6 +2831,9 @@ static void uilist_resize_update_cb(bContext *UNUSED(C), void *arg1, void *UNUSE dyn_data->resize_prev += diff * UI_UNIT_Y; ui_list->flag |= UILST_SCROLL_TO_ACTIVE_ITEM; } + + /* In case uilist is in popup, we need special refreshing */ + ED_region_tag_refresh_ui(CTX_wm_menu(C)); } static void *uilist_item_use_dynamic_tooltip(PointerRNA *itemptr, const char *propname) |