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:
authorJulian Eisel <julian@blender.org>2020-03-12 17:58:03 +0300
committerJulian Eisel <julian@blender.org>2020-03-12 17:58:03 +0300
commitb86be9b2145458037fd0b17433b7af0efa7b6472 (patch)
treef333625555402992ebb35d258f93eda1130389e6 /source/blender/editors/interface/interface_query.c
parent00f83ec125207e90bf180b3eb7752d8cb6482a86 (diff)
parentcb6cec904fa14ce0ab10a2a53af5c936d56376cf (diff)
Merge branch 'temp-openxr-ghostxr' into temp-openxr-blenderside
Diffstat (limited to 'source/blender/editors/interface/interface_query.c')
-rw-r--r--source/blender/editors/interface/interface_query.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index 03434b12ddb..52488027662 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -505,6 +505,40 @@ bool UI_block_can_add_separator(const uiBlock *block)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Block (#uiBlock) Spatial
+ * \{ */
+
+uiBlock *ui_block_find_mouse_over_ex(const ARegion *region,
+ const int x,
+ const int y,
+ bool only_clip)
+{
+ if (!ui_region_contains_point_px(region, x, y)) {
+ return NULL;
+ }
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
+ if (only_clip) {
+ if ((block->flag & UI_BLOCK_CLIP_EVENTS) == 0) {
+ continue;
+ }
+ }
+ float mx = x, my = y;
+ ui_window_to_block_fl(region, block, &mx, &my);
+ if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
+ return block;
+ }
+ }
+ return NULL;
+}
+
+uiBlock *ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
+{
+ return ui_block_find_mouse_over_ex(region, event->x, event->y, only_clip);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Region (#ARegion) State
* \{ */