Fix T53004: XWayland ignores cursor-warp calls
[blender.git] / intern / ghost / intern / GHOST_WindowX11.cpp
index 9e019b233f655b3774c4dc2e910d1350719a4509..1abdec374035854d198ff0dc97cf2b6629274e1a 100644 (file)
@@ -1526,7 +1526,6 @@ setWindowCursorGrab(
        else {
                if (m_cursorGrab == GHOST_kGrabHide) {
                        m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
-                       setWindowCursorVisibility(true);
                }
 
                if (m_cursorGrab != GHOST_kGrabNormal) {
@@ -1550,6 +1549,11 @@ setWindowCursorGrab(
                        }
                }
 
+               /* Perform this last so to workaround XWayland bug, see: T53004. */
+               if (m_cursorGrab == GHOST_kGrabHide) {
+                       setWindowCursorVisibility(true);
+               }
+
                /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
                setCursorGrabAccum(0, 0);
                m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */