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:
authorCampbell Barton <ideasman42@gmail.com>2019-07-01 05:10:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-01 05:10:49 +0300
commit05129ffb3e2cea8ec51cb6ee4890f5cd5e31794c (patch)
tree60f96dd7eb056f46c417fb39fb079b30b0ede620 /source/blender/blenkernel/intern/screen.c
parent26e05cf67adb142086e9aa2655424144d14d8913 (diff)
Cleanup: move screen region find into utility function
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r--source/blender/blenkernel/intern/screen.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 86fec1ee754..619845c9ecb 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -738,6 +738,23 @@ ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y
}
/**
+ * \note This is only for screen level regions (typically menus/popups).
+ */
+ARegion *BKE_screen_find_region_xy(bScreen *sc, const int regiontype, int x, int y)
+{
+ ARegion *ar_found = NULL;
+ for (ARegion *ar = sc->regionbase.first; ar; ar = ar->next) {
+ if ((regiontype == RGN_TYPE_ANY) || (ar->regiontype == regiontype)) {
+ if (BLI_rcti_isect_pt(&ar->winrct, x, y)) {
+ ar_found = ar;
+ break;
+ }
+ }
+ }
+ return ar_found;
+}
+
+/**
* \note, ideally we can get the area from the context,
* there are a few places however where this isn't practical.
*/