diff options
author | Hans Goudey <h.goudey@me.com> | 2021-08-27 07:41:41 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-08-27 07:41:41 +0300 |
commit | a0f754e7749a485c97718433edbbab5ac76cdc7a (patch) | |
tree | d968d66e73be6dbac5997a3f5bb8e33e462c96d3 /source/blender/editors/interface/interface_eyedropper.c | |
parent | 137a5e162c2435662dbb299ff49771e7d2e7598f (diff) | |
parent | 523bc981cfeecead5050e7af44bbe252c166d718 (diff) |
Merge branch 'master' into refactor-idprop-ui-datarefactor-idprop-ui-data
Diffstat (limited to 'source/blender/editors/interface/interface_eyedropper.c')
-rw-r--r-- | source/blender/editors/interface/interface_eyedropper.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index b52bfc81b7a..2e7b0ce532c 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -125,24 +125,13 @@ void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const cha eyedropper_draw_cursor_text_ex(x, y, name); } -void eyedropper_draw_cursor_text_region(const struct bContext *C, - const ARegion *region, - const char *name) +void eyedropper_draw_cursor_text_region(const int x, const int y, const char *name) { - wmWindow *win = CTX_wm_window(C); - const int x = win->eventstate->x; - const int y = win->eventstate->y; - - if ((name[0] == '\0') || (BLI_rcti_isect_pt(®ion->winrct, x, y) == false)) { + if (name[0] == '\0') { return; } - const int mval[2] = { - x - region->winrct.xmin, - y - region->winrct.ymin, - }; - - eyedropper_draw_cursor_text_ex(mval[0], mval[1], name); + eyedropper_draw_cursor_text_ex(x, y, name); } /** @@ -168,4 +157,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) +{ + bScreen *screen = CTX_wm_screen(C); + + *r_win = CTX_wm_window(C); + *r_area = BKE_screen_find_area_xy(screen, -1, mval[0], mval[1]); + if (*r_area == NULL) { + wmWindowManager *wm = CTX_wm_manager(C); + *r_win = WM_window_find_under_cursor(wm, NULL, *r_win, mval, r_mval); + if (*r_win) { + screen = WM_window_get_active_screen(*r_win); + *r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, r_mval[0], r_mval[1]); + } + } + else if (mval != r_mval) { + r_mval[0] = mval[0]; + r_mval[1] = mval[1]; + } +} + /** \} */ |