RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Add taskbar middle-click close
Mel12229697f247
diff --git a/src/Input.zig b/src/Input.zigindex cdff811..50df206 100644--- a/src/Input.zig+++ b/src/Input.zig@@ -216,6 +216,7 @@ glow_toplevel: ?*Toplevel = null,hovered_taskbar: ?*Taskbar = null,taskbar_drag: ?TaskbarDragSession = null,tray_buttons: u32 = 0,+taskbar_close_buttons: u32 = 0,hovered_toast: ?*@import("notifications/toast.zig").Toast = null,grabbed_toplevel: ?*Toplevel = null,grab_x: f64 = 0,diff --git a/src/input/buttons.zig b/src/input/buttons.zigindex 679982f..240f0a2 100644--- a/src/input/buttons.zig+++ b/src/input/buttons.zig@@ -88,6 +88,10 @@ pub fn processButton(input.tray_buttons &= ~screenshot_bit;return;}+ if (state == .released and input.taskbar_close_buttons & screenshot_bit != 0) {+ input.taskbar_close_buttons &= ~screenshot_bit;+ return;+ }if (state == .released and input.switcher_buttons & screenshot_bit != 0) {input.switcher_buttons &= ~screenshot_bit;return;@@ -166,6 +170,26 @@ pub fn processButton(input.pointer_constraints.sync();return;}+ // Middle-clicking a taskbar chip requests a normal application close.+ // Intercept before active_buttons is incremented for this press.+ if (button == btn_middle and state == .pressed and+ input.cursor_mode == .passthrough and input.active_buttons == 0 and+ input.seat.drag == null and input.pan_session == null)+ {+ const picked = scene_data.hitTest(input.server, input.cursor.x, input.cursor.y);+ if (picked == .taskbar) {+ const hit = picked.taskbar;+ switch (hit.bar.hitTest(hit.sx, hit.sy)) {+ .chip => |target| {+ input.taskbar_close_buttons |= screenshot_bit;+ target.sendClose();+ return;+ },+ else => {},+ }+ }+ }+if (state == .pressed) {input.active_buttons += 1;input.presses +%= 1;