UI: Add scroll to sidebar tabs #105355

Merged
Pablo Vazquez merged 3 commits from guishe/blender:category-tab-scroll into main 2023-03-15 16:45:21 +01:00
1 changed files with 6 additions and 6 deletions
Showing only changes of commit 942bbee135 - Show all commits

View File

@ -206,12 +206,12 @@ static int view_pan_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
guishe marked this conversation as resolved
Review

Use ED_region_panel_category_gutter_isect_xy or add a new public utility function to area_query.c if existing functions cannot be used - with an explanation for how it differs from existing intersection checking functions.

Use `ED_region_panel_category_gutter_isect_xy` or add a new public utility function to `area_query.c` if existing functions cannot be used - with an explanation for how it differs from existing intersection checking functions.

It works, can I just assume that win->eventstate is never null?

It works, can I just assume that `win->eventstate` is never null?
Review

Yes, you can assume it's never NULL (the doc-string should be updated to note this).

Yes, you can assume it's never NULL (the doc-string should be updated to note this).
inline bool mouse_in_category_tab(const ARegion *region, const wmEvent *event)
bool mouse_in_category_tab(const ARegion *region, const wmEvent *event)
guishe marked this conversation as resolved Outdated

I don't see a point in using inline here, this is not a performance sensitive code path, so I rather don't optimize prematurely and let the compiler figure things out.

I don't see a point in using `inline` here, this is not a performance sensitive code path, so I rather don't optimize prematurely and let the compiler figure things out.
{
if (event == nullptr) {
return false;
}
const int mvalx = event->mval[0];
const int mvalx = event->xy[0] - region->winrct.xmin;
if (region->runtime.category && !BLI_listbase_is_empty(&region->panels_category)) {
const PanelCategoryDyn *pc_dyn = static_cast<PanelCategoryDyn *>(
region->panels_category.first);
@ -509,8 +509,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
return OPERATOR_PASS_THROUGH;
}
wmWindow *win = CTX_wm_window(C);
wmEvent *event = win->event_last_handled;
const wmWindow *win = CTX_wm_window(C);
const wmEvent *event = win->eventstate;
guishe marked this conversation as resolved Outdated

Use win->eventstate, win->event_last_handled is intended for event handling logic and not to be used by interface logic. Updated the doc-string to note this 09ba0210d9.

Use `win->eventstate`, `win->event_last_handled` is intended for event handling logic and not to be used by interface logic. Updated the doc-string to note this 09ba0210d9a19a2713fa0f92cf5f54914789c62f.

Solved, the problem I had is that mval is not assigned in win->eventstate for 'Wheel Up/Down' events.

Solved, the problem I had is that `mval` is not assigned in `win->eventstate` for 'Wheel Up/Down' events.
vpd->do_category_scroll = mouse_in_category_tab(vpd->region, event);
/* set RNA-Props */
@ -560,8 +560,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
return OPERATOR_PASS_THROUGH;
}
wmWindow *win = CTX_wm_window(C);
wmEvent *event = win->event_last_handled;
const wmWindow *win = CTX_wm_window(C);
const wmEvent *event = win->eventstate;
vpd->do_category_scroll = mouse_in_category_tab(vpd->region, event);
/* set RNA-Props */