From 98d2f6a56811ea4617447db133bef9def8479c6f Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 21 May 2022 16:22:28 +0200 Subject: [PATCH] session-lock: add basic logging --- river/LockManager.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/river/LockManager.zig b/river/LockManager.zig index a761983..f911ecf 100644 --- a/river/LockManager.zig +++ b/river/LockManager.zig @@ -26,6 +26,8 @@ const util = @import("util.zig"); const LockSurface = @import("LockSurface.zig"); +const log = std.log.scoped(.session_lock); + locked: bool = false, lock: ?*wlr.SessionLockV1 = null, @@ -52,6 +54,7 @@ fn handleLock(listener: *wl.Listener(*wlr.SessionLockV1), lock: *wlr.SessionLock const manager = @fieldParentPtr(LockManager, "new_lock", listener); if (manager.lock != null) { + log.info("denying new session lock client, an active one already exists", .{}); lock.destroy(); return; } @@ -72,6 +75,10 @@ fn handleLock(listener: *wl.Listener(*wlr.SessionLockV1), lock: *wlr.SessionLock seat.prev_mode_id = seat.mode_id; seat.enterMode(1); } + + log.info("session locked", .{}); + } else { + log.info("new session lock client given control of already locked session", .{}); } lock.events.new_surface.add(&manager.new_surface); @@ -85,6 +92,8 @@ fn handleUnlock(listener: *wl.Listener(void)) void { assert(manager.locked); manager.locked = false; + log.info("session unlocked", .{}); + { var it = server.input_manager.seats.first; while (it) |node| : (it = node.next) { @@ -104,6 +113,8 @@ fn handleUnlock(listener: *wl.Listener(void)) void { fn handleDestroy(listener: *wl.Listener(void)) void { const manager = @fieldParentPtr(LockManager, "destroy", listener); + log.debug("ext_session_lock_v1 destroyed", .{}); + manager.new_surface.link.remove(); manager.unlock.link.remove(); manager.destroy.link.remove(); @@ -117,6 +128,8 @@ fn handleSurface( ) void { const manager = @fieldParentPtr(LockManager, "new_surface", listener); + log.debug("new ext_session_lock_surface_v1 created", .{}); + assert(manager.locked); assert(manager.lock != null);