From 65b1b1cd349f3bd813392e76eab5b610efba7428 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Jun 2022 15:16:04 +1000 Subject: GHOST/Wayland: workaround inability to access window position Wayland doesn't support accessing the position making functionality that would map events to other windows fail, sometimes considering windows overlapping when they weren't (as all window positions were zeroed). Disable dragging between windows when accessing the window the position isn't supported. --- source/blender/windowmanager/intern/wm_event_system.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 658e643508e..e44016948fc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -4942,7 +4942,11 @@ static void attach_ndof_data(wmEvent *event, const GHOST_TEventNDOFMotionData *g /* Imperfect but probably usable... draw/enable drags to other windows. */ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *event) { - int mval[2] = {event->xy[0], event->xy[1]}; + /* If GHOST doesn't support window positioning, don't use this feature at all. */ + const static int8_t supports_window_position = GHOST_SupportsWindowPosition(); + if (!supports_window_position) { + return nullptr; + } if (wm->windows.first == wm->windows.last) { return nullptr; @@ -4951,6 +4955,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi /* In order to use window size and mouse position (pixels), we have to use a WM function. */ /* Check if outside, include top window bar. */ + int mval[2] = {event->xy[0], event->xy[1]}; if (mval[0] < 0 || mval[1] < 0 || mval[0] > WM_window_pixels_x(win) || mval[1] > WM_window_pixels_y(win) + 30) { /* Let's skip windows having modal handlers now. */ -- cgit v1.2.3