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:
@@ -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->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[0] = BLI_rctf_cent_x(&but->rect);
|
||||||
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&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_init, event->xy);
|
||||||
copy_v2_v2_int(drag_info->xy_last, &event->xy[0]);
|
copy_v2_v2_int(drag_info->xy_last, event->xy);
|
||||||
|
|
||||||
/* needed for toggle drag on popups */
|
/* needed for toggle drag on popups */
|
||||||
region_prev = CTX_wm_region(C);
|
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)
|
static void ui_mouse_motion_keynav_init(struct uiKeyNavLock *keynav, const wmEvent *event)
|
||||||
{
|
{
|
||||||
keynav->is_keynav = true;
|
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,
|
* Return true if key-input isn't blocking mouse-motion,
|
||||||
|
|||||||
@@ -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;
|
ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT;
|
||||||
bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px);
|
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,
|
struct ARegion *ui_screen_region_find_mouse_over(struct bScreen *screen,
|
||||||
const struct wmEvent *event);
|
const struct wmEvent *event);
|
||||||
|
|
||||||
|
|||||||
@@ -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. */
|
/** 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) {
|
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
|
||||||
rcti winrct;
|
rcti winrct;
|
||||||
|
|
||||||
ui_region_winrct_get_no_margin(region, &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;
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|||||||
Reference in New Issue
Block a user