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:
authorHarley Acheson <harley.acheson@gmail.com>2022-02-22 19:57:22 +0300
committerHarley Acheson <harley.acheson@gmail.com>2022-02-22 19:58:42 +0300
commit29696fb7252b88ecda0a5e724bb333b545e77c1e (patch)
tree68e684f1d87d3538542597dfae7d8838ae7345de /source/blender/editors/screen/area.c
parent8ae77efe4e075cbade646f8fe608e54d7d1ace08 (diff)
UI: ActionZone Swap Areas Between Windows
Allow SCREEN_OT_area_swap to operate between different Blender windows, and other minor feedback improvements. See D14135 for more details and demonstrations. Differential Revision: https://developer.blender.org/D14135 Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 95534d2a036..a64948b5864 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3438,6 +3438,38 @@ bool ED_area_is_global(const ScrArea *area)
return area->global != NULL;
}
+ScrArea *ED_area_find_under_cursor(const bContext *C, int spacetype, const int xy[2])
+{
+ bScreen *screen = CTX_wm_screen(C);
+ wmWindow *win = CTX_wm_window(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+
+ ScrArea *area = NULL;
+
+ if (win->parent) {
+ /* If active window is a child, check itself first. */
+ area = BKE_screen_find_area_xy(screen, spacetype, xy);
+ }
+
+ if (!area) {
+ /* Check all windows except the active one. */
+ int scr_pos[2];
+ wmWindow *r_win = WM_window_find_under_cursor(wm, win, win, xy, scr_pos);
+ if (r_win) {
+ win = r_win;
+ screen = WM_window_get_active_screen(win);
+ area = BKE_screen_find_area_xy(screen, spacetype, scr_pos);
+ }
+ }
+
+ if (!area && !win->parent) {
+ /* If active window is a parent window, check itself last. */
+ area = BKE_screen_find_area_xy(screen, spacetype, xy);
+ }
+
+ return area;
+}
+
ScrArea *ED_screen_areas_iter_first(const wmWindow *win, const bScreen *screen)
{
ScrArea *global_area = win->global_areas.areabase.first;