Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_handlers.cc
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 9,678 Lines • ▼ Show 20 Lines | if (hovered_row_but) { | ||||
| hovered_row_but->flag |= UI_ACTIVE; | hovered_row_but->flag |= UI_ACTIVE; | ||||
| } | } | ||||
| return WM_UI_HANDLER_CONTINUE; | return WM_UI_HANDLER_CONTINUE; | ||||
| } | } | ||||
| static int ui_handle_view_item_event(bContext *C, | static int ui_handle_view_item_event(bContext *C, | ||||
| const wmEvent *event, | const wmEvent *event, | ||||
| ARegion *region, | uiBut *active_but, | ||||
| uiBut *view_but) | ARegion *region) | ||||
| { | { | ||||
| BLI_assert(view_but->type == UI_BTYPE_VIEW_ITEM); | |||||
| if (event->type == LEFTMOUSE) { | if (event->type == LEFTMOUSE) { | ||||
| /* Only bother finding the active view item button if the active button isn't already a view | |||||
| * item. */ | |||||
| uiBut *view_but = active_but->type == UI_BTYPE_VIEW_ITEM ? | |||||
| active_but : | |||||
| ui_view_item_find_mouse_over(region, event->xy); | |||||
| /* Will free active button if there already is one. */ | /* Will free active button if there already is one. */ | ||||
| ui_handle_button_activate(C, region, view_but, BUTTON_ACTIVATE_OVER); | ui_handle_button_activate(C, region, view_but, BUTTON_ACTIVATE_OVER); | ||||
| return ui_do_button(C, view_but->block, view_but, event); | return ui_do_button(C, view_but->block, view_but, event); | ||||
| } | } | ||||
| return WM_UI_HANDLER_CONTINUE; | return WM_UI_HANDLER_CONTINUE; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,581 Lines • ▼ Show 20 Lines | if (retval == WM_UI_HANDLER_BREAK) { | ||||
| UI_but_tooltip_timer_remove(C, but); | UI_but_tooltip_timer_remove(C, but); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (retval == WM_UI_HANDLER_CONTINUE) { | if (retval == WM_UI_HANDLER_CONTINUE) { | ||||
| if (but) { | if (but) { | ||||
| retval = ui_handle_button_event(C, event, but); | retval = ui_handle_button_event(C, event, but); | ||||
| } | } | ||||
| else { | else { | ||||
| retval = ui_handle_button_over(C, event, region); | retval = ui_handle_button_over(C, event, region); | ||||
Severin: This is a bit too specific for `ui_region_handler()` for my taste. How about this:
```… | |||||
Done Inline ActionsGreat points, thanks! HooglyBoogly: Great points, thanks! | |||||
| } | } | ||||
| } | } | ||||
| /* Re-enable tool-tips. */ | /* Re-enable tool-tips. */ | ||||
| if (event->type == MOUSEMOVE && | if (event->type == MOUSEMOVE && | ||||
| (event->xy[0] != event->prev_xy[0] || event->xy[1] != event->prev_xy[1])) { | (event->xy[0] != event->prev_xy[0] || event->xy[1] != event->prev_xy[1])) { | ||||
| ui_blocks_set_tooltips(region, true); | ui_blocks_set_tooltips(region, true); | ||||
| } | } | ||||
| /* Always do this, to reliably update view item highlighting, even if the mouse hovers a button | /* Always do this, to reliably update view item highlighting, even if the mouse hovers a button | ||||
| * nested in the item (it's an overlapping layout). */ | * nested in the item (it's an overlapping layout). */ | ||||
| ui_handle_view_items_hover(event, region); | ui_handle_view_items_hover(event, region); | ||||
| if (retval == WM_UI_HANDLER_CONTINUE) { | if (retval == WM_UI_HANDLER_CONTINUE) { | ||||
| uiBut *view_item = ui_view_item_find_mouse_over(region, event->xy); | retval = ui_handle_view_item_event(C, event, but, region); | ||||
| if (view_item) { | |||||
| retval = ui_handle_view_item_event(C, event, region, view_item); | |||||
| } | |||||
| } | } | ||||
| /* delayed apply callbacks */ | /* delayed apply callbacks */ | ||||
| ui_apply_but_funcs_after(C); | ui_apply_but_funcs_after(C); | ||||
| return retval; | return retval; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 503 Lines • Show Last 20 Lines | |||||
This is a bit too specific for ui_region_handler() for my taste. How about this:
ui_handle_view_items_hover(event, region); if (retval == WM_UI_HANDLER_CONTINUE) { retval = ui_handle_view_item_over(...); }(With the return in your code we're also not calling ui_apply_but_funcs_after().)
There's also a chance that but is already the view item button we're looking for at this point, could you check that? I'm traveling and my Blender doesn't want to compile :)