Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

fix: guard app proximity glow rendering

Mel3444f0f00b8d48
diff --git a/src/editor/app_controls.zig b/src/editor/app_controls.zig
index b15ce41..4ffc215 100644
--- a/src/editor/app_controls.zig
+++ b/src/editor/app_controls.zig
@@ -1,4 +1,5 @@
//! Shared geometry for the tab controls and their hover feedback.
+const std = @import("std");
const c = @import("../files/c.zig").api;
const ui = @import("ui").cairo;
const theme = @import("ui").theme;
diff --git a/src/editor/app_paint.zig b/src/editor/app_paint.zig
index b739768..3171bde 100644
--- a/src/editor/app_paint.zig
+++ b/src/editor/app_paint.zig
@@ -157,7 +157,10 @@ pub fn paintButton(self: *App, cr: *c.cairo_t, r: field.Rect, label: []const u8,
var layer = ui.Layer.begin(cr, r) orelse return;
defer layer.finish();
layer.renderer.palette = theme.shellPalette();
- const proximity = self.buttonProximity(r);
+ const proximity = self.buttonProximity(.{
+ .x = @floatCast(r.x), .y = @floatCast(r.y),
+ .w = @floatCast(r.w), .h = @floatCast(r.h),
+ });
button.paint(&layer.renderer, layer.local(), .{ .label = label, .variant = .secondary, .size = .sm }, .{
.selected = selected,
.pointer = if (r.contains(self.px, self.py)) .hover else .idle,
diff --git a/src/share_picker/client.zig b/src/share_picker/client.zig
index 627ddc5..494d71d 100644
--- a/src/share_picker/client.zig
+++ b/src/share_picker/client.zig
@@ -438,7 +438,10 @@ const Client = struct {
const close_w: f64 = @min(h_f, 32);
const hovered = self.inside and self.pointer_y < h_f and self.pointer_x >= w_f - close_w;
const box = self.closeRect();
- const proximity = ui_button.sampleProximity(box, @floatCast(self.pointer_x), @floatCast(self.pointer_y), .{ .x = 0, .y = 0, .w = @floatFromInt(w), .h = @floatFromInt(h) });
+ const proximity = if (self.inside)
+ ui_button.sampleProximity(box, @floatCast(self.pointer_x), @floatCast(self.pointer_y), .{ .x = 0, .y = 0, .w = @floatFromInt(w), .h = @floatFromInt(h) })
+ else
+ .{ .distance = std.math.inf(f32), .x = 0, .y = 0 };
var layer = shell_ui.Layer.begin(cr, .{ .x = @floatCast(w_f - close_w), .y = 0, .w = @floatCast(close_w), .h = @floatCast(h_f) }) orelse return;
ui_button.paint(&layer.renderer, layer.local(), .{ .variant = .chrome, .icon = .close, .label = i18n.tr("Close") }, .{
.pointer = if (hovered) .hover else .idle,
@@ -470,8 +473,8 @@ const Client = struct {
for (self.labels, 0..) |label, i| {
const row = self.rowRect(i);
- const proximity = self.rowProximity(i, self.pointer_x, self.pointer_y);
- var layer = shell_ui.Layer.begin(cr, row) orelse continue;
+ const proximity = if (self.inside) self.rowProximity(i, self.pointer_x, self.pointer_y) else .{ .distance = std.math.inf(f32), .x = 0, .y = 0 };
+ var layer = shell_ui.Layer.begin(cr, .{ .x = row.x, .y = row.y, .w = row.w, .h = row.h }) orelse continue;
ui_button.paint(&layer.renderer, layer.local(), .{
.variant = .secondary,
.size = .md,