linux: Fix cursor-related panic on Wayland (#29060)

This fixes the panic that happened in debug builds in Wayland when
focusing/defocusing window in the edit mode:

```
"Thread "main" panicked with "CursorStyle::None should be handled separately in the client" at crates/gpui/src/platform/linux/wayland.rs:40:17"
```

Full log:
[stacktrace.txt](https://github.com/user-attachments/files/19814411/stacktrace.txt)

@smitbarmase, you seem to have worked on this code. Tagging you for
visibility :)

Release Notes:

- N/A
This commit is contained in:
Oleksiy Syvokon 2025-04-18 20:00:19 +03:00 committed by GitHub
parent c585dbd8ff
commit 4405ed04d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1498,7 +1498,13 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClientStatePtr {
state.enter_token = None;
}
if let Some(style) = state.cursor_style {
if let Some(cursor_shape_device) = &state.cursor_shape_device {
if let CursorStyle::None = style {
let wl_pointer = state
.wl_pointer
.clone()
.expect("window is focused by pointer");
wl_pointer.set_cursor(serial, None, 0, 0);
} else if let Some(cursor_shape_device) = &state.cursor_shape_device {
cursor_shape_device.set_shape(serial, style.to_shape());
} else {
let scale = window.primary_output_scale();