diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_color.cc b/source/blender/editors/interface/eyedroppers/eyedropper_color.cc index 394b6b86100..83daca63536 100644 --- a/source/blender/editors/interface/eyedroppers/eyedropper_color.cc +++ b/source/blender/editors/interface/eyedroppers/eyedropper_color.cc @@ -243,7 +243,7 @@ static bool eyedropper_cryptomatte_sample_image_fl(const bNode *node, static bool eyedropper_cryptomatte_sample_fl(bContext *C, Eyedropper *eye, - const int m_xy[2], + const int event_xy[2], float r_col[3]) { bNode *node = eye->crypto_node; @@ -254,17 +254,17 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C, } bScreen *screen = CTX_wm_screen(C); - ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, m_xy); + ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event_xy); if (!area || !ELEM(area->spacetype, SPACE_IMAGE, SPACE_NODE, SPACE_CLIP)) { return false; } - ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, m_xy); + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, event_xy); if (!region) { return false; } - int mval[2] = {m_xy[0] - region->winrct.xmin, m_xy[1] - region->winrct.ymin}; + int mval[2] = {event_xy[0] - region->winrct.xmin, event_xy[1] - region->winrct.ymin}; float fpos[2] = {-1.0f, -1.0}; switch (area->spacetype) { case SPACE_IMAGE: { @@ -313,12 +313,12 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C, return false; } -void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3]) +void eyedropper_color_sample_fl(bContext *C, const int event_xy[2], float r_col[3]) { ScrArea *area = nullptr; int mval[2]; - wmWindow *win = WM_window_find_under_cursor(CTX_wm_window(C), m_xy, mval); + wmWindow *win = WM_window_find_under_cursor(CTX_wm_window(C), event_xy, mval); if (win) { bScreen *screen = WM_window_get_active_screen(win); area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mval); @@ -393,17 +393,17 @@ static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3 RNA_property_update(C, &eye->ptr, eye->prop); } -static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int m_xy[2]) +static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int event_xy[2]) { /* Accumulate color. */ float col[3]; if (eye->crypto_node) { - if (!eyedropper_cryptomatte_sample_fl(C, eye, m_xy, col)) { + if (!eyedropper_cryptomatte_sample_fl(C, eye, event_xy, col)) { return; } } else { - eyedropper_color_sample_fl(C, m_xy, col); + eyedropper_color_sample_fl(C, event_xy, col); } if (!eye->crypto_node) { @@ -426,13 +426,15 @@ static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int m_xy eyedropper_color_set(C, eye, accum_col); } -static void eyedropper_color_sample_text_update(bContext *C, Eyedropper *eye, const int m_xy[2]) +static void eyedropper_color_sample_text_update(bContext *C, + Eyedropper *eye, + const int event_xy[2]) { float col[3]; eye->sample_text[0] = '\0'; if (eye->cryptomatte_session) { - if (eyedropper_cryptomatte_sample_fl(C, eye, m_xy, col)) { + if (eyedropper_cryptomatte_sample_fl(C, eye, event_xy, col)) { BKE_cryptomatte_find_name( eye->cryptomatte_session, col[0], eye->sample_text, sizeof(eye->sample_text)); eye->sample_text[sizeof(eye->sample_text) - 1] = '\0'; diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_datablock.cc b/source/blender/editors/interface/eyedroppers/eyedropper_datablock.cc index b5fe657b9ff..e6613d90de9 100644 --- a/source/blender/editors/interface/eyedroppers/eyedropper_datablock.cc +++ b/source/blender/editors/interface/eyedroppers/eyedropper_datablock.cc @@ -137,7 +137,7 @@ static void datadropper_exit(bContext *C, wmOperator *op) * \brief get the ID from the 3D view or outliner. */ static void datadropper_id_sample_pt( - bContext *C, wmWindow *win, ScrArea *area, DataDropper *ddr, const int m_xy[2], ID **r_id) + bContext *C, wmWindow *win, ScrArea *area, DataDropper *ddr, const int event_xy[2], ID **r_id) { wmWindow *win_prev = CTX_wm_window(C); ScrArea *area_prev = CTX_wm_area(C); @@ -147,9 +147,9 @@ static void datadropper_id_sample_pt( if (area) { if (ELEM(area->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) { - ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, m_xy); + ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, event_xy); if (region) { - const int mval[2] = {m_xy[0] - region->winrct.xmin, m_xy[1] - region->winrct.ymin}; + const int mval[2] = {event_xy[0] - region->winrct.xmin, event_xy[1] - region->winrct.ymin}; Base *base; CTX_wm_window_set(C, win); @@ -217,16 +217,16 @@ static bool datadropper_id_set(bContext *C, DataDropper *ddr, ID *id) } /* single point sample & set */ -static bool datadropper_id_sample(bContext *C, DataDropper *ddr, const int m_xy[2]) +static bool datadropper_id_sample(bContext *C, DataDropper *ddr, const int event_xy[2]) { ID *id = nullptr; - int mval[2]; + int event_xy_win[2]; wmWindow *win; ScrArea *area; - datadropper_win_area_find(C, m_xy, mval, &win, &area); + datadropper_win_area_find(C, event_xy, event_xy_win, &win, &area); - datadropper_id_sample_pt(C, win, area, ddr, mval, &id); + datadropper_id_sample_pt(C, win, area, ddr, event_xy_win, &id); return datadropper_id_set(C, ddr, id); } @@ -288,15 +288,15 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event) else if (event->type == MOUSEMOVE) { ID *id = nullptr; - int mval[2]; + int event_xy_win[2]; wmWindow *win; ScrArea *area; - datadropper_win_area_find(C, event->xy, mval, &win, &area); + datadropper_win_area_find(C, event->xy, event_xy_win, &win, &area); /* Set the region for eyedropper cursor text drawing */ datadropper_set_draw_callback_region(area, ddr); - datadropper_id_sample_pt(C, win, area, ddr, mval, &id); + datadropper_id_sample_pt(C, win, area, ddr, event_xy_win, &id); } return OPERATOR_RUNNING_MODAL; diff --git a/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh b/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh index 11938c874d5..fc6e491dec1 100644 --- a/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh +++ b/source/blender/editors/interface/eyedroppers/eyedropper_intern.hh @@ -24,8 +24,11 @@ void eyedropper_draw_cursor_text_region(const int xy[2], const char *name); * \return A button under the mouse which relates to some RNA Property, or NULL */ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event); -void datadropper_win_area_find( - const bContext *C, const int mval[2], int r_mval[2], wmWindow **r_win, ScrArea **r_area); +void datadropper_win_area_find(const bContext *C, + const int event_xy[2], + int r_event_xy[2], + wmWindow **r_win, + ScrArea **r_area); /* interface_eyedropper_color.c (expose for color-band picker) */ diff --git a/source/blender/editors/interface/eyedroppers/interface_eyedropper.cc b/source/blender/editors/interface/eyedroppers/interface_eyedropper.cc index f07eb4fcf0a..44e7bd34753 100644 --- a/source/blender/editors/interface/eyedroppers/interface_eyedropper.cc +++ b/source/blender/editors/interface/eyedroppers/interface_eyedropper.cc @@ -140,22 +140,25 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev return but; } -void datadropper_win_area_find( - const bContext *C, const int mval[2], int r_mval[2], wmWindow **r_win, ScrArea **r_area) +void datadropper_win_area_find(const bContext *C, + const int event_xy[2], + int r_event_xy[2], + wmWindow **r_win, + ScrArea **r_area) { bScreen *screen = CTX_wm_screen(C); *r_win = CTX_wm_window(C); - *r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mval); + *r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event_xy); if (*r_area == nullptr) { - *r_win = WM_window_find_under_cursor(*r_win, mval, r_mval); + *r_win = WM_window_find_under_cursor(*r_win, event_xy, r_event_xy); if (*r_win) { screen = WM_window_get_active_screen(*r_win); - *r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, r_mval); + *r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, r_event_xy); } } - else if (mval != r_mval) { - copy_v2_v2_int(r_mval, mval); + else if (event_xy != r_event_xy) { + copy_v2_v2_int(r_event_xy, event_xy); } } diff --git a/source/blender/editors/screen/area.cc b/source/blender/editors/screen/area.cc index d74a9c0f262..8fd7bcd9b10 100644 --- a/source/blender/editors/screen/area.cc +++ b/source/blender/editors/screen/area.cc @@ -3565,7 +3565,7 @@ bool ED_area_is_global(const ScrArea *area) return area->global != nullptr; } -ScrArea *ED_area_find_under_cursor(const bContext *C, int spacetype, const int xy[2]) +ScrArea *ED_area_find_under_cursor(const bContext *C, int spacetype, const int event_xy[2]) { bScreen *screen = CTX_wm_screen(C); wmWindow *win = CTX_wm_window(C); @@ -3574,23 +3574,23 @@ ScrArea *ED_area_find_under_cursor(const bContext *C, int spacetype, const int x if (win->parent) { /* If active window is a child, check itself first. */ - area = BKE_screen_find_area_xy(screen, spacetype, xy); + area = BKE_screen_find_area_xy(screen, spacetype, event_xy); } if (!area) { /* Check all windows except the active one. */ - int scr_pos[2]; - wmWindow *win_other = WM_window_find_under_cursor(win, xy, scr_pos); + int event_xy_other[2]; + wmWindow *win_other = WM_window_find_under_cursor(win, event_xy, event_xy_other); if (win_other && win_other != win) { win = win_other; screen = WM_window_get_active_screen(win); - area = BKE_screen_find_area_xy(screen, spacetype, scr_pos); + area = BKE_screen_find_area_xy(screen, spacetype, event_xy_other); } } if (!area && !win->parent) { /* If active window is a parent window, check itself last. */ - area = BKE_screen_find_area_xy(screen, spacetype, xy); + area = BKE_screen_find_area_xy(screen, spacetype, event_xy); } return area; diff --git a/source/blender/windowmanager/WM_api.hh b/source/blender/windowmanager/WM_api.hh index 7f62a649ed0..497b61e2bc5 100644 --- a/source/blender/windowmanager/WM_api.hh +++ b/source/blender/windowmanager/WM_api.hh @@ -188,7 +188,9 @@ void WM_reinit_gizmomap_all(Main *bmain); */ void WM_script_tag_reload(); -wmWindow *WM_window_find_under_cursor(wmWindow *win, const int mval[2], int r_mval[2]); +wmWindow *WM_window_find_under_cursor(wmWindow *win, + const int event_xy[2], + int r_event_xy_other[2]); /** * Knowing the area, return its screen. diff --git a/source/blender/windowmanager/intern/wm_dragdrop.cc b/source/blender/windowmanager/intern/wm_dragdrop.cc index 909982e3e9e..e029fd59691 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.cc +++ b/source/blender/windowmanager/intern/wm_dragdrop.cc @@ -252,8 +252,8 @@ void wm_drags_exit(wmWindowManager *wm, wmWindow *win) } /* Active area should always redraw, even if cancelled. */ - int r_mval[2]; - wmWindow *target_win = WM_window_find_under_cursor(win, win->eventstate->xy, &r_mval[0]); + int event_xy_target[2]; + wmWindow *target_win = WM_window_find_under_cursor(win, win->eventstate->xy, event_xy_target); if (target_win) { const bScreen *screen = WM_window_get_active_screen(target_win); ED_region_tag_redraw_no_rebuild(screen->active_region); diff --git a/source/blender/windowmanager/intern/wm_window.cc b/source/blender/windowmanager/intern/wm_window.cc index 0c319a6ae94..5b6be009877 100644 --- a/source/blender/windowmanager/intern/wm_window.cc +++ b/source/blender/windowmanager/intern/wm_window.cc @@ -2267,21 +2267,23 @@ bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut) /** \name Find Window Utility * \{ */ -wmWindow *WM_window_find_under_cursor(wmWindow *win, const int mval[2], int r_mval[2]) +wmWindow *WM_window_find_under_cursor(wmWindow *win, + const int event_xy[2], + int r_event_xy_other[2]) { - int tmp[2]; - copy_v2_v2_int(tmp, mval); - wm_cursor_position_to_ghost_screen_coords(win, &tmp[0], &tmp[1]); + int temp_xy[2]; + copy_v2_v2_int(temp_xy, event_xy); + wm_cursor_position_to_ghost_screen_coords(win, &temp_xy[0], &temp_xy[1]); - GHOST_WindowHandle ghostwin = GHOST_GetWindowUnderCursor(g_system, tmp[0], tmp[1]); + GHOST_WindowHandle ghostwin = GHOST_GetWindowUnderCursor(g_system, temp_xy[0], temp_xy[1]); if (!ghostwin) { return nullptr; } wmWindow *win_other = static_cast(GHOST_GetWindowUserData(ghostwin)); - wm_cursor_position_from_ghost_screen_coords(win_other, &tmp[0], &tmp[1]); - copy_v2_v2_int(r_mval, tmp); + wm_cursor_position_from_ghost_screen_coords(win_other, &temp_xy[0], &temp_xy[1]); + copy_v2_v2_int(r_event_xy_other, temp_xy); return win_other; }