Skip to content

Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.

Show the hand cursor over clickable controls (#41)

VRonGitHube67929b193d1
diff --git a/apps/rustcord/src/camera.rs b/apps/rustcord/src/camera.rs
index c6c328e..15de660 100644
--- a/apps/rustcord/src/camera.rs
+++ b/apps/rustcord/src/camera.rs
@@ -257,7 +257,7 @@ impl RustCord {
let go = ui.add_enabled(error.is_none(), Button::new(RichText::new("Turn On Camera").font(crate::style::medium(14.0)).color(Color32::WHITE)).fill(Color32::from_rgb(88, 101, 242)).rounding(8.0).min_size(vec2(0.0, 38.0)));
turn_on = go.clicked();
ui.add_space(8.0);
- if ui.add(Button::new(RichText::new("Cancel").font(crate::style::medium(14.0)).color(t.header_primary)).frame(false).min_size(vec2(70.0, 38.0))).clicked() {
+ if ui.add(Button::new(RichText::new("Cancel").font(crate::style::medium(14.0)).color(t.header_primary)).frame(false).min_size(vec2(70.0, 38.0))).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
close = true;
}
});
diff --git a/apps/rustcord/src/golive.rs b/apps/rustcord/src/golive.rs
index 5e8054f..6ef4ee5 100644
--- a/apps/rustcord/src/golive.rs
+++ b/apps/rustcord/src/golive.rs
@@ -678,7 +678,7 @@ impl RustCord {
let Some(w) = self.watching.iter().find(|w| w.streamer == streamer) else { return out };
let (connected, size, tex, channel) = (w.connected, w.size, w.frame.clone(), w.channel);
let stats = w.handle.as_ref().map(|h| h.stats()).unwrap_or_default();
- let resp = ui.interact(rect, egui::Id::new(("watch_video", streamer.0)), Sense::click());
+ let resp = ui.interact(rect, egui::Id::new(("watch_video", streamer.0)), Sense::click()).on_hover_cursor(CursorIcon::PointingHand);
let hovered = ui.rect_contains_pointer(rect);
let p = ui.painter_at(rect.expand(3.0));
p.rect_filled(rect, 12.0, Color32::BLACK);
@@ -1028,6 +1028,7 @@ impl RustCord {
ui.label(RichText::new("Screen Share").font(FontId::new(20.0, egui::FontFamily::Name(crate::style::BOLD.into()))).color(t.header_primary));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let (x, r) = ui.allocate_exact_size(vec2(28.0, 28.0), Sense::click());
+ let r = r.on_hover_cursor(egui::CursorIcon::PointingHand);
if r.hovered() {
ui.painter().rect_filled(x, 6.0, overlay(0.16));
}
@@ -1152,7 +1153,7 @@ impl RustCord {
go = Some((s, pk.quality, pk.audio));
}
}
- if ui.add(egui::Button::new(RichText::new("Cancel").size(14.0).color(t.header_primary)).frame(false)).clicked() {
+ if ui.add(egui::Button::new(RichText::new("Cancel").size(14.0).color(t.header_primary)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
close = true;
}
});
diff --git a/apps/rustcord/src/ui/app_directory.rs b/apps/rustcord/src/ui/app_directory.rs
index 69e85e3..c6f6311 100644
--- a/apps/rustcord/src/ui/app_directory.rs
+++ b/apps/rustcord/src/ui/app_directory.rs
@@ -86,11 +86,11 @@ impl RustCord {
ui.set_height(size.y);
ui.horizontal(|ui| {
if dir.app.is_some() {
- back |= ui.add(egui::Button::new(RichText::new(icon::BACK).font(crate::style::icon_font(16.0)).color(t.interactive_normal)).frame(false)).clicked();
+ back |= ui.add(egui::Button::new(RichText::new(icon::BACK).font(crate::style::icon_font(16.0)).color(t.interactive_normal)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
}
ui.label(bold("App Directory").size(20.0).color(t.header_primary));
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- close |= ui.add(egui::Button::new(RichText::new(icon::CLOSE).font(crate::style::icon_font(15.0)).color(t.interactive_normal)).frame(false)).clicked();
+ close |= ui.add(egui::Button::new(RichText::new(icon::CLOSE).font(crate::style::icon_font(15.0)).color(t.interactive_normal)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
});
ui.add_space(14.0);
diff --git a/apps/rustcord/src/ui/chat.rs b/apps/rustcord/src/ui/chat.rs
index 09b246f..30540fe 100644
--- a/apps/rustcord/src/ui/chat.rs
+++ b/apps/rustcord/src/ui/chat.rs
@@ -538,6 +538,7 @@ fn mention_chip_with(ui: &mut Ui, t: &crate::style::Theme, glyph: Option<&str>,
// (In 14 px text the chip stays inside the 18 px line.)
let h = if size < text_px() { galley.size().y.min((size * 9.0 / 7.0).round()) } else { galley.size().y };
let (rect, resp) = ui.allocate_exact_size(vec2(icon_w + galley.size().x + 4.0, h), if interactive { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let hovered = interactive && resp.hovered();
let a = |c: Color32, alpha: f32| crate::style::rgba(c.r(), c.g(), c.b(), (alpha * 255.0).round() as u8);
let (bg, fg) = match role {
@@ -635,6 +636,7 @@ fn menu_row(ui: &mut Ui, t: &crate::style::Theme, glyph: &str, label: &str, dang
fn header_icon(ui: &mut Ui, t: &crate::style::Theme, glyph: &str, active: bool, tip: &str) -> Response {
// Discord: 32 px buttons, 20 px icons in --text-muted (white when on / hovered).
let (r, b) = ui.allocate_exact_size(vec2(32.0, 32.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if active || b.hovered() { t.header_primary } else { t.text_muted };
super::paint_icon(ui.painter(), Rect::from_center_size(r.center(), vec2(20.0, 20.0)), glyph, c);
b.on_hover_text(tip)
@@ -681,7 +683,7 @@ fn upload_tile(ui: &mut Ui, t: &crate::style::Theme, u: &crate::features::Pendin
t.text_muted,
);
let trash = Rect::from_min_size(pos2(rect.right() - 26.0, rect.top() - 10.0), vec2(36.0, 36.0));
- let resp = ui.interact(trash, egui::Id::new(("upload_trash", &u.uri)), Sense::click());
+ let resp = ui.interact(trash, egui::Id::new(("upload_trash", &u.uri)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let hovered = resp.hovered();
ui.painter().rect(trash, 6.0, if hovered { t.danger } else { t.bg_primary }, Stroke::new(1.0_f32, t.bg_tertiary));
ui.painter().text(trash.center(), Align2::CENTER_CENTER, icon::DELETE, icon_font(16.0), if hovered { Color32::WHITE } else { t.danger });
@@ -1034,7 +1036,7 @@ impl RustCord {
ui.label(RichText::new("Discord will never ask you for your password or account token.").size(12.0).color(t.text_muted));
});
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- if ui.add(Button::new(bold("Learn More").size(13.0).color(t.header_primary)).fill(t.surface_high)).clicked() {
+ if ui.add(Button::new(bold("Learn More").size(13.0).color(t.header_primary)).fill(t.surface_high)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
ui.ctx().open_url(egui::OpenUrl::new_tab("https://support.discord.com/hc/en-us/articles/360036118732"));
}
});
@@ -1100,6 +1102,7 @@ impl RustCord {
ui.add(Label::new(bold(&name).size(15.0).color(t.header_primary)).truncate());
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
let (r, resp) = ui.allocate_exact_size(vec2(28.0, 28.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(r, 6.0, t.bg_hover);
}
@@ -1751,7 +1754,7 @@ impl RustCord {
if let Some(err) = &cm.error {
ui.vertical_centered(|ui| {
ui.colored_label(t.danger, format!("Couldn't load messages: {err}"));
- if ui.button("Retry").clicked() {
+ if ui.button("Retry").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
actions.push(UiAction::Retry(ch));
}
});
@@ -2086,7 +2089,7 @@ impl RustCord {
for (i, tool) in tools.iter().enumerate() {
let cell = Rect::from_min_size(pos2(bar.left() + 2.0 + i as f32 * CELL, bar.top() + 2.0), vec2(CELL, CELL));
- let r = ui.interact(cell, egui::Id::new(("message_toolbar", m.id.0, i)), Sense::click());
+ let r = ui.interact(cell, egui::Id::new(("message_toolbar", m.id.0, i)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if r.hovered() {
ui.painter().rect_filled(cell.shrink(2.0), 4.0, t.bg_hover);
}
@@ -2157,7 +2160,7 @@ impl RustCord {
// Play / pause.
let play = Rect::from_center_size(pos2(bar.left() + 20.0, bar.center().y), vec2(28.0, 28.0));
- let pr = ui.interact(play, egui::Id::new(("audio_play", &a.url)), Sense::click());
+ let pr = ui.interact(play, egui::Id::new(("audio_play", &a.url)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if st.loading {
egui::Spinner::new().size(16.0).paint_at(ui, Rect::from_center_size(play.center(), vec2(16.0, 16.0)));
} else {
@@ -2178,7 +2181,7 @@ impl RustCord {
// Mute.
let vol = Rect::from_center_size(pos2(bar.right() - 20.0, bar.center().y), vec2(28.0, 28.0));
- let vr = ui.interact(vol, egui::Id::new(("audio_vol", &a.url)), Sense::click());
+ let vr = ui.interact(vol, egui::Id::new(("audio_vol", &a.url)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let g = if self.audio.muted { icon::MUTE } else { icon::SPEAK };
ui.painter().text(vol.center(), Align2::CENTER_CENTER, g, icon_font(16.0), if vr.hovered() { t.header_primary } else { t.interactive_normal });
if vr.on_hover_text(if self.audio.muted { "Unmute" } else { "Mute" }).clicked() {
@@ -2309,6 +2312,7 @@ impl RustCord {
let galley = ui.painter().layout_no_wrap(r.count.to_string(), font, Color32::PLACEHOLDER);
let size = vec2(1.0 + 6.0 + 20.0 + 6.0 + galley.size().x + 6.0 + 1.0, 30.0);
let (rect, resp) = ui.allocate_exact_size(size, Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let grey = |a: u8| crate::style::rgba(151, 151, 159, a);
let (fill, border, text_color) = if r.me {
(crate::style::rgba(88, 101, 242, 61), Color32::from_rgb(88, 101, 242), Color32::from_rgb(185, 200, 255))
@@ -2990,9 +2994,9 @@ impl RustCord {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 3.0;
ui.label(RichText::new("escape to").size(11.5).color(t.text_muted));
- cancel |= ui.link(RichText::new("cancel").size(11.5)).clicked();
+ cancel |= ui.link(RichText::new("cancel").size(11.5)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
ui.label(RichText::new("• enter to").size(11.5).color(t.text_muted));
- save_click = ui.link(RichText::new("save").size(11.5)).clicked();
+ save_click = ui.link(RichText::new("save").size(11.5)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
if save || save_click {
actions.push(UiAction::SaveEdit);
@@ -3670,7 +3674,7 @@ impl RustCord {
p.rect_filled(bar, Rounding { nw: 8.0, ne: 8.0, sw: 0.0, se: 0.0 }, t.bg_secondary);
let mid = bar.center().y;
let close = Rect::from_min_size(pos2(bar.right() - 44.0, bar.top()), vec2(40.0, 32.0));
- let close_resp = ui.interact(close, ui.id().with(("reply_close", ch.0)), Sense::click());
+ let close_resp = ui.interact(close, ui.id().with(("reply_close", ch.0)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let cc = if close_resp.hovered() { t.interactive_hover } else { t.header_secondary };
p.circle_filled(close.center(), 8.0, cc);
let x = Stroke::new(1.6_f32, t.bg_secondary);
@@ -3685,7 +3689,7 @@ impl RustCord {
let font = FontId::new(14.0, egui::FontFamily::Name(crate::style::BOLD.into()));
let w = ui.fonts(|f| f.layout_no_wrap(label.to_string(), font.clone(), color).size().x) + 24.0;
let mr = Rect::from_min_size(pos2(close.left() - w, bar.top()), vec2(w, 32.0));
- let resp = ui.interact(mr, ui.id().with(("reply_mention", ch.0)), Sense::click());
+ let resp = ui.interact(mr, ui.id().with(("reply_mention", ch.0)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
p.text(mr.center(), Align2::CENTER_CENTER, label, font, color);
// (The line between the two buttons.)
p.vline(mr.right(), (bar.top() + 8.0)..=(bar.bottom() - 8.0), Stroke::new(1.0_f32, t.border_subtle));
@@ -4400,6 +4404,7 @@ impl RustCord {
ui.spacing_mut().item_spacing.x = 6.0;
for e in &quick {
let (r, b) = ui.allocate_exact_size(vec2(46.5, 44.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect_filled(r, 8.0, if b.hovered() { t.bg_hover } else { t.bg_secondary });
let s = if b.hovered() { 26.0 } else { 24.0 };
egui::Image::new(twemoji_url(e)).paint_at(ui, Rect::from_center_size(r.center(), vec2(s, s)));
diff --git a/apps/rustcord/src/ui/compose_tools.rs b/apps/rustcord/src/ui/compose_tools.rs
index 2a51f09..d7b4fe7 100644
--- a/apps/rustcord/src/ui/compose_tools.rs
+++ b/apps/rustcord/src/ui/compose_tools.rs
@@ -191,6 +191,7 @@ fn checkbox(ui: &mut Ui, t: &Theme, on: &mut bool, label: &str) -> egui::Respons
fn button(ui: &mut Ui, label: &str, fill: Color32, fg: Color32, size: egui::Vec2, enabled: bool) -> egui::Response {
let (r, resp) = ui.allocate_exact_size(size, if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let fill = if !enabled { fill.gamma_multiply(0.5) } else if resp.hovered() { fill.lerp_to_gamma(Color32::BLACK, 0.12) } else { fill };
ui.painter().rect_filled(r, 8.0, fill);
ui.painter().text(r.center(), Align2::CENTER_CENTER, label, strong(14.0), if enabled { fg } else { fg.gamma_multiply(0.6) });
@@ -224,7 +225,7 @@ fn modal(ctx: &egui::Context, t: &Theme, id: &str, title: &str, width: f32, clic
let top = ui.cursor().min;
ui.label(RichText::new(title).font(strong(20.0)).color(t.header_primary));
let x = Rect::from_center_size(pos2(top.x + width - 10.0, top.y + 12.0), vec2(26.0, 26.0));
- let xr = ui.interact(x, egui::Id::new((id, "close")), Sense::click());
+ let xr = ui.interact(x, egui::Id::new((id, "close")), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(15.0), if xr.hovered() { t.header_primary } else { t.interactive_normal });
open &= !xr.clicked();
ui.add_space(20.0);
@@ -629,6 +630,7 @@ impl RustCord {
ui.label(RichText::new(format!("Scheduling message for {}", schedule_label(&at))).size(14.0).color(t.text_normal));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let (r, resp) = ui.allocate_exact_size(vec2(18.0, 18.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().circle_filled(r.center(), 8.0, if resp.hovered() { t.interactive_hover } else { t.interactive_normal });
ui.painter().text(r.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(8.0), t.bg_secondary);
clear = resp.on_hover_text("Cancel scheduling").clicked();
@@ -763,6 +765,7 @@ impl RustCord {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 8.0;
let (er, eresp) = ui.allocate_exact_size(vec2(24.0, 24.0), Sense::click());
+ let eresp = eresp.on_hover_cursor(egui::CursorIcon::PointingHand);
match emoji.as_ref() {
Some(e) => egui::Image::new(emoji_image(e)).paint_at(ui, er.shrink(2.0)),
None => {
@@ -784,6 +787,7 @@ impl RustCord {
.char_limit(55),
);
let (tr, tresp) = ui.allocate_exact_size(vec2(24.0, 24.0), Sense::click());
+ let tresp = tresp.on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if tresp.hovered() { t.danger } else { t.interactive_normal };
ui.painter().text(tr.center(), Align2::CENTER_CENTER, icon::DELETE, icon_font(15.0), c);
if tresp.on_hover_text("Remove answer").clicked() {
@@ -919,6 +923,7 @@ impl RustCord {
let (votes, mine) = poll.votes(a.answer_id);
let picked = sel.contains(&a.answer_id);
let (row, resp) = ui.allocate_exact_size(vec2(w - 32.0, 46.0), if results { Sense::hover() } else { Sense::click() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let p = ui.painter();
if results {
p.rect_filled(row, 8.0, overlay(0.05));
@@ -1047,7 +1052,7 @@ impl RustCord {
ui.painter().text(pos2(head.left() + 22.0, head.center().y), Align2::CENTER_CENTER, GLYPH_THREAD, icon_font(18.0), t.interactive_normal);
ui.painter().text(pos2(head.left() + 42.0, head.center().y), Align2::LEFT_CENTER, "New Thread", strong(16.0), t.header_primary);
let x = Rect::from_center_size(pos2(head.right() - 24.0, head.center().y), vec2(28.0, 28.0));
- let xr = ui.interact(x, egui::Id::new("new_thread_close"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("new_thread_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(14.0), if xr.hovered() { t.header_primary } else { t.interactive_normal });
close |= xr.clicked();
@@ -1221,7 +1226,7 @@ impl RustCord {
if r.bottom() > rail_rect.bottom() - 4.0 {
break;
}
- let resp = ui.interact(r, egui::Id::new(("apps_rail", app.as_str())), Sense::click());
+ let resp = ui.interact(r, egui::Id::new(("apps_rail", app.as_str())), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let active = app_filter.as_deref() == Some(app.as_str());
if active || resp.hovered() {
ui.painter().rect_filled(r.expand(3.0), 8.0, overlay(if active { 0.16 } else { 0.08 }));
@@ -1273,6 +1278,7 @@ impl RustCord {
ui.add_space(4.0);
}
let (row, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 50.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() && ui.input(|inp| inp.pointer.delta() != egui::Vec2::ZERO) {
self.compose.apps_sel = i;
}
diff --git a/apps/rustcord/src/ui/connections.rs b/apps/rustcord/src/ui/connections.rs
index efe3590..486d923 100644
--- a/apps/rustcord/src/ui/connections.rs
+++ b/apps/rustcord/src/ui/connections.rs
@@ -548,7 +548,7 @@ impl RustCord {
ui.add_space(24.0);
ui.horizontal(|ui| {
let other = if d.https { "Verify using DNS" } else { "Verify using HTTPS" };
- if ui.add(egui::Button::new(egui::RichText::new(other).font(crate::style::medium(14.0)).color(t.text_link)).frame(false)).clicked() {
+ if ui.add(egui::Button::new(egui::RichText::new(other).font(crate::style::medium(14.0)).color(t.text_link)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
switch_way = true;
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
@@ -662,7 +662,7 @@ fn notice(ui: &mut Ui, t: &Theme, text: &str, critical: bool) {
fn primary(ui: &mut Ui, label: &str, enabled: bool, busy: bool) -> egui::Response {
let brand = crate::style::rgba(0x58, 0x65, 0xf2, 255);
let text = if busy { "…" } else { label };
- ui.add_enabled(enabled, egui::Button::new(egui::RichText::new(text).font(crate::style::medium(14.0)).color(Color32::WHITE)).fill(brand).rounding(8.0).min_size(vec2(96.0, 38.0)))
+ ui.add_enabled(enabled, egui::Button::new(egui::RichText::new(text).font(crate::style::medium(14.0)).color(Color32::WHITE)).fill(brand).rounding(8.0).min_size(vec2(96.0, 38.0))).on_hover_cursor(egui::CursorIcon::PointingHand)
}
/// Cancel (secondary) and the action, on the right. (cancelled, confirmed)
@@ -671,7 +671,7 @@ fn dialog_buttons(ui: &mut Ui, t: &Theme, cancel: &str, action: &str, enabled: b
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
a = primary(ui, action, enabled, busy).clicked();
ui.add_space(8.0);
- c = ui.add(egui::Button::new(egui::RichText::new(cancel).font(crate::style::medium(14.0)).color(t.header_primary)).fill(overlay(0.12)).rounding(8.0).min_size(vec2(96.0, 38.0))).clicked();
+ c = ui.add(egui::Button::new(egui::RichText::new(cancel).font(crate::style::medium(14.0)).color(t.header_primary)).fill(overlay(0.12)).rounding(8.0).min_size(vec2(96.0, 38.0))).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
(c, a)
}
diff --git a/apps/rustcord/src/ui/embeds.rs b/apps/rustcord/src/ui/embeds.rs
index 2cb7c4d..e984695 100644
--- a/apps/rustcord/src/ui/embeds.rs
+++ b/apps/rustcord/src/ui/embeds.rs
@@ -480,6 +480,7 @@ impl RustCord {
fn music_card(&self, ui: &mut Ui, m: &Message, idx: usize, e: &Embed, parts: &Parts, src: String, size: Vec2, bg: Color32, rounding: f32, actions: &mut Vec<UiAction>) {
let key = (m.id, idx);
let (rect, resp) = ui.allocate_exact_size(size, Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect_filled(rect, rounding, bg);
if self.embed_playing(key) {
self.report_player(ui, key, rect);
@@ -530,6 +531,7 @@ impl RustCord {
/// playing picture with its controls (shown while hovered or paused).
pub(super) fn video_box(&self, ui: &mut Ui, url: &str, poster: Option<&str>, size: Vec2, rounding: f32, actions: &mut Vec<UiAction>) {
let (rect, resp) = ui.allocate_exact_size(size, Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect_filled(rect, rounding, Color32::BLACK);
let player = self.video_player.as_ref().filter(|p| p.url == url);
// Nothing but the black box to show yet?
@@ -880,6 +882,7 @@ impl RustCord {
let icon_url = a.proxy_icon_url.clone().or_else(|| a.icon_url.clone()).filter(|u| !u.is_empty());
let name_w = text_emoji_width(ui, &a.name, &strong(14.0)).ceil() + if icon_url.is_some() { 32.0 } else { 0.0 };
let (row, resp) = ui.allocate_exact_size(vec2(name_w.min(w), if icon_url.is_some() { 24.0 } else { 22.0 }), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let mut x = row.left();
if let Some(icon) = icon_url {
egui::Image::new(icon).rounding(12.0).paint_at(ui, Rect::from_min_size(row.min, vec2(24.0, 24.0)));
diff --git a/apps/rustcord/src/ui/expression.rs b/apps/rustcord/src/ui/expression.rs
index 6848c27..853ee6b 100644
--- a/apps/rustcord/src/ui/expression.rs
+++ b/apps/rustcord/src/ui/expression.rs
@@ -386,7 +386,7 @@ fn rail<T>(ui: &mut Ui, t: &Theme, id: egui::Id, sections: &[Section<T>], active
for i in first..last {
let s = &sections[i];
let r = row(i);
- let resp = ui.interact(r, id.with(("rail", i)), Sense::click());
+ let resp = ui.interact(r, id.with(("rail", i)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let on = i == active;
let hot = resp.hovered();
if on || hot {
@@ -426,7 +426,7 @@ fn skin_tone_selector(ui: &mut Ui, t: &Theme, button: Rect, salt: &str) {
egui::Image::new(picture(tone)).show_loading_spinner(false).paint_at(ui, Rect::from_center_size(cell.center(), vec2(24.0, 24.0)));
};
if !open {
- let resp = ui.interact(button, id.with("button"), Sense::click());
+ let resp = ui.interact(button, id.with("button"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(button, 4.0, t.bg_hover);
}
@@ -443,7 +443,7 @@ fn skin_tone_selector(ui: &mut Ui, t: &Theme, button: Rect, salt: &str) {
let mut close = false;
for (i, tone) in order.into_iter().enumerate() {
let cell = Rect::from_min_size(button.min + vec2(0.0, 38.0 * i as f32), vec2(38.0, 38.0));
- let resp = ui.interact(cell, id.with(("tone", tone)), Sense::click());
+ let resp = ui.interact(cell, id.with(("tone", tone)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(cell, 4.0, t.bg_hover);
}
@@ -831,7 +831,7 @@ fn masonry(ui: &mut Ui, t: &Theme, salt: &str, tiles: &[Tile], favs: Option<&Fre
if !ui.is_rect_visible(rect) {
continue;
}
- let resp = ui.interact(rect, ui.id().with(("gif_tile", i)), Sense::click());
+ let resp = ui.interact(rect, ui.id().with(("gif_tile", i)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let hot = resp.hovered();
ui.painter().rect_filled(rect, 6.0, overlay(0.06));
if tile.still.ends_with(POSTER) {
@@ -901,7 +901,7 @@ fn gif_home(ui: &mut Ui, t: &Theme, fav_bg: Option<(String, String)>, trending_b
if !ui.is_rect_visible(rect) {
continue;
}
- let resp = ui.interact(rect, ui.id().with(("gif_home", i)), Sense::click());
+ let resp = ui.interact(rect, ui.id().with(("gif_home", i)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let hot = resp.hovered();
let rounding = egui::Rounding::same(6.0);
ui.painter().rect_filled(rect, rounding, overlay(0.08));
@@ -1679,7 +1679,7 @@ impl RustCord {
ui.painter().rect_filled(pic, 2.0, Color32::from_black_alpha(153));
ui.painter().text(pic.center(), Align2::CENTER_CENTER, icon::LOCK, icon_font(16.0), t.interactive_normal);
resp.on_hover_cursor(CursorIcon::NotAllowed);
- } else if resp.clicked() {
+ } else if resp.on_hover_cursor(CursorIcon::PointingHand).clicked() {
picked = Some((e.picked(), ui.input(|i| i.modifiers.shift)));
}
});
diff --git a/apps/rustcord/src/ui/forum.rs b/apps/rustcord/src/ui/forum.rs
index 98a9c38..eb054c8 100644
--- a/apps/rustcord/src/ui/forum.rs
+++ b/apps/rustcord/src/ui/forum.rs
@@ -680,7 +680,7 @@ impl RustCord {
} else if let Some(e) = &self.forum.error {
note(ui, &format!("Couldn't load the posts: {e}"));
ui.vertical_centered(|ui| {
- if ui.link("Try again").clicked() {
+ if ui.link("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
reload = true;
}
});
diff --git a/apps/rustcord/src/ui/friends.rs b/apps/rustcord/src/ui/friends.rs
index 8cfc0ae..746b6c8 100644
--- a/apps/rustcord/src/ui/friends.rs
+++ b/apps/rustcord/src/ui/friends.rs
@@ -113,7 +113,7 @@ fn pill(ui: &mut Ui, t: &Theme, label: &str, kind: Pill, badge: usize) -> Respon
/// the glyph on hover (green accept, red ignore).
fn round_button(ui: &mut Ui, t: &Theme, center: egui::Pos2, id: egui::Id, glyph: Option<&str>, tip: &str, tint: Option<Color32>) -> Response {
let r = Rect::from_center_size(center, vec2(36.0, 36.0));
- let b = ui.interact(r, id, Sense::click());
+ let b = ui.interact(r, id, Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().circle_filled(center, 18.0, t.bg_secondary);
let color = if b.hovered() { tint.unwrap_or(t.interactive_hover) } else { t.interactive_normal };
match glyph {
@@ -359,6 +359,7 @@ impl RustCord {
ui.add(field);
if !self.friends_search.is_empty() {
let (r, b) = ui.allocate_exact_size(vec2(18.0, 18.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(r.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(12.0), if b.hovered() { t.header_primary } else { t.text_muted });
if b.clicked() {
self.friends_search.clear();
@@ -426,6 +427,7 @@ impl RustCord {
fn friend_row(&self, ui: &mut Ui, t: &Theme, row: &Row, prev_hovered: bool) -> (Option<FriendAction>, bool) {
let mut action = None;
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 62.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if !ui.is_rect_visible(rect) {
return (None, false);
}
@@ -609,6 +611,7 @@ impl RustCord {
ui.set_width(188.0);
let mut row = |ui: &mut Ui, glyph: &str, label: &str, danger: bool, n: u8| {
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 34.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let color = if danger { t.danger } else if resp.hovered() { t.header_primary } else { t.interactive_normal };
if resp.hovered() {
ui.painter().rect_filled(r, 4.0, if danger { t.danger.gamma_multiply(0.15) } else { overlay(0.16) });
@@ -768,6 +771,7 @@ impl RustCord {
fn card_frame(ui: &mut Ui, t: &Theme, body_h: f32) -> (Rect, Rect, Response) {
let h = 68.0 + body_h + 2.0;
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), h), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let fill = if resp.hovered() { over(t.bg_secondary_alt, overlay(0.06)) } else { t.bg_secondary_alt };
ui.painter().rect(rect, 16.0, fill, Stroke::new(1.0_f32, overlay(0.12)));
let header = Rect::from_min_size(rect.min + vec2(1.0, 1.0), vec2(rect.width() - 2.0, 68.0));
@@ -979,6 +983,7 @@ impl RustCord {
ui.add_space(16.0);
// "Explore Discoverable Servers" tile: green tile, label, chevron.
let (rect, resp) = ui.allocate_exact_size(vec2(270.0, 56.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect(rect, 8.0, if resp.hovered() { t.bg_hover } else { t.bg_secondary }, Stroke::new(1.0_f32, t.border_subtle));
let tile = Rect::from_center_size(pos2(rect.left() + 28.0, rect.center().y), vec2(32.0, 32.0));
ui.painter().rect_filled(tile, 8.0, Color32::from_rgb(0x23, 0xa5, 0x5a));
@@ -1034,6 +1039,7 @@ impl RustCord {
ui.label(RichText::new(&name).font(strong(16.0)).color(t.header_primary));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let (r, b) = ui.allocate_exact_size(vec2(24.0, 24.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(r.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(14.0), if b.hovered() { t.header_primary } else { t.interactive_normal });
close = b.on_hover_text("Close").clicked();
});
@@ -1100,6 +1106,7 @@ impl RustCord {
let name = user.display_name().to_string();
let preview = self.request_previews.get(&c.id).map(|m| m.content.clone()).filter(|s| !s.is_empty());
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 62.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let hovered = ui.rect_contains_pointer(rect);
if self.request_preview == Some(c.id) {
ui.painter().rect_filled(rect, 8.0, t.bg_selected);
@@ -1136,10 +1143,10 @@ impl RustCord {
}
let sub = preview.as_deref().and_then(|s| s.lines().next()).unwrap_or("Sent you a message");
super::paint_text_emoji(ui, &p, pos2(av.right() + 12.0, rect.center().y + 10.0), sub, FontId::proportional(14.0), t.text_muted);
- let decline = ui.interact(decline_r, egui::Id::new(("req_decline", c.id.0)), Sense::click());
+ let decline = ui.interact(decline_r, egui::Id::new(("req_decline", c.id.0)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect(decline_r, 8.0, if decline.hovered() { overlay(0.2) } else { overlay(0.12) }, Stroke::new(1.0_f32, overlay(0.04)));
ui.painter().text(decline_r.center(), Align2::CENTER_CENTER, "Decline", strong(14.0), t.header_primary);
- let accept = ui.interact(accept_r, egui::Id::new(("req_accept", c.id.0)), Sense::click());
+ let accept = ui.interact(accept_r, egui::Id::new(("req_accept", c.id.0)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect_filled(accept_r, 8.0, if accept.hovered() { BRAND_HOVER } else { BRAND });
ui.painter().text(accept_r.center(), Align2::CENTER_CENTER, "Accept DM", strong(14.0), Color32::WHITE);
if decline.clicked() {
@@ -1190,7 +1197,7 @@ fn blocked_notice_ui(ui: &mut Ui, t: &Theme) -> Option<FriendAction> {
action = Some(FriendAction::Tab(FriendsTab::Blocked));
}
let x = Rect::from_center_size(pos2(rect.right() - 26.0, rect.center().y), vec2(24.0, 24.0));
- let xr = ui.interact(x, egui::Id::new("blocked_notice_close"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("blocked_notice_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(13.0), if xr.hovered() { t.header_primary } else { t.interactive_normal });
if xr.on_hover_text("Dismiss").clicked() {
action = Some(FriendAction::DismissNotice);
diff --git a/apps/rustcord/src/ui/guild_menu.rs b/apps/rustcord/src/ui/guild_menu.rs
index e2d06e7..a08f15d 100644
--- a/apps/rustcord/src/ui/guild_menu.rs
+++ b/apps/rustcord/src/ui/guild_menu.rs
@@ -552,7 +552,7 @@ impl RustCord {
}
}
});
- } else if ui.button("Select a channel or category…").clicked() {
+ } else if ui.button("Select a channel or category…").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
*override_pick = true;
}
if !overrides.is_empty() {
@@ -1057,6 +1057,7 @@ fn menu_width<A>(ctx: &egui::Context, rows: &[Row<A>]) -> f32 {
/// A two-line menu row: label with a muted line under it ("All Messages").
fn sub_row(ui: &mut Ui, t: &Theme, glyph: Option<&str>, label: &str, sub: &str, right: Option<&str>, enabled: bool) -> egui::Response {
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 44.0), if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if enabled && resp.hovered() {
ui.painter().rect_filled(r, 4.0, t.bg_hover);
}
@@ -1119,7 +1120,7 @@ fn dialog(ctx: &egui::Context, t: &Theme, title: &str, subtitle: Option<&str>, w
ui.add(egui::Label::new(RichText::new(s).size(14.0).color(t.text_muted)).wrap());
}
let x = Rect::from_center_size(pos2(top.x + width - 10.0, top.y + 12.0), vec2(24.0, 24.0));
- let xr = ui.interact(x, egui::Id::new("guild_dialog_x"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("guild_dialog_x"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, crate::style::icon_font(15.0), if xr.hovered() { t.header_primary } else { t.interactive_normal });
close |= xr.clicked();
ui.add_space(18.0);
@@ -1170,11 +1171,11 @@ fn check_box(ui: &mut Ui, t: &Theme, on: bool) -> bool {
}
fn primary(ui: &mut Ui, t: &Theme, text: &str) -> egui::Response {
- ui.add(egui::Button::new(bold(text).size(14.0).color(Color32::WHITE)).fill(t.accent).rounding(8.0).min_size(vec2(96.0, 38.0)))
+ ui.add(egui::Button::new(bold(text).size(14.0).color(Color32::WHITE)).fill(t.accent).rounding(8.0).min_size(vec2(96.0, 38.0))).on_hover_cursor(egui::CursorIcon::PointingHand)
}
fn secondary(ui: &mut Ui, t: &Theme, text: &str) -> egui::Response {
- ui.add(egui::Button::new(bold(text).size(14.0).color(t.header_primary)).fill(crate::style::overlay(0.12)).rounding(8.0).min_size(vec2(96.0, 38.0)))
+ ui.add(egui::Button::new(bold(text).size(14.0).color(t.header_primary)).fill(crate::style::overlay(0.12)).rounding(8.0).min_size(vec2(96.0, 38.0))).on_hover_cursor(egui::CursorIcon::PointingHand)
}
/// A dialog's button row, right-aligned (only as tall as its buttons).
diff --git a/apps/rustcord/src/ui/guild_pages.rs b/apps/rustcord/src/ui/guild_pages.rs
index 8d91bfd..8f0a57f 100644
--- a/apps/rustcord/src/ui/guild_pages.rs
+++ b/apps/rustcord/src/ui/guild_pages.rs
@@ -1224,6 +1224,7 @@ impl RustCord {
}
for row in &page_rows {
let (r, resp) = ui.allocate_exact_size(vec2(full, 56.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let rr = Rect::from_x_y_ranges(inner_l..=(inner_l + inner_w), r.y_range());
if !ui.is_rect_visible(r) {
continue;
@@ -1339,6 +1340,7 @@ impl RustCord {
let nav = |ui: &mut Ui, label: &str, glyph: &str, left_glyph: bool, enabled: bool| -> bool {
let g = ui.painter().layout_no_wrap(label.to_string(), strong(14.0), t.header_primary);
let (r, resp) = ui.allocate_exact_size(vec2(g.size().x + 30.0, 30.0), if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if !enabled { t.interactive_muted } else if resp.hovered() { t.header_primary } else { t.interactive_normal };
if enabled && resp.hovered() {
ui.painter().rect_filled(r, 6.0, t.bg_hover);
@@ -1537,7 +1539,7 @@ impl RustCord {
let (row, _) = ui.allocate_exact_size(vec2(full, 250.0), Sense::hover());
for (j, prod) in chunk.iter().enumerate() {
let r = Rect::from_min_size(pos2(left + j as f32 * (cw + gap), row.top()), vec2(cw, 250.0));
- let resp = ui.interact(r, egui::Id::new(("gp_product", row.top() as i64, j)), Sense::click());
+ let resp = ui.interact(r, egui::Id::new(("gp_product", row.top() as i64, j)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let p = ui.painter();
p.rect_filled(r, 12.0, if resp.hovered() { t.bg_secondary_alt } else { t.bg_secondary });
p.rect_stroke(r, 12.0, Stroke::new(1.0_f32, t.border_subtle));
diff --git a/apps/rustcord/src/ui/leaving.rs b/apps/rustcord/src/ui/leaving.rs
index f3644a0..6e93c9e 100644
--- a/apps/rustcord/src/ui/leaving.rs
+++ b/apps/rustcord/src/ui/leaving.rs
@@ -66,6 +66,7 @@ impl RustCord {
// A box with its label, the whole row clickable.
let label = ui.painter().layout_no_wrap(format!("Trust {} links from now on", l.host), FontId::proportional(14.0), t.text_normal);
let (row, resp) = ui.allocate_exact_size(vec2(24.0 + 8.0 + label.size().x, 24.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let b = egui::Rect::from_min_size(row.min + vec2(2.0, 2.0), vec2(20.0, 20.0));
if l.trust {
ui.painter().rect_filled(b, 4.0, Color32::from_rgb(0x58, 0x65, 0xf2));
diff --git a/apps/rustcord/src/ui/login.rs b/apps/rustcord/src/ui/login.rs
index 3e420cf..84bd929 100644
--- a/apps/rustcord/src/ui/login.rs
+++ b/apps/rustcord/src/ui/login.rs
@@ -21,7 +21,7 @@ impl RustCord {
ui.painter().rect_filled(bar, 0.0, if adding { t.accent } else { t.danger });
ui.painter().text(bar.center(), Align2::CENTER_CENTER, text, crate::style::medium(14.0), Color32::WHITE);
let close = Rect::from_center_size(egui::pos2(bar.right() - NOTICE / 2.0, bar.center().y), vec2(24.0, 24.0));
- let b = ui.interact(close, egui::Id::new("login_notice_close"), Sense::click());
+ let b = ui.interact(close, egui::Id::new("login_notice_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if b.hovered() { Color32::WHITE } else { crate::style::rgba(255, 255, 255, 200) };
let (m, h) = (ui.painter().round_pos_to_pixels(close.center()), 4.5);
ui.painter().line_segment([m + vec2(-h, -h), m + vec2(h, h)], Stroke::new(1.5_f32, c));
diff --git a/apps/rustcord/src/ui/members.rs b/apps/rustcord/src/ui/members.rs
index 10b426c..041e7fa 100644
--- a/apps/rustcord/src/ui/members.rs
+++ b/apps/rustcord/src/ui/members.rs
@@ -76,6 +76,7 @@ impl RustCord {
let styled = self.user_in(user, Some(gid));
let user: &discord::model::User = &styled;
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(44.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if !ui.is_rect_visible(rect) {
continue;
}
@@ -843,6 +844,7 @@ impl RustCord {
ui.label(RichText::new(format!("for \"{query}\"")).color(t.text_muted));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let (r, b) = ui.allocate_exact_size(vec2(24.0, 24.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(r.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(12.0), if b.hovered() { t.header_primary } else { t.interactive_normal });
close = b.on_hover_text("Close").clicked();
});
diff --git a/apps/rustcord/src/ui/mentions.rs b/apps/rustcord/src/ui/mentions.rs
index f851099..d1c8e0f 100644
--- a/apps/rustcord/src/ui/mentions.rs
+++ b/apps/rustcord/src/ui/mentions.rs
@@ -513,7 +513,7 @@ impl RustCord {
let e = &entries[i];
let row = Rect::from_min_size(pos2(rect.left() + 8.0, y), vec2(rect.width() - 16.0, h));
y += h;
- let resp = ui.interact(row, egui::Id::new(("mention_row", i)), Sense::click());
+ let resp = ui.interact(row, egui::Id::new(("mention_row", i)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() && ui.input(|inp| inp.pointer.delta() != egui::Vec2::ZERO) {
self.compose.mention_sel = i;
}
diff --git a/apps/rustcord/src/ui/mod.rs b/apps/rustcord/src/ui/mod.rs
index 5ff6891..ad25494 100644
--- a/apps/rustcord/src/ui/mod.rs
+++ b/apps/rustcord/src/ui/mod.rs
@@ -124,7 +124,7 @@ impl RustCord {
for (tip, cmd) in [("Close", 0), (if maximized { "Restore" } else { "Maximize" }, 1), ("Minimize", 2)].into_iter().take(own_buttons) {
let r = Rect::from_min_max(pos2(x - 46.0, bar.top()), pos2(x, bar.bottom()));
x -= 46.0;
- let b = ui.interact(r, egui::Id::new(("window_btn", cmd)), Sense::click());
+ let b = ui.interact(r, egui::Id::new(("window_btn", cmd)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if b.hovered() {
ui.painter().rect_filled(r, 0.0, if cmd == 0 { Color32::from_rgb(0xda, 0x37, 0x3c) } else { t.bg_hover });
}
@@ -147,7 +147,7 @@ impl RustCord {
for (glyph, tip, which) in [(icon::HELP, "Help", 0), (icon::INBOX, "Inbox", 1)] {
let r = Rect::from_center_size(pos2(x - 14.0, bar.center().y), vec2(28.0, 24.0));
x -= 32.0;
- let b = ui.interact(r, egui::Id::new(("title_tool", which)), Sense::click());
+ let b = ui.interact(r, egui::Id::new(("title_tool", which)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let active = which == 1 && self.inbox.is_some();
if b.hovered() || active {
ui.painter().rect_filled(r, 4.0, t.bg_hover);
@@ -169,7 +169,7 @@ impl RustCord {
if let Some(ready) = self.updater.as_ref().and_then(|u| u.title_bar_button()) {
let r = Rect::from_center_size(pos2(x - 14.0, bar.center().y), vec2(28.0, 24.0));
x -= 32.0;
- let b = ui.interact(r, egui::Id::new("title_update"), Sense::click());
+ let b = ui.interact(r, egui::Id::new("title_update"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if ready && b.hovered() {
ui.painter().rect_filled(r, 4.0, t.bg_hover);
}
@@ -193,7 +193,7 @@ impl RustCord {
] {
let r = Rect::from_min_size(pos2(left, bar.center().y - 12.0), vec2(28.0, 24.0));
left += 30.0;
- let b = ui.interact(r, egui::Id::new(("title_nav", fwd)), if enabled { Sense::click() } else { Sense::hover() });
+ let b = ui.interact(r, egui::Id::new(("title_nav", fwd)), if enabled { Sense::click() } else { Sense::hover() }).on_hover_cursor(if enabled { egui::CursorIcon::PointingHand } else { egui::CursorIcon::Default });
if enabled && b.hovered() {
ui.painter().rect_filled(r, 4.0, t.bg_hover);
}
@@ -1095,6 +1095,7 @@ pub fn media_image(ui: &mut Ui, url: String, size: egui::Vec2, rounding: f32, pl
return ui.add(egui::Image::new(url).fit_to_exact_size(size).rounding(rounding).sense(Sense::click()));
}
let (rect, resp) = ui.allocate_exact_size(size, Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
match placeholder.and_then(|p| thumb_texture(ui.ctx(), p)) {
Some(texture) => egui::Image::new((texture.id(), rect.size())).rounding(rounding).paint_at(ui, rect),
None => {
@@ -2067,7 +2068,7 @@ pub fn toggle_switch(ui: &mut Ui, on: &mut bool, t: &Theme) -> Response {
let x = egui::lerp((rect.left() + 12.0)..=(rect.right() - 12.0), how_on);
ui.painter().circle_filled(pos2(x, rect.center().y), 9.0, Color32::WHITE);
switch_mark(ui, pos2(x, rect.center().y), *on, bg);
- resp
+ resp.on_hover_cursor(egui::CursorIcon::PointingHand)
}
/// Accessibility → "Show on/off indicators": a tick or a cross in a switch's knob.
@@ -2198,6 +2199,7 @@ pub const MENU_DANGER: Color32 = Color32::from_rgb(251, 155, 152);
pub fn ctx_row(ui: &mut Ui, t: &Theme, left: Option<&str>, label: &str, right: Option<&str>, danger: bool, enabled: bool) -> Response {
let h = if left.is_some() || right.is_some() { 36.0 } else { 34.0 };
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), dense(h)), if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let hovered = enabled && resp.hovered();
if hovered {
ui.painter().rect_filled(r, 4.0, if danger { t.danger } else { t.bg_hover });
diff --git a/apps/rustcord/src/ui/popups.rs b/apps/rustcord/src/ui/popups.rs
index 312925f..ac5524a 100644
--- a/apps/rustcord/src/ui/popups.rs
+++ b/apps/rustcord/src/ui/popups.rs
@@ -259,6 +259,7 @@ impl RustCord {
ScrollArea::vertical().max_height(300.0).auto_shrink([false, true]).show(ui, |ui| {
for (id, label, sub, avatar, dm) in &dests {
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 44.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let selected = f.target == Some(*id);
if selected || resp.hovered() {
ui.painter().rect_filled(rect, 4.0, t.bg_hover);
@@ -313,7 +314,7 @@ impl RustCord {
Button::new(RichText::new("Send").color(Color32::WHITE)).fill(t.accent).min_size(vec2(90.0, 36.0)),
);
send |= send_btn.clicked();
- cancel |= ui.add(Button::new("Cancel").frame(false).min_size(vec2(70.0, 36.0))).clicked();
+ cancel |= ui.add(Button::new("Cancel").frame(false).min_size(vec2(70.0, 36.0))).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
});
// Clicking off the dialog closes it, unless a message is typed in.
diff --git a/apps/rustcord/src/ui/profile.rs b/apps/rustcord/src/ui/profile.rs
index 55cdc47..6274b23 100644
--- a/apps/rustcord/src/ui/profile.rs
+++ b/apps/rustcord/src/ui/profile.rs
@@ -250,6 +250,7 @@ fn role_chip(ui: &mut Ui, t: &crate::style::Theme, r: &discord::model::Role, rem
fn more_badges(ui: &mut Ui, t: &crate::style::Theme, hidden: usize) -> egui::Response {
let galley = ui.painter().layout_no_wrap(format!("+{hidden}"), FontId::proportional(14.0), t.header_primary);
let (r, resp) = ui.allocate_exact_size(vec2((galley.size().x + 4.0).max(20.0), 20.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().galley(r.center() - galley.size() / 2.0, galley, t.header_primary);
resp
}
@@ -406,7 +407,7 @@ fn connection_row(ui: &mut Ui, t: &crate::style::Theme, a: &discord::model::Conn
let id = egui::Id::new(("conn_name", &a.kind, &a.id));
match link {
Some(url) => {
- let resp = ui.interact(hit, id, Sense::click());
+ let resp = ui.interact(hit, id, Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let ext = Rect::from_min_size(pos2(x + name_w + 2.0, y + 1.0), vec2(16.0, 16.0));
egui::Image::new(brand::link_external()).tint(t.text_normal).paint_at(ui, ext);
if resp.hovered() {
@@ -762,6 +763,7 @@ impl RustCord {
// (16 px pictures overlapping by 3, then 4 px.)
let av_w = if n > 0 { 16.0 + (n - 1) as f32 * 13.0 + 4.0 } else { 0.0 };
let (r, resp) = ui.allocate_exact_size(vec2(av_w + galley.size().x, row_h), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
for (i, u) in avatars.iter().take(3).enumerate() {
let a = Rect::from_min_size(pos2(r.left() + i as f32 * 13.0, r.center().y - 8.0), vec2(16.0, 16.0));
if i > 0 {
@@ -995,6 +997,7 @@ impl RustCord {
fn game_collection(&self, ui: &mut Ui, t: &crate::style::Theme, games: &[Id], themed: bool, label_px: f32) -> bool {
const SLOTS: usize = 4;
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 40.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
// --background-surface-higher; on a profile theme, mod 16 %.
let fill = match (themed, resp.hovered()) {
(true, hovered) => overlay(if hovered { 0.24 } else { 0.16 }),
@@ -1344,7 +1347,7 @@ impl RustCord {
Some(Ok(v)) => v["note"].as_str().filter(|n| !n.is_empty()).map(str::to_string),
_ => None,
};
- let resp = ui.interact(note, egui::Id::new(("profile_add_note", user.id.0, kind as u8)), Sense::click());
+ let resp = ui.interact(note, egui::Id::new(("profile_add_note", user.id.0, kind as u8)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let (uri, svg) = if written.is_some() { ("bytes://paper.svg", PAPER_SVG) } else { ("bytes://paper-plus.svg", PAPER_PLUS_SVG) };
let tint = if resp.hovered() { t.header_primary } else { t.interactive_normal };
egui::Image::new(egui::ImageSource::Bytes { uri: uri.into(), bytes: egui::load::Bytes::Static(svg.as_bytes()) })
@@ -1440,6 +1443,7 @@ impl RustCord {
}
if pick_tag {
let (r, resp) = ui.allocate_exact_size(vec2(22.0, 20.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() || self.tag_picker.is_some() {
ui.painter().rect_filled(r, 4.0, overlay(0.16));
}
@@ -1881,6 +1885,7 @@ impl RustCord {
}
for r in options {
let (row, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 28.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(row, 4.0, overlay(0.16));
}
@@ -2620,6 +2625,7 @@ impl RustCord {
// One menu row: icon (or status dot), label, optional chevron.
let row = |ui: &mut Ui, glyph: Option<&str>, dot: Option<&str>, label: &str, chevron: bool, color: Color32| -> egui::Response {
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 32.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(r, 8.0, overlay(0.16));
}
@@ -2828,6 +2834,7 @@ impl RustCord {
] {
let h = if hint.is_empty() { 36.0 } else { 52.0 };
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), h), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(r, 6.0, overlay(0.16));
}
@@ -2967,6 +2974,7 @@ impl RustCord {
field.request_focus();
save |= field.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter));
let (x, b) = ui.allocate_exact_size(vec2(20.0, 20.0), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(10.0), if b.hovered() { t.header_primary } else { t.interactive_normal });
clear |= b.on_hover_text("Clear status").clicked();
});
@@ -2974,8 +2982,8 @@ impl RustCord {
ui.add_space(18.0);
ui.horizontal(|ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- save |= ui.add(Button::new(bold("Save").size(14.0).color(Color32::WHITE)).fill(t.accent).rounding(8.0).min_size(vec2(96.0, 36.0))).clicked();
- cancel |= ui.add(Button::new(RichText::new("Cancel").size(14.0).color(t.header_primary)).frame(false)).clicked();
+ save |= ui.add(Button::new(bold("Save").size(14.0).color(Color32::WHITE)).fill(t.accent).rounding(8.0).min_size(vec2(96.0, 36.0))).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
+ cancel |= ui.add(Button::new(RichText::new("Cancel").size(14.0).color(t.header_primary)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
});
});
@@ -3111,7 +3119,7 @@ impl RustCord {
}
}
let x = Rect::from_min_size(pos2(modal.right() - 40.0, modal.top() + 8.0 + bar), vec2(32.0, 32.0));
- let xr = ui.interact(x, egui::Id::new("full_profile_close"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("full_profile_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().rect(x, 8.0, if xr.hovered() { overlay(0.2) } else { overlay(0.12) }, Stroke::new(1.0_f32, crate::style::rgba(151, 151, 159, 10)));
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(14.0), t.header_primary);
close |= xr.clicked();
@@ -3594,7 +3602,7 @@ impl RustCord {
}
// Close, over the banner.
let x = Rect::from_center_size(pos2(banner.right() - 24.0, banner.top() + 24.0), vec2(30.0, 30.0));
- let xr = ui.interact(x, egui::Id::new("bot_profile_close"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("bot_profile_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().circle_filled(x.center(), 15.0, Color32::from_black_alpha(if xr.hovered() { 190 } else { 140 }));
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(12.0), Color32::WHITE);
close |= xr.clicked();
@@ -3799,6 +3807,7 @@ impl RustCord {
ScrollArea::vertical().max_height(320.0).show(ui, |ui| {
let row = |ui: &mut Ui, selected: bool| -> (Rect, egui::Response) {
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 38.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() || selected {
ui.painter().rect_filled(r, 6.0, overlay(if selected { 0.12 } else { 0.16 }));
}
@@ -3915,6 +3924,7 @@ impl RustCord {
ScrollArea::vertical().max_height(360.0).show(ui, |ui| {
for (i, (label, sub, avatar, _)) in items.iter().enumerate() {
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 36.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() || (i == 0 && !q.is_empty()) {
ui.painter().rect_filled(rect, 4.0, t.bg_hover);
}
diff --git a/apps/rustcord/src/ui/request_log.rs b/apps/rustcord/src/ui/request_log.rs
index ed481b9..d624dc7 100644
--- a/apps/rustcord/src/ui/request_log.rs
+++ b/apps/rustcord/src/ui/request_log.rs
@@ -179,7 +179,7 @@ impl RustCord {
ui.checkbox(&mut st.api, "API");
ui.checkbox(&mut st.media, "Pictures & media");
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- clear = ui.button("Clear").clicked();
+ clear = ui.button("Clear").on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
let paused = st.paused.is_some();
if ui.selectable_label(paused, if paused { "Paused" } else { "Pause" }).clicked() {
st.paused = if paused { None } else { Some(reqlog::latest()) };
@@ -238,6 +238,7 @@ impl RustCord {
ScrollArea::vertical().auto_shrink([false, false]).show_rows(ui, ROW, rows.len(), |ui, range| {
for e in &rows[range] {
let (r, resp) = ui.allocate_exact_size(vec2(width, ROW), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(r, 4.0, overlay(0.06));
}
diff --git a/apps/rustcord/src/ui/server.rs b/apps/rustcord/src/ui/server.rs
index 7a94136..2afb596 100644
--- a/apps/rustcord/src/ui/server.rs
+++ b/apps/rustcord/src/ui/server.rs
@@ -264,18 +264,18 @@ impl RustCord {
ui.horizontal(|ui| {
if *confirm_delete {
ui.label(RichText::new("Delete this channel for good?").color(t.danger));
- if ui.add(Button::new(bold("Delete").color(Color32::WHITE)).fill(t.danger)).clicked() {
+ if ui.add(Button::new(bold("Delete").color(Color32::WHITE)).fill(t.danger)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.backend.send(Command::DeleteChannel(channel));
done = true;
}
- if ui.button("Keep it").clicked() {
+ if ui.button("Keep it").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
*confirm_delete = false;
}
- } else if ui.add(Button::new(RichText::new("Delete Channel").color(t.danger)).frame(false)).clicked() {
+ } else if ui.add(Button::new(RichText::new("Delete Channel").color(t.danger)).frame(false)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
*confirm_delete = true;
}
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- if ui.add(Button::new(bold("Save Changes").color(Color32::WHITE)).fill(t.accent).rounding(6.0)).clicked() {
+ if ui.add(Button::new(bold("Save Changes").color(Color32::WHITE)).fill(t.accent).rounding(6.0)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
let mut patch = json!({ "name": name.trim() });
if is_text {
patch["topic"] = json!(topic.trim());
@@ -285,7 +285,7 @@ impl RustCord {
self.backend.send(Command::EditChannel { channel, patch });
done = true;
}
- if ui.button("Cancel").clicked() {
+ if ui.button("Cancel").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
done = true;
}
});
@@ -357,7 +357,7 @@ impl RustCord {
}
ui.add_space(16.0);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- if ui.add(Button::new(bold("Save").color(Color32::WHITE)).fill(t.accent).rounding(6.0)).clicked() {
+ if ui.add(Button::new(bold("Save").color(Color32::WHITE)).fill(t.accent).rounding(6.0)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
let mut body = json!({});
if can_nick {
// An empty nickname clears it.
@@ -383,7 +383,7 @@ impl RustCord {
}
done = true;
}
- if ui.button("Cancel").clicked() {
+ if ui.button("Cancel").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
done = true;
}
});
@@ -397,11 +397,11 @@ impl RustCord {
ui.label(RichText::new("You won't be able to rejoin this server unless you are re-invited.").color(t.text_normal));
ui.add_space(16.0);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- if ui.add(Button::new(bold("Leave Server").color(Color32::WHITE)).fill(t.danger).rounding(6.0)).clicked() {
+ if ui.add(Button::new(bold("Leave Server").color(Color32::WHITE)).fill(t.danger).rounding(6.0)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.backend.send(Command::LeaveGuild(guild));
done = true;
}
- if ui.button("Cancel").clicked() {
+ if ui.button("Cancel").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
done = true;
}
});
@@ -416,11 +416,11 @@ impl RustCord {
ui.label(RichText::new(format!("Are you sure you want to delete {what}? This cannot be undone.")).color(t.text_normal));
ui.add_space(16.0);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- if ui.add(Button::new(bold(title).color(Color32::WHITE)).fill(t.danger).rounding(6.0)).clicked() {
+ if ui.add(Button::new(bold(title).color(Color32::WHITE)).fill(t.danger).rounding(6.0)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.backend.send(Command::DeleteChannel(channel));
done = true;
}
- if ui.button("Cancel").clicked() {
+ if ui.button("Cancel").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
done = true;
}
});
@@ -471,7 +471,7 @@ fn create_channel_dialog(
ui.label(RichText::new(format!("in {p}")).size(14.0).color(t.text_muted));
}
let x = Rect::from_center_size(pos2(top.x + 412.0 - 10.0, top.y + 12.0), vec2(24.0, 24.0));
- let xr = ui.interact(x, egui::Id::new("create_channel_close"), Sense::click());
+ let xr = ui.interact(x, egui::Id::new("create_channel_close"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(x.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(15.0), if xr.hovered() { t.header_primary } else { t.interactive_normal });
close |= xr.clicked();
ui.add_space(24.0);
diff --git a/apps/rustcord/src/ui/server_settings.rs b/apps/rustcord/src/ui/server_settings.rs
index 8248f97..9f6fa3e 100644
--- a/apps/rustcord/src/ui/server_settings.rs
+++ b/apps/rustcord/src/ui/server_settings.rs
@@ -2436,7 +2436,7 @@ impl RustCord {
}
let x = Rect::from_center_size(pos2(row.right() - 18.0, row.center().y), vec2(24.0, 24.0));
- let xr = ui.interact(x, egui::Id::new(("ss_emoji_delete", id.0)), if can { Sense::click() } else { Sense::hover() });
+ let xr = ui.interact(x, egui::Id::new(("ss_emoji_delete", id.0)), if can { Sense::click() } else { Sense::hover() }).on_hover_cursor(if can { egui::CursorIcon::PointingHand } else { egui::CursorIcon::Default });
let deleting = st.busy(|p| matches!(p, Pending::DeleteEmoji(d) if *d == id));
if deleting {
ui.put(x, egui::Spinner::new().size(14.0));
@@ -2509,7 +2509,7 @@ impl RustCord {
painter.text(pos2(row.left() + cols[3], row.center().y), Align2::LEFT_CENTER, expires_in(vstr(inv, "expires_at")), FontId::monospace(14.0), t.text_normal);
let x = Rect::from_center_size(pos2(row.right() - 18.0, row.center().y), vec2(24.0, 24.0));
- let xr = ui.interact(x, egui::Id::new(("ss_revoke", code)), Sense::click());
+ let xr = ui.interact(x, egui::Id::new(("ss_revoke", code)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let revoking = st.busy(|p| matches!(p, Pending::RevokeInvite { code: c, .. } if c == code));
if revoking {
ui.put(x, egui::Spinner::new().size(14.0));
@@ -3131,6 +3131,7 @@ fn btn(ui: &mut Ui, t: &Theme, kind: Btn, text: &str, enabled: bool) -> Response
let galley = ui.painter().layout_no_wrap(text.to_string(), bold_font(14.0), fg);
let size = vec2((galley.size().x + 32.0).max(64.0), 36.0);
let (rect, resp) = ui.allocate_exact_size(size, if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if ui.is_rect_visible(rect) {
let hot = enabled && resp.hovered();
let fill = match kind {
@@ -3191,6 +3192,7 @@ fn back_link(ui: &mut Ui, t: &Theme) -> Response {
fn icon_button(ui: &mut Ui, t: &Theme, glyph: &str, enabled: bool) -> Response {
let (r, resp) = ui.allocate_exact_size(vec2(24.0, 24.0), if enabled { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let hot = enabled && resp.hovered();
if hot {
ui.painter().rect_filled(r, 6.0, overlay(0.16));
@@ -3277,6 +3279,7 @@ fn add_overwrite_popover(
ui.add_space(6.0);
let row = |ui: &mut Ui, tag: &str| -> (Rect, Response) {
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 34.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(r, 4.0, overlay(0.08));
}
@@ -3554,7 +3557,7 @@ fn tri(ui: &mut Ui, t: &Theme, id: egui::Id, state: i8) -> Option<i8> {
let mut out = None;
for (i, s) in [-1i8, 0, 1].into_iter().enumerate() {
let r = Rect::from_min_size(rect.min + vec2(cell.x * i as f32, 0.0), cell);
- let resp = ui.interact(r, id.with(i), Sense::click());
+ let resp = ui.interact(r, id.with(i), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let active = state == s;
let fill = match (s, active) {
(-1, true) => t.danger,
diff --git a/apps/rustcord/src/ui/settings.rs b/apps/rustcord/src/ui/settings.rs
index 93eb8a7..038c9c3 100644
--- a/apps/rustcord/src/ui/settings.rs
+++ b/apps/rustcord/src/ui/settings.rs
@@ -137,6 +137,7 @@ fn strong(size: f32) -> FontId {
/// when picked, the name as a tooltip.
fn color_swatch(ui: &mut Ui, t: &Theme, g: Option<&crate::style::Gradient>, plain: Color32, selected: bool, name: &str) -> egui::Response {
let (rect, resp) = ui.allocate_exact_size(vec2(48.0, 48.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let c = rect.center();
let r = 22.0;
match g {
@@ -1040,7 +1041,7 @@ impl RustCord {
Some(Ok(_)) => true,
Some(Err(e)) => {
ui.label(RichText::new(format!("Couldn't load your settings: {e}")).color(t.danger));
- if ui.button("Try again").clicked() {
+ if ui.button("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.api("us:settings", reqwest::Method::GET, "/users/@me/settings", None);
}
false
@@ -1529,7 +1530,7 @@ impl RustCord {
ui.add_space(10.0);
ui.horizontal(|ui| {
ui.add_enabled_ui(!busy, |ui| {
- if ui.add(Button::new(RichText::new("Log Out").size(14.0).color(Color32::WHITE)).fill(t.danger).rounding(8.0).min_size(vec2(0.0, 36.0))).clicked() {
+ if ui.add(Button::new(RichText::new("Log Out").size(14.0).color(Color32::WHITE)).fill(t.danger).rounding(8.0).min_size(vec2(0.0, 36.0))).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
send = Some((4, reqwest::Method::POST, "/auth/sessions/logout", Some(json!({ "session_id_hashes": [e.device] }))));
}
});
@@ -1959,7 +1960,7 @@ impl RustCord {
Some(Ok(_)) => Some(Vec::new()),
Some(Err(e)) => {
ui.label(RichText::new(format!("Couldn't load this: {e}")).color(t.danger));
- if ui.button("Try again").clicked() {
+ if ui.button("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.api(tag, reqwest::Method::GET, path.to_string(), None);
}
None
@@ -3023,8 +3024,8 @@ impl RustCord {
let w = (ui.available_width() - 140.0).max(120.0);
let r = ui.add(TextEdit::singleline(&mut self.theme_input).hint_text("https://…/theme.css or C:\\path\\to\\theme.css").desired_width(w));
load |= r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));
- load |= ui.add(Button::new(RichText::new("Load").color(Color32::WHITE)).fill(t.accent)).clicked();
- reset = ui.button("Reset").clicked();
+ load |= ui.add(Button::new(RichText::new("Load").color(Color32::WHITE)).fill(t.accent)).on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
+ reset = ui.button("Reset").on_hover_cursor(egui::CursorIcon::PointingHand).clicked();
});
if load {
let src = self.theme_input.clone();
@@ -3069,7 +3070,7 @@ impl RustCord {
subheading(ui, t, "QuickCSS");
ui.label(RichText::new("Variables set here override the theme, e.g. :root { --brand-experiment: #e8590c; }").color(t.text_muted));
ui.add(TextEdit::multiline(&mut self.quick_css_input).code_editor().desired_rows(8).desired_width(f32::INFINITY));
- if ui.button("Apply QuickCSS").clicked() {
+ if ui.button("Apply QuickCSS").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
self.save_quick_css();
}
}
diff --git a/apps/rustcord/src/ui/sidebar.rs b/apps/rustcord/src/ui/sidebar.rs
index 9b47285..c90e475 100644
--- a/apps/rustcord/src/ui/sidebar.rs
+++ b/apps/rustcord/src/ui/sidebar.rs
@@ -198,6 +198,7 @@ fn rail_row_shown(ui: &Ui, rect: Rect) -> bool {
/// flush with the row's top, 8 px to the next one.
fn server_icon(ui: &mut Ui, t: &Theme, a: IconArgs) -> Response {
let (rect, resp) = ui.allocate_exact_size(vec2(72.0, 48.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if !rail_row_shown(ui, rect) {
return resp;
}
@@ -255,6 +256,7 @@ fn server_icon(ui: &mut Ui, t: &Theme, a: IconArgs) -> Response {
/// icon.
fn rail_button(ui: &mut Ui, t: &Theme, svg: &'static [u8], key: &str) -> Response {
let (rect, resp) = ui.allocate_exact_size(vec2(72.0, 48.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let tile = Rect::from_min_size(pos2(rect.center().x - 20.0, rect.top()), vec2(40.0, 40.0));
let fill = if resp.hovered() { Color32::from_rgb(0x58, 0x65, 0xf2) } else { crate::style::rgba(151, 151, 159, 31) };
super::fill_squircle(ui.painter(), tile, fill);
@@ -329,7 +331,7 @@ fn channel_row_ex(ui: &mut Ui, t: &Theme, selected: bool, unread: bool, muted: b
}
let b = Rect::from_center_size(pos2(x, inner.center().y), vec2(18.0, 18.0));
x -= 20.0;
- let br = ui.interact(b, ui.id().with(("chan_btn", r.min.y as i64, which)), Sense::click());
+ let br = ui.interact(b, ui.id().with(("chan_btn", r.min.y as i64, which)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if br.hovered() || selected { t.header_primary } else { t.interactive_normal };
ui.painter().text(b.center(), Align2::CENTER_CENTER, glyph, icon_font(16.0), c);
if br.on_hover_text(tip).clicked() {
@@ -349,6 +351,7 @@ fn channel_row_ex(ui: &mut Ui, t: &Theme, selected: bool, unread: bool, muted: b
/// badge, and the name is cut with "…" before either, like Discord's.
fn channel_row(ui: &mut Ui, t: &Theme, selected: bool, unread: bool, muted: bool, mentions: u32, icon_text: &str, name: &str, buttons: u8) -> Response {
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(34.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let inner = Rect::from_min_max(pos2(rect.left() + 8.0, rect.top() + 1.0), pos2(rect.right() - 8.0, rect.bottom() - 1.0));
let hovered = resp.hovered();
let bg = if selected {
@@ -409,6 +412,7 @@ fn channel_row(ui: &mut Ui, t: &Theme, selected: bool, unread: bool, muted: bool
/// into the row, the name in the channel font. `last`: the spine ends here.
fn thread_row(ui: &mut Ui, t: &Theme, selected: bool, unread: bool, muted: bool, mentions: u32, name: &str, last: bool) -> Response {
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(34.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let inner = Rect::from_min_max(pos2(rect.left() + 36.0, rect.top() + 1.0), pos2(rect.right() - 8.0, rect.bottom() - 1.0));
let hovered = resp.hovered();
if selected || hovered {
@@ -949,6 +953,7 @@ impl RustCord {
if home {
// Discord's grey button, label centred in 14 px medium.
let (r, b) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(32.0)), Sense::click());
+ let b = b.on_hover_cursor(egui::CursorIcon::PointingHand);
let fill = crate::style::rgba(148, 148, 156, if b.hovered() { 51 } else { 31 });
ui.painter().rect(r, 8.0, fill, Stroke::new(1.0_f32, crate::style::rgba(153, 153, 153, 10)));
ui.painter().text(r.center(), Align2::CENTER_CENTER, "Find or start a conversation", crate::style::medium(14.0), t.header_primary);
@@ -1122,6 +1127,7 @@ impl RustCord {
ui.add_space(14.0);
let collapsed = self.collapsed.contains(&cat.id) || cat.collapsed && !self.collapsed.contains(&Id(!cat.id.0));
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 22.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let c = if resp.hovered() { t.interactive_hover } else { t.text_muted };
let painter = ui.painter_at(r);
let font = FontId::new(14.0, egui::FontFamily::Name(crate::style::BOLD.into()));
@@ -1347,6 +1353,7 @@ impl RustCord {
ui.add_space(16.0);
let collapsed = self.collapsed.contains(id);
let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 24.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let resp = if can_manage { resp.interact(Sense::drag()) } else { resp };
if can_manage {
targets.push((r, *id, true));
@@ -1366,7 +1373,7 @@ impl RustCord {
let mut plus_clicked = false;
if can_manage {
let p = Rect::from_center_size(pos2(r.right() - 25.0, r.center().y), vec2(18.0, 18.0));
- let pr = ui.interact(p, ui.id().with(("cat_plus", id.0)), Sense::click());
+ let pr = ui.interact(p, ui.id().with(("cat_plus", id.0)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(p.center(), Align2::CENTER_CENTER, icon::ADD, icon_font(12.0), if pr.hovered() { t.header_primary } else { t.channel_default });
if pr.on_hover_text("Create Channel").clicked() {
create_in = Some(*id);
@@ -1438,6 +1445,7 @@ impl RustCord {
let nick = self.store.members.get(&(gid, uid)).and_then(|m| m.nick.clone());
let uname = nick.or_else(|| user.as_ref().map(|u| u.display_name().to_string())).unwrap_or_else(|| "Loading…".into());
let (r, vresp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(32.0)), Sense::click());
+ let vresp = vresp.on_hover_cursor(egui::CursorIcon::PointingHand);
let row = Rect::from_min_max(pos2(r.left() + 36.0, r.top() + 1.0), pos2(r.right() - 8.0, r.bottom() - 1.0));
if vresp.hovered() {
ui.painter().rect_filled(row, 4.0, t.bg_hover);
@@ -1549,6 +1557,7 @@ impl RustCord {
ui.spacing_mut().item_spacing.y = 0.0;
// Friends row: 20 px icon 8 px in, 16 px medium label at 40 px, 8 px corners.
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(40.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let inner = rect.shrink2(vec2(8.0, 1.0));
let sel = self.friends_open && !self.requests_open && self.store_page.is_none();
if sel || resp.hovered() {
@@ -1575,6 +1584,7 @@ impl RustCord {
(icon::QUESTS, "Quests", Some(StorePage::Quests), 0),
] {
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(40.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let inner = rect.shrink2(vec2(8.0, 1.0));
let selected = self.friends_open
&& match page {
@@ -1642,6 +1652,7 @@ impl RustCord {
let tag = recipient.and_then(|u| u.server_tag());
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), super::dense(44.0)), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
let inner = Rect::from_min_max(pos2(rect.left() + 8.0, rect.top() + 1.0), pos2(rect.right() - 8.0, rect.bottom() - 1.0));
let bg = if selected {
t.bg_selected
@@ -1935,7 +1946,7 @@ impl RustCord {
// buttons are 32 + 1 + 16, 8, 32 + 1 + 16, 8, 32 wide.
let buttons_left = row.right() - 13.0 - 146.0;
let area = Rect::from_min_max(pos2(row.left() + 8.0, cy - 23.5), pos2(buttons_left - 8.0, cy + 23.5));
- let resp = ui.interact(area, ui.id().with("panel_account"), Sense::click());
+ let resp = ui.interact(area, ui.id().with("panel_account"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
let palette = me.as_ref().and_then(|m| m.nameplate_color()).map(|c| Color32::from_rgb((c >> 16) as u8, (c >> 8) as u8, c as u8));
let plated = me.as_ref().is_some_and(|m| m.nameplate_url().is_some());
if let Some(me) = &me {
diff --git a/apps/rustcord/src/ui/soundboard.rs b/apps/rustcord/src/ui/soundboard.rs
index e7c7422..cb29a3f 100644
--- a/apps/rustcord/src/ui/soundboard.rs
+++ b/apps/rustcord/src/ui/soundboard.rs
@@ -339,7 +339,7 @@ impl RustCord {
let mut previewed = false;
if preview_w > 0.0 {
let pr = Rect::from_center_size(pos2(r.right() - 16.0, r.center().y), vec2(22.0, 22.0));
- let p = ui.interact(pr, egui::Id::new(("sound_preview", s.id.0, title)), Sense::click());
+ let p = ui.interact(pr, egui::Id::new(("sound_preview", s.id.0, title)), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
ui.painter().text(pr.center(), Align2::CENTER_CENTER, icon::AUDIO, icon_font(13.0), if p.hovered() { t.header_primary } else { t.interactive_normal });
if p.on_hover_text("Preview").clicked() {
preview = Some((*s).clone());
diff --git a/apps/rustcord/src/ui/ss_expression.rs b/apps/rustcord/src/ui/ss_expression.rs
index 6e281c9..b88d0fd 100644
--- a/apps/rustcord/src/ui/ss_expression.rs
+++ b/apps/rustcord/src/ui/ss_expression.rs
@@ -334,7 +334,7 @@ fn delete_button(ui: &mut Ui, t: &Theme, r: Rect, id: egui::Id, show: bool, dele
ui.put(r, egui::Spinner::new().size(14.0));
return false;
}
- let xr = ui.interact(r, id, Sense::click());
+ let xr = ui.interact(r, id, Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if show || xr.hovered() {
ui.painter().circle_filled(r.center(), 12.0, if xr.hovered() { t.danger } else { overlay(0.12) });
ui.painter().text(r.center(), Align2::CENTER_CENTER, icon::CLOSE, icon_font(10.0), if xr.hovered() { Color32::WHITE } else { t.danger });
@@ -533,6 +533,7 @@ impl RustCord {
fn sticker_tile(&self, ui: &mut Ui, t: &Theme, s: &mut StickersUi, v: &Value, can: bool) {
let Some(id) = super::vid(v, "id") else { return };
let (r, resp) = ui.allocate_exact_size(TILE, if can { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if !ui.is_rect_visible(r) {
return;
}
diff --git a/apps/rustcord/src/ui/ss_members.rs b/apps/rustcord/src/ui/ss_members.rs
index fd484a7..c8ec71b 100644
--- a/apps/rustcord/src/ui/ss_members.rs
+++ b/apps/rustcord/src/ui/ss_members.rs
@@ -172,6 +172,7 @@ impl RustCord {
let mut menu: Option<(User, Pos2)> = None;
for e in list {
let (row, resp) = ui.allocate_exact_size(vec2(w, 60.0), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
// Parsed only when on screen: the list can be a thousand long.
if !ui.is_rect_visible(row) {
continue;
diff --git a/apps/rustcord/src/ui/ss_safety.rs b/apps/rustcord/src/ui/ss_safety.rs
index 56ced21..18c8c94 100644
--- a/apps/rustcord/src/ui/ss_safety.rs
+++ b/apps/rustcord/src/ui/ss_safety.rs
@@ -641,6 +641,7 @@ impl RustCord {
let details = e["changes"].as_array().is_some_and(|c| !c.is_empty()) || !vstr(e, "reason").is_empty();
let w = ui.available_width();
let (row, resp) = ui.allocate_exact_size(vec2(w, 60.0), if details { Sense::click() } else { Sense::hover() });
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if ui.is_rect_visible(row) {
let rounding = if open { Rounding { nw: 8.0, ne: 8.0, sw: 0.0, se: 0.0 } } else { Rounding::same(8.0) };
ui.painter().rect_filled(row, rounding, if details && resp.hovered() { t.bg_hover } else { t.bg_secondary });
diff --git a/apps/rustcord/src/ui/store.rs b/apps/rustcord/src/ui/store.rs
index 70d2b06..765b10d 100644
--- a/apps/rustcord/src/ui/store.rs
+++ b/apps/rustcord/src/ui/store.rs
@@ -224,7 +224,7 @@ impl RustCord {
let heading = if plain { title.to_uppercase() } else { format!("{} QUEST", title.to_uppercase()) };
ui.label(RichText::new(heading).font(strong(13.0)).color(BRAND_TEXT));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- if ui.add(egui::Button::new(RichText::new(icon::CLOSE).font(icon_font(12.0)).color(t.header_primary)).fill(overlay(0.12)).rounding(8.0)).on_hover_text(if plain { "Close" } else { "Close (progress so far is kept)" }).clicked() {
+ if ui.add(egui::Button::new(RichText::new(icon::CLOSE).font(icon_font(12.0)).color(t.header_primary)).fill(overlay(0.12)).rounding(8.0)).on_hover_text(if plain { "Close" } else { "Close (progress so far is kept)" }).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
close = true;
}
});
@@ -328,7 +328,7 @@ impl RustCord {
CentralPanel::default().frame(Frame::none().fill(t.bg_primary).inner_margin(Margin::symmetric(24.0, 0.0))).show_inside(ui, |ui| {
if loading_or_error(ui, &t, &self.quests, "Quests") {
- if matches!(self.quests, Some(Err(_))) && ui.button("Try again").clicked() {
+ if matches!(self.quests, Some(Err(_))) && ui.button("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
action = Some(StoreAction::Retry(StorePage::Quests));
}
return;
@@ -399,7 +399,7 @@ impl RustCord {
let nitro = self.has_nitro();
CentralPanel::default().frame(Frame::none().fill(t.bg_primary).inner_margin(Margin::symmetric(24.0, 0.0))).show_inside(ui, |ui| {
if loading_or_error(ui, &t, &self.shop, "the Shop") {
- if matches!(self.shop, Some(Err(_))) && ui.button("Try again").clicked() {
+ if matches!(self.shop, Some(Err(_))) && ui.button("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
action = Some(StoreAction::Retry(StorePage::Shop));
}
return;
@@ -412,6 +412,7 @@ impl RustCord {
let w = ui.available_width();
let banner_h = (w * 0.27).clamp(150.0, 300.0);
let (rect, resp) = ui.allocate_exact_size(vec2(w, banner_h), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if ui.is_rect_visible(rect) {
ui.painter().rect_filled(rect, 12.0, t.bg_secondary);
if let Some(url) = cat.hero_banner_url.as_deref().or(cat.catalog_banner_url.as_deref()) {
@@ -515,7 +516,7 @@ impl RustCord {
}
Some(Err(e)) => {
ui.label(RichText::new(format!("Couldn't load your subscription: {e}")).size(14.0).color(t.text_muted));
- if ui.button("Try again").clicked() {
+ if ui.button("Try again").on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
action = Some(StoreAction::Retry(StorePage::Nitro));
}
}
@@ -813,6 +814,7 @@ fn quest_text(q: &Quest, reward: &str) -> String {
fn product_card(ui: &mut Ui, t: &Theme, p: &ShopProduct, w: f32, me: &discord::model::User, nitro: bool) -> Option<StoreAction> {
let h = w + 92.0;
let (rect, resp) = ui.allocate_exact_size(vec2(w, h), Sense::click());
+ let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand);
if !ui.is_rect_visible(rect) {
return None;
}
diff --git a/apps/rustcord/src/voice_call.rs b/apps/rustcord/src/voice_call.rs
index 307e699..3e69a8f 100644
--- a/apps/rustcord/src/voice_call.rs
+++ b/apps/rustcord/src/voice_call.rs
@@ -1097,7 +1097,7 @@ impl RustCord {
let bold = FontId::new(14.0, egui::FontFamily::Name(crate::style::BOLD.into()));
let label_w = ui.painter().layout_no_wrap(label.into(), bold.clone(), color).size().x;
let status = Rect::from_min_size(pos2(rect.left(), rect.top() + 1.0), vec2(label_w + 30.0, 22.0));
- let sresp = ui.interact(status, egui::Id::new("voice_status"), Sense::click());
+ let sresp = ui.interact(status, egui::Id::new("voice_status"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if sresp.hovered() || stats_open {
ui.painter().rect_filled(status, 4.0, t.bg_hover);
}
@@ -1122,7 +1122,7 @@ impl RustCord {
// Voice isolation, then hang up.
let iso_on = self.voice_ui.prefs.voice_isolation;
let iso = Rect::from_center_size(pos2(rect.right() - 52.0, rect.center().y), vec2(32.0, 32.0));
- let iresp = ui.interact(iso, egui::Id::new("voice_isolation_toggle"), Sense::click());
+ let iresp = ui.interact(iso, egui::Id::new("voice_isolation_toggle"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if iresp.hovered() {
ui.painter().rect_filled(iso, 6.0, t.bg_hover);
}
@@ -1136,7 +1136,7 @@ impl RustCord {
self.voice_ui.set_voice_isolation(!iso_on);
}
let hang = Rect::from_center_size(pos2(rect.right() - 18.0, rect.center().y), vec2(32.0, 32.0));
- let resp = ui.interact(hang, egui::Id::new("voice_hangup"), Sense::click());
+ let resp = ui.interact(hang, egui::Id::new("voice_hangup"), Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand);
if resp.hovered() {
ui.painter().rect_filled(hang, 6.0, t.bg_hover);
}