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:
Diffstat (limited to 'source/blender/editors/interface/interface_eyedropper.c')
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c38
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(&region->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];
+ }
+}
+
/** \} */