RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Restore sidebar row hover feedback
Melb8a96b1626f4
diff --git a/src/files/app_hover.zig b/src/files/app_hover.zigindex 0e42117..3bc7a8c 100644--- a/src/files/app_hover.zig+++ b/src/files/app_hover.zig@@ -16,6 +16,16 @@ const pin_base = App.pin_base;pub fn hoverBounds(self: *App, key: usize) ?header.Rect {if (key >= 920 and key < 926) return @import("app_audio_bar.zig").rect(self);+ if (key >= 940 and key < 944) {+ const card = self.sidebarLayout().cards[key - 940];+ if (!card.visible) return null;+ return .{+ .x = 8,+ .y = @floatFromInt(card.y),+ .w = @floatFromInt(@max(0, self.sidebarWidth() - self.scrollbarGutter() - 16)),+ .h = @floatFromInt(card.header_height),+ };+ }if (key >= std.math.maxInt(usize) - 4096) return null;if (key >= 900 and key < 904) return .{ .x = 0, .y = 0, .w = @floatFromInt(self.w), .h = @floatFromInt(self.h) };if (key == 0) return .{ .x = 0, .y = 0, .w = 0, .h = 0 };diff --git a/src/files/app_pointer.zig b/src/files/app_pointer.zigindex 90e30d2..49b0e59 100644--- a/src/files/app_pointer.zig+++ b/src/files/app_pointer.zig@@ -36,6 +36,7 @@ pub fn hoverKey(self: *App) usize {(x >= @as(f64, @floatFromInt(self.sidebarWidth())) and y < @as(f64, @floatFromInt(self.contentBottom()))))) return self.transferPaneHover();if (self.terminalHit(x, y)) |index| return 900 + index;if (self.sidebar_resize != null or self.overSidebarDivider(x, y)) return 0;+ if (self.sidebarHeaderAt(x, y)) |section| return 940 + @as(usize, @intFromEnum(section));if (self.chooser) |opts| {if (y >= @as(f64, @floatFromInt(self.h - self.footerHeight()))) {for (0..4 + opts.choices.len) |i| {diff --git a/src/files/app_sidebar_paint.zig b/src/files/app_sidebar_paint.zigindex ae400e5..3533b10 100644--- a/src/files/app_sidebar_paint.zig+++ b/src/files/app_sidebar_paint.zig@@ -41,7 +41,16 @@ fn drawSidebarHeader(y: i32,content_width: f64,expanded: bool,+ hovered: bool,) void {+ if (hovered) {+ shell_ui.drawSidebarHover(cr, .{+ .x = 12,+ .y = @floatFromInt(y + 2),+ .w = @floatCast(@max(0, content_width - 24)),+ .h = 28,+ }, 0.8);+ }setSource(cr, ui_theme.global.sidebarForeground());drawText(cr, label, 24, @as(f64, @floatFromInt(y)) + 21, shell_ui.headingSize(), true);if (shell_ui.Layer.begin(cr, .{@@ -268,7 +277,8 @@ pub fn renderSidebar(self: *App, cr: *c.cairo_t) void {@max(0, content_width - 16),@floatFromInt(height),);- drawSidebarHeader(cr, section_names[i], card.y, content_width, card.expanded);+ const hovered = self.hoverKey() == 940 + i;+ drawSidebarHeader(cr, section_names[i], card.y, content_width, card.expanded, hovered);}const places_card = layout.cards[@intFromEnum(app_model.SidebarSection.places)];