linux: wayland: fix cursor set_icon (#10374)

Release Notes:

- Partially (Wayland implementation) Fixed
[#10124](https://github.com/zed-industries/zed/issues/10124)).

The recent refactor of the linux gpui implementation
(https://github.com/zed-industries/zed/pull/10227) broke the wayland
cursor update logic by setting the cursor icon as `None`. Fix it by
setting the `cursor_icon_name`.
This commit is contained in:
Joel Selvaraj 2024-04-10 14:59:33 -05:00 committed by GitHub
parent 195f9d9b24
commit 322f68f3d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -701,6 +701,7 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClient {
qh: &QueueHandle<Self>,
) {
let mut state = client.0.borrow_mut();
let cursor_icon_name = state.cursor_icon_name.clone();
match event {
wl_pointer::Event::Enter {
@ -716,7 +717,9 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClient {
state.enter_token = Some(());
state.mouse_focused_window = Some(window.clone());
state.cursor.set_serial_id(serial);
state.cursor.set_icon(&wl_pointer, None);
state
.cursor
.set_icon(&wl_pointer, Some(cursor_icon_name.as_str()));
drop(state);
window.set_focused(true);
}
@ -747,7 +750,9 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClient {
return;
}
state.mouse_location = Some(point(px(surface_x as f32), px(surface_y as f32)));
state.cursor.set_icon(&wl_pointer, None);
state
.cursor
.set_icon(&wl_pointer, Some(cursor_icon_name.as_str()));
if let Some(window) = state.mouse_focused_window.clone() {
let input = PlatformInput::MouseMove(MouseMoveEvent {