From 2743d746ea4f38c098512f6dd6fc33d5a62429d3 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Wed, 20 Oct 2021 23:45:30 +1100 Subject: 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 --- source/blender/editors/util/ed_draw.c | 14 +++++++------- source/blender/editors/util/ed_util_imbuf.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/util') diff --git a/source/blender/editors/util/ed_draw.c b/source/blender/editors/util/ed_draw.c index fc351ab728c..97540068c30 100644 --- a/source/blender/editors/util/ed_draw.c +++ b/source/blender/editors/util/ed_draw.c @@ -356,12 +356,12 @@ static void slider_draw(const struct bContext *UNUSED(C), ARegion *region, void static void slider_update_factor(tSlider *slider, const wmEvent *event) { - const float factor_delta = (event->x - slider->last_cursor[0]) / SLIDE_PIXEL_DISTANCE; + const float factor_delta = (event->xy[0] - slider->last_cursor[0]) / SLIDE_PIXEL_DISTANCE; /* Reduced factor delta in precision mode (shift held). */ slider->raw_factor += slider->precision ? (factor_delta / 8) : factor_delta; slider->factor = slider->raw_factor; - slider->last_cursor[0] = event->x; - slider->last_cursor[1] = event->y; + slider->last_cursor[0] = event->xy[0]; + slider->last_cursor[1] = event->xy[1]; if (!slider->overshoot) { slider->factor = clamp_f(slider->factor, 0, 1); @@ -403,8 +403,8 @@ tSlider *ED_slider_create(struct bContext *C) */ void ED_slider_init(struct tSlider *slider, const wmEvent *event) { - slider->last_cursor[0] = event->x; - slider->last_cursor[1] = event->y; + slider->last_cursor[0] = event->xy[0]; + slider->last_cursor[1] = event->xy[1]; } /** @@ -533,8 +533,8 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_ wmWindow *win = CTX_wm_window(C); const float *mval_src = (float *)arg_info; const float mval_dst[2] = { - win->eventstate->x - region->winrct.xmin, - win->eventstate->y - region->winrct.ymin, + win->eventstate->xy[0] - region->winrct.xmin, + win->eventstate->xy[1] - region->winrct.ymin, }; const uint shdr_pos = GPU_vertformat_attr_add( diff --git a/source/blender/editors/util/ed_util_imbuf.c b/source/blender/editors/util/ed_util_imbuf.c index 7f1a53cc1e8..38ae98c678f 100644 --- a/source/blender/editors/util/ed_util_imbuf.c +++ b/source/blender/editors/util/ed_util_imbuf.c @@ -451,7 +451,7 @@ void ED_imbuf_sample_draw(const bContext *C, ARegion *region, void *arg_info) rctf sample_rect_fl; BLI_rctf_init_pt_radius( &sample_rect_fl, - (float[2]){event->x - region->winrct.xmin, event->y - region->winrct.ymin}, + (float[2]){event->xy[0] - region->winrct.xmin, event->xy[1] - region->winrct.ymin}, (float)(info->sample_size / 2.0f) * sima->zoom); GPU_logic_op_xor_set(true); -- cgit v1.2.3