diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8f90a81a459..e35c83ae822 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -453,10 +453,6 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf return; QWaylandWindow *window = QWaylandWindow::fromWlSurface(surface); -#if QT_CONFIG(cursor) - window->window()->setCursor(window->window()->cursor()); -#endif - mFocus = window; mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); mGlobalPos = window->window()->mapToGlobal(mSurfacePos.toPoint()); @@ -464,6 +460,11 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf mParent->mSerial = serial; mEnterSerial = serial; +#if QT_CONFIG(cursor) + // Depends on mEnterSerial being updated + window->window()->setCursor(window->window()->cursor()); +#endif + QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { EnterEvent evt(mSurfacePos, mGlobalPos);