Cleanup: Use array as a parameter for event x/y functions

This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0
This commit is contained in:
Aaron Carlisle 2021-10-21 00:56:31 -04:00
parent 035dcdad90
commit 5297bf318e
Notes: blender-bot 2023-02-14 11:25:11 +01:00
Referenced by commit 2a047fadc0, Fix type error in 5297bf318e
3 changed files with 7 additions and 7 deletions

View File

@ -2079,8 +2079,8 @@ static bool ui_but_drag_init(bContext *C,
drag_info->pushed_state = ui_drag_toggle_but_pushed_state(but);
drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
copy_v2_v2_int(drag_info->xy_init, &event->xy[0]);
copy_v2_v2_int(drag_info->xy_last, &event->xy[0]);
copy_v2_v2_int(drag_info->xy_init, event->xy);
copy_v2_v2_int(drag_info->xy_last, event->xy);
/* needed for toggle drag on popups */
region_prev = CTX_wm_region(C);
@ -9915,7 +9915,7 @@ static bool ui_mouse_motion_towards_check(uiBlock *block,
static void ui_mouse_motion_keynav_init(struct uiKeyNavLock *keynav, const wmEvent *event)
{
keynav->is_keynav = true;
copy_v2_v2_int(keynav->event_xy, &event->xy[0]);
copy_v2_v2_int(keynav->event_xy, &event->xy);
}
/**
* Return true if key-input isn't blocking mouse-motion,

View File

@ -1226,7 +1226,7 @@ bool ui_region_contains_point_px(const struct ARegion *region, const int xy[2])
ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px);
struct ARegion *ui_screen_region_find_mouse_over_ex(struct bScreen *screen, int x, int y);
struct ARegion *ui_screen_region_find_mouse_over_ex(struct bScreen *screen, const int xy[2]) ATTR_NONNULL(1, 2);
struct ARegion *ui_screen_region_find_mouse_over(struct bScreen *screen,
const struct wmEvent *event);

View File

@ -799,14 +799,14 @@ bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
* \{ */
/** Check if the cursor is over any popups. */
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y)
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2])
{
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
rcti winrct;
ui_region_winrct_get_no_margin(region, &winrct);
if (BLI_rcti_isect_pt(&winrct, x, y)) {
if (BLI_rcti_isect_pt_v(&winrct, xy)) {
return region;
}
}
@ -815,7 +815,7 @@ ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y)
ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const wmEvent *event)
{
return ui_screen_region_find_mouse_over_ex(screen, event->xy[0], event->xy[1]);
return ui_screen_region_find_mouse_over_ex(screen, event->xy);
}
/** \} */