gpui: Remove unnecessary String (#31314)
Replaces a `String` with `&'static str` Release Notes: - N/A
This commit is contained in:
parent
206be2b348
commit
8b59776320
3 changed files with 7 additions and 11 deletions
|
@ -648,8 +648,8 @@ pub(super) unsafe fn read_fd(mut fd: filedescriptor::FileDescriptor) -> Result<V
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CursorStyle {
|
impl CursorStyle {
|
||||||
#[allow(unused)]
|
#[cfg(any(feature = "wayland", feature = "x11"))]
|
||||||
pub(super) fn to_icon_name(&self) -> String {
|
pub(super) fn to_icon_name(&self) -> &'static str {
|
||||||
// Based on cursor names from https://gitlab.gnome.org/GNOME/adwaita-icon-theme (GNOME)
|
// Based on cursor names from https://gitlab.gnome.org/GNOME/adwaita-icon-theme (GNOME)
|
||||||
// and https://github.com/KDE/breeze (KDE). Both of them seem to be also derived from
|
// and https://github.com/KDE/breeze (KDE). Both of them seem to be also derived from
|
||||||
// Web CSS cursor names: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#values
|
// Web CSS cursor names: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#values
|
||||||
|
@ -682,7 +682,6 @@ impl CursorStyle {
|
||||||
"default"
|
"default"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.to_string()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -704,7 +704,7 @@ impl LinuxClient for WaylandClient {
|
||||||
let scale = focused_window.primary_output_scale();
|
let scale = focused_window.primary_output_scale();
|
||||||
state
|
state
|
||||||
.cursor
|
.cursor
|
||||||
.set_icon(&wl_pointer, serial, &style.to_icon_name(), scale);
|
.set_icon(&wl_pointer, serial, style.to_icon_name(), scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1511,12 +1511,9 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClientStatePtr {
|
||||||
cursor_shape_device.set_shape(serial, style.to_shape());
|
cursor_shape_device.set_shape(serial, style.to_shape());
|
||||||
} else {
|
} else {
|
||||||
let scale = window.primary_output_scale();
|
let scale = window.primary_output_scale();
|
||||||
state.cursor.set_icon(
|
state
|
||||||
&wl_pointer,
|
.cursor
|
||||||
serial,
|
.set_icon(&wl_pointer, serial, style.to_icon_name(), scale);
|
||||||
&style.to_icon_name(),
|
|
||||||
scale,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drop(state);
|
drop(state);
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ impl LinuxClient for X11Client {
|
||||||
CursorStyle::None => create_invisible_cursor(&state.xcb_connection).log_err(),
|
CursorStyle::None => create_invisible_cursor(&state.xcb_connection).log_err(),
|
||||||
_ => state
|
_ => state
|
||||||
.cursor_handle
|
.cursor_handle
|
||||||
.load_cursor(&state.xcb_connection, &style.to_icon_name())
|
.load_cursor(&state.xcb_connection, style.to_icon_name())
|
||||||
.log_err(),
|
.log_err(),
|
||||||
}) else {
|
}) else {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue