Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Carlisle <carlisle.b3d@gmail.com>2021-10-20 15:45:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-10-20 16:00:01 +0300
commit2743d746ea4f38c098512f6dd6fc33d5a62429d3 (patch)
tree0680f3c4713b7ecd698b91c5d1298734fc55f7ff /source/blender/editors/interface/view2d_ops.c
parent3435ea014d42d1e223513f448cbdaba63864115c (diff)
Cleanup: use an array for wmEvent cursor position variables
Use arrays for wmEvent coordinates, this quiets warnings with GCC11. - `x, y` -> `xy`. - `prevx, prevy` -> `prev_xy`. - `prevclickx, prevclicky` -> `prev_click_xy`. There is still some cleanup such as using `copy_v2_v2_int()`, this can be done separately. Reviewed By: campbellbarton, Severin Ref D12901
Diffstat (limited to 'source/blender/editors/interface/view2d_ops.c')
-rw-r--r--source/blender/editors/interface/view2d_ops.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 4ef4c3dbc6d..a73449f659d 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -224,13 +224,13 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
View2D *v2d = vpd->v2d;
/* set initial settings */
- vpd->startx = vpd->lastx = event->x;
- vpd->starty = vpd->lasty = event->y;
+ vpd->startx = vpd->lastx = event->xy[0];
+ vpd->starty = vpd->lasty = event->xy[1];
vpd->invoke_event = event->type;
if (event->type == MOUSEPAN) {
- RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
- RNA_int_set(op->ptr, "deltay", event->prevy - event->y);
+ RNA_int_set(op->ptr, "deltax", event->prev_xy[0] - event->xy[0]);
+ RNA_int_set(op->ptr, "deltay", event->prev_xy[1] - event->xy[1]);
view_pan_apply(C, op);
view_pan_exit(op);
@@ -266,11 +266,11 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case MOUSEMOVE: {
/* calculate new delta transform, then store mouse-coordinates for next-time */
- RNA_int_set(op->ptr, "deltax", (vpd->lastx - event->x));
- RNA_int_set(op->ptr, "deltay", (vpd->lasty - event->y));
+ RNA_int_set(op->ptr, "deltax", (vpd->lastx - event->xy[0]));
+ RNA_int_set(op->ptr, "deltay", (vpd->lasty - event->xy[1]));
- vpd->lastx = event->x;
- vpd->lasty = event->y;
+ vpd->lastx = event->xy[0];
+ vpd->lasty = event->xy[1];
view_pan_apply(C, op);
break;
@@ -1097,8 +1097,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
}
if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
- vzd->lastx = event->prevx;
- vzd->lasty = event->prevy;
+ vzd->lastx = event->prev_xy[0];
+ vzd->lasty = event->prev_xy[1];
float facx, facy;
float zoomfac = 0.01f;
@@ -1156,8 +1156,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
}
/* set initial settings */
- vzd->lastx = event->x;
- vzd->lasty = event->y;
+ vzd->lastx = event->xy[0];
+ vzd->lasty = event->xy[1];
RNA_float_set(op->ptr, "deltax", 0);
RNA_float_set(op->ptr, "deltay", 0);
@@ -1216,12 +1216,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
/* x-axis transform */
dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
len_old[0] = zoomfac * fabsf(vzd->lastx - vzd->region->winrct.xmin - dist);
- len_new[0] = zoomfac * fabsf(event->x - vzd->region->winrct.xmin - dist);
+ len_new[0] = zoomfac * fabsf(event->xy[0] - vzd->region->winrct.xmin - dist);
/* y-axis transform */
dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
len_old[1] = zoomfac * fabsf(vzd->lasty - vzd->region->winrct.ymin - dist);
- len_new[1] = zoomfac * fabsf(event->y - vzd->region->winrct.ymin - dist);
+ len_new[1] = zoomfac * fabsf(event->xy[1] - vzd->region->winrct.ymin - dist);
/* Calculate distance */
if (v2d->keepzoom & V2D_KEEPASPECT) {
@@ -1237,8 +1237,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
dy *= BLI_rctf_size_y(&v2d->cur);
}
else { /* USER_ZOOM_CONTINUE or USER_ZOOM_DOLLY */
- float facx = zoomfac * (event->x - vzd->lastx);
- float facy = zoomfac * (event->y - vzd->lasty);
+ float facx = zoomfac * (event->xy[0] - vzd->lastx);
+ float facy = zoomfac * (event->xy[1] - vzd->lasty);
/* Only respect user setting zoom axis if the view does not have any zoom restrictions
* any will be scaled uniformly */
@@ -1284,8 +1284,8 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
* to starting point to determine rate of change.
*/
if (U.viewzoom != USER_ZOOM_CONTINUE) { /* XXX store this setting as RNA prop? */
- vzd->lastx = event->x;
- vzd->lasty = event->y;
+ vzd->lastx = event->xy[0];
+ vzd->lasty = event->xy[1];
}
/* apply zooming */
@@ -1846,7 +1846,7 @@ static bool scroller_activate_poll(bContext *C)
wmEvent *event = win->eventstate;
/* check if mouse in scrollbars, if they're enabled */
- return (UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y) != 0);
+ return (UI_view2d_mouse_in_scrollers(region, v2d, event->xy[0], event->xy[1]) != 0);
}
/* initialize customdata for scroller manipulation operator */
@@ -1868,8 +1868,8 @@ static void scroller_activate_init(bContext *C,
vsm->scroller = in_scroller;
/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
- vsm->lastx = event->x;
- vsm->lasty = event->y;
+ vsm->lastx = event->xy[0];
+ vsm->lasty = event->xy[1];
/* 'zone' depends on where mouse is relative to bubble
* - zooming must be allowed on this axis, otherwise, default to pan
*/
@@ -2024,11 +2024,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
- vsm->delta = (float)(event->x - vsm->lastx);
+ vsm->delta = (float)(event->xy[0] - vsm->lastx);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
- vsm->delta = (float)(event->y - vsm->lasty);
+ vsm->delta = (float)(event->xy[1] - vsm->lasty);
break;
}
}
@@ -2037,18 +2037,18 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves with mouse) */
- vsm->delta = (float)(vsm->lastx - event->x);
+ vsm->delta = (float)(vsm->lastx - event->xy[0]);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves with to mouse) */
- vsm->delta = (float)(vsm->lasty - event->y);
+ vsm->delta = (float)(vsm->lasty - event->xy[1]);
break;
}
}
/* store previous coordinates */
- vsm->lastx = event->x;
- vsm->lasty = event->y;
+ vsm->lastx = event->xy[0];
+ vsm->lasty = event->xy[1];
scroller_activate_apply(C, op);
break;
@@ -2090,7 +2090,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
View2D *v2d = &region->v2d;
/* check if mouse in scrollbars, if they're enabled */
- const char in_scroller = UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y);
+ const char in_scroller = UI_view2d_mouse_in_scrollers(region, v2d, event->xy[0], event->xy[1]);
/* if in a scroller, init customdata then set modal handler which will
* catch mouse-down to start doing useful stuff */
@@ -2104,11 +2104,11 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
switch (vsm->scroller) {
case 'h': /* horizontal scroller - so only horizontal movement
* ('cur' moves opposite to mouse) */
- vsm->delta = (float)(event->x - vsm->scrollbar_orig);
+ vsm->delta = (float)(event->xy[0] - vsm->scrollbar_orig);
break;
case 'v': /* vertical scroller - so only vertical movement
* ('cur' moves opposite to mouse) */
- vsm->delta = (float)(event->y - vsm->scrollbar_orig);
+ vsm->delta = (float)(event->xy[1] - vsm->scrollbar_orig);
break;
}
scroller_activate_apply(C, op);