https://bugs.kde.org/show_bug.cgi?id=527285

            Bug ID: 527285
           Summary: Client cursor surface with hotspot (0, 0) is not drawn
    Classification: Plasma
           Product: kwin
      Version First 6.8.0
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Since KWin 6.8.0, a cursor set with `wl_pointer.set_cursor` is invisible if its
hotspot is (0, 0). The same image with any other hotspot shows up fine. The
cursor stays invisible until the client commits the cursor surface again.

Seen with an old Windows game (Silkroad Online, Wine in gamescope), whose
cursor with hotspot (0, 0) disappears.

**Steps to reproduce**
1. A client attaches and commits a 32x32 ARGB shm buffer to a new wl_surface.
2. On `wl_pointer.enter`, it calls `set_cursor(serial, surface, 0, 0)`.

**Actual:** no cursor is shown over the client.
**Expected:** the cursor image is shown.

The cursor appears if the hotspot is e.g. (2, 1), or if the client commits the
same buffer again after `set_cursor`.

## Cause

`CursorItem::setSurface()` creates a new `SurfaceItemWayland` and relies on
`setPosition(-hotspot)` to schedule the repaint. For a (0, 0) hotspot the
position doesn't change, so `setPosition()` returns early and the new cursor is
never painted.

## Fix (tested locally on 6.8.0)

```diff
--- a/src/scene/cursoritem.cpp
+++ b/src/scene/cursoritem.cpp
@@ -45,6 +45,9 @@ void CursorItem::setSurface(SurfaceInterface *surface, const
QPointF &hotspot)
     }
     if (m_surfaceItem) {
         m_surfaceItem->setPosition(-hotspot);
+        // setPosition() only repaints when the position changes, so a new
cursor
+        // surface with a (0, 0) hotspot would otherwise never be drawn.
+        m_surfaceItem->scheduleRepaint(m_surfaceItem->rect());
     }
 }
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to