diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-16 08:16:04 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-16 08:22:46 +0300 |
commit | 65b1b1cd349f3bd813392e76eab5b610efba7428 (patch) | |
tree | 2c5bbc151b54ceb581235497980d48de7ea8831c /source | |
parent | a17f74ab341b026387fef6b741e3c0901780526c (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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. */ |