Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
rwm: fix assertion failures, cleanup
river/Cursor.zig | 11 +----------
river/Window.zig | 5 ++++-
river/WindowManager.zig | 1 -
river/WmNode.zig | 1 +
4 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/river/Cursor.zig b/river/Cursor.zig
index 2618c9a..6405ab4 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -363,7 +363,6 @@ pub fn processMotionRelative(cursor: *Cursor, event: *const wlr.Pointer.event.Mo
// XXX move window
- server.wm.dirtyPending();
},
.resize => |*data| {
dx += data.delta_x;
@@ -417,8 +416,6 @@ pub fn processMotionRelative(cursor: *Cursor, event: *const wlr.Pointer.event.Mo
box.height = @min(box.height, output_height - border_width - box.y);
data.y = box.height - data.initial_height;
}
-
- server.wm.dirtyPending();
},
}
}
@@ -458,8 +455,6 @@ pub fn processButton(cursor: *Cursor, event: *const wlr.Pointer.event.Button) vo
cursor.mode = .passthrough;
cursor.passthrough(event.time_msec);
-
- server.wm.dirtyPending();
} else {
_ = cursor.seat.wlr_seat.pointerNotifyButton(event.time_msec, event.button, event.state);
}
@@ -773,7 +768,7 @@ fn computeEdges(cursor: *const Cursor, window: *const Window) wlr.Edges {
}
}
-fn enterMode(cursor: *Cursor, mode: Mode, window: *Window, xcursor_name: [*:0]const u8) void {
+fn enterMode(cursor: *Cursor, mode: Mode, _: *Window, xcursor_name: [*:0]const u8) void {
assert(cursor.mode == .passthrough or cursor.mode == .down);
assert(mode == .move or mode == .resize);
@@ -781,12 +776,8 @@ fn enterMode(cursor: *Cursor, mode: Mode, window: *Window, xcursor_name: [*:0]co
cursor.mode = mode;
- cursor.seat.focus(window);
-
cursor.seat.wlr_seat.pointerNotifyClearFocus();
cursor.setXcursor(xcursor_name);
-
- server.wm.dirtyPending();
}
/// Handle potential change in location of windows on the output, as well as
diff --git a/river/Window.zig b/river/Window.zig
index 2b0abc4..b0a14d6 100644
--- a/river/Window.zig
+++ b/river/Window.zig
@@ -228,7 +228,10 @@ pub fn create(impl: Impl) error{OutOfMemory}!*Window {
pub fn destroy(window: *Window, when: enum { lazy, assert }) void {
assert(window.impl == .none);
assert(!window.mapped);
- assert(window.pending.state == .closing);
+ switch (window.pending.state) {
+ .init, .closing => {},
+ .ready => unreachable,
+ }
window.destroying = true;
diff --git a/river/WindowManager.zig b/river/WindowManager.zig
index 0e7b1d1..b698204 100644
--- a/river/WindowManager.zig
+++ b/river/WindowManager.zig
@@ -157,7 +157,6 @@ fn bind(client: *wl.Client, wm: *WindowManager, version: u32, id: u32) void {
wm.object = object;
object.setHandler(*WindowManager, handleRequest, null, wm);
- // XXX send existing windows outputs and seats, including output dimensions
}
fn handleRequestInert(
diff --git a/river/WmNode.zig b/river/WmNode.zig
index 8bcff18..bbb8016 100644
--- a/river/WmNode.zig
+++ b/river/WmNode.zig
@@ -80,6 +80,7 @@ pub fn createObject(node: *WmNode, client: *wl.Client, version: u32, id: u32) vo
pub fn makeInert(node: *WmNode) void {
if (node.object) |node_v1| {
node_v1.setHandler(?*anyopaque, handleRequestInert, null, null);
+ node.object = null;
}
}