From 4405ed04d093b602ddbed745a33335c4fec29c61 Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Fri, 18 Apr 2025 20:00:19 +0300 Subject: [PATCH] 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 --- crates/gpui/src/platform/linux/wayland/client.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index 0255dd8776c6ca19599f4500a87308c177b7eba7..80da04794a5071f83bba5ca9f1af5423da05fa21 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -1498,7 +1498,13 @@ impl Dispatch 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();