Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Cursor: fix pointer enter/leave events
We must mark the windowing state as dirty if this state changes.
river/Cursor.zig | 7 +++++++
rivercompat/Config.zig | 1 +
rivercompat/Window.zig | 5 ++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/river/Cursor.zig b/river/Cursor.zig
index 6ede6b0..cfdf21f 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -362,6 +362,7 @@ pub fn processMotionRelative(cursor: *Cursor, event: *const wlr.Pointer.event.Mo
}
fn updateHovered(cursor: *Cursor) void {
+ const old = cursor.seat.windowing_scheduled.window;
if (server.scene.at(cursor.wlr_cursor.x, cursor.wlr_cursor.y)) |result| {
switch (result.data) {
.window => |window| {
@@ -387,6 +388,12 @@ fn updateHovered(cursor: *Cursor) void {
cursor.seat.windowing_scheduled.window = null;
},
}
+ } else {
+ cursor.seat.windowing_scheduled.window = null;
+ }
+
+ if (cursor.seat.windowing_scheduled.window != old) {
+ server.wm.dirtyWindowing();
}
}
diff --git a/rivercompat/Config.zig b/rivercompat/Config.zig
index 52e6e28..2faf3bb 100644
--- a/rivercompat/Config.zig
+++ b/rivercompat/Config.zig
@@ -24,6 +24,7 @@ const gpa = std.heap.c_allocator;
border_width: u31 = 3,
border_color_unfocused: u32 = 0x586e75,
border_color_focused: u32 = 0x93a1a1,
+border_color_hovered: u32 = 0xdc322f,
main_count: u31 = 1,
main_location: enum { left, right, top, bottom } = .left,
diff --git a/rivercompat/Window.zig b/rivercompat/Window.zig
index def241f..fabf599 100644
--- a/rivercompat/Window.zig
+++ b/rivercompat/Window.zig
@@ -172,7 +172,10 @@ pub fn updateRendering(window: *Window) void {
{
var it = wm.seats.iterator(.forward);
while (it.next()) |seat| {
- if (seat.focused == window) {
+ if (seat.hovered == window) {
+ window.setBorders(wm.config.border_color_hovered);
+ break;
+ } else if (seat.focused == window) {
window.setBorders(wm.config.border_color_focused);
break;
}