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:
parent
3a2b7f35f4
commit
d71c423c28
|
@ -9451,7 +9451,7 @@ static int ui_list_activate_hovered_row(bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
const int *mouse_xy = ISTWEAK(event->type) ? &event->prev_click_xy[0] : &event->xy[0];
|
||||
const int *mouse_xy = ISTWEAK(event->type) ? event->prev_click_xy : event->xy;
|
||||
uiBut *listrow = ui_list_row_find_mouse_over(region, mouse_xy);
|
||||
if (listrow) {
|
||||
wmOperatorType *custom_activate_optype = ui_list->dyn_data->custom_activate_optype;
|
||||
|
@ -9478,7 +9478,7 @@ static bool ui_list_is_hovering_draggable_but(bContext *C,
|
|||
const wmEvent *event)
|
||||
{
|
||||
/* On a tweak event, uses the coordinates from where tweaking was started. */
|
||||
const int *mouse_xy = ISTWEAK(event->type) ? &event->prev_click_xy[0] : &event->xy[0];
|
||||
const int *mouse_xy = ISTWEAK(event->type) ? event->prev_click_xy : event->xy;
|
||||
const uiBut *hovered_but = ui_but_find_mouse_over_ex(region, mouse_xy, false, NULL, NULL);
|
||||
|
||||
if (list->dyn_data->custom_drag_optype) {
|
||||
|
|
|
@ -2041,7 +2041,7 @@ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, voi
|
|||
|
||||
switch (event->type) {
|
||||
case MOUSEMOVE:
|
||||
ui_panel_drag_collapse(C, dragcol_data, &event->xy[0]);
|
||||
ui_panel_drag_collapse(C, dragcol_data, event->xy);
|
||||
|
||||
retval = WM_UI_HANDLER_BREAK;
|
||||
break;
|
||||
|
|
|
@ -1060,7 +1060,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
|
|||
static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
AZone *az = screen_actionzone_find_xy(screen, &event->xy[0]);
|
||||
AZone *az = screen_actionzone_find_xy(screen, event->xy);
|
||||
|
||||
/* Quick escape - Scroll azones only hide/unhide the scroll-bars,
|
||||
* they have their own handling. */
|
||||
|
@ -3632,7 +3632,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
0,
|
||||
&ptr);
|
||||
/* store initial mouse cursor position. */
|
||||
RNA_int_set_array(&ptr, "cursor", &event->xy[0]);
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
RNA_enum_set(&ptr, "direction", SCREEN_AXIS_V);
|
||||
|
||||
/* Horizontal Split */
|
||||
|
@ -3645,7 +3645,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
0,
|
||||
&ptr);
|
||||
/* store initial mouse cursor position. */
|
||||
RNA_int_set_array(&ptr, "cursor", &event->xy[0]);
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
RNA_enum_set(&ptr, "direction", SCREEN_AXIS_H);
|
||||
|
||||
if (sa1 && sa2) {
|
||||
|
@ -3662,7 +3662,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
WM_OP_INVOKE_DEFAULT,
|
||||
0,
|
||||
&ptr);
|
||||
RNA_int_set_array(&ptr, "cursor", &event->xy[0]);
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
}
|
||||
|
||||
/* Swap just needs two areas. */
|
||||
|
@ -3675,7 +3675,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
WM_OP_EXEC_DEFAULT,
|
||||
0,
|
||||
&ptr);
|
||||
RNA_int_set_array(&ptr, "cursor", &event->xy[0]);
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
}
|
||||
|
||||
UI_popup_menu_end(C, pup);
|
||||
|
|
|
@ -1073,7 +1073,7 @@ void wm_gizmomap_modal_set(
|
|||
|
||||
if ((gz->flag & WM_GIZMO_MOVE_CURSOR) && (event->tablet.is_motion_absolute == false)) {
|
||||
WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, true, NULL);
|
||||
copy_v2_v2_int(gzmap->gzmap_context.event_xy, &event->xy[0]);
|
||||
copy_v2_v2_int(gzmap->gzmap_context.event_xy, event->xy);
|
||||
gzmap->gzmap_context.event_grabcursor = win->grabcursor;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -2812,7 +2812,7 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
* noticeable for the node editor - where dragging on a node should move it, see: T73212.
|
||||
* note we still allow for starting the gizmo drag outside, then travel 'inside' the node. */
|
||||
if (region->type->clip_gizmo_events_by_ui) {
|
||||
if (UI_region_block_find_mouse_over(region, &event->xy[0], true)) {
|
||||
if (UI_region_block_find_mouse_over(region, event->xy, true)) {
|
||||
if (gz != NULL && event->type != EVT_GIZMO_UPDATE) {
|
||||
if (restore_highlight_unless_activated == false) {
|
||||
WM_tooltip_clear(C, CTX_wm_window(C));
|
||||
|
@ -4829,7 +4829,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
|
|||
GHOST_TEventCursorData *cd = customdata;
|
||||
|
||||
copy_v2_v2_int(event.xy, &cd->x);
|
||||
wm_stereo3d_mouse_offset_apply(win, &event.xy[0]);
|
||||
wm_stereo3d_mouse_offset_apply(win, event.xy);
|
||||
wm_tablet_data_from_ghost(&cd->tablet, &event.tablet);
|
||||
|
||||
event.type = MOUSEMOVE;
|
||||
|
|
|
@ -181,7 +181,7 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
|
|||
* If needed, adjust \a r_mouse_xy
|
||||
* so that drawn cursor and handled mouse position are matching visually.
|
||||
*/
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy)
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int r_mouse_xy[2])
|
||||
{
|
||||
if (!WM_stereo3d_enabled(win, false)) {
|
||||
return;
|
||||
|
|
|
@ -86,7 +86,7 @@ void WM_OT_splash_about(wmOperatorType *ot);
|
|||
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view);
|
||||
void wm_stereo3d_draw_topbottom(wmWindow *win, int view);
|
||||
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy);
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int r_mouse_xy[2]);
|
||||
int wm_stereo3d_set_exec(bContext *C, wmOperator *op);
|
||||
int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *event);
|
||||
void wm_stereo3d_set_draw(bContext *C, wmOperator *op);
|
||||
|
|
Loading…
Reference in New Issue