From 2338e43e7e37211159be0e563dcd435137fb59a7 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 14 Oct 2024 20:50:45 -0400 Subject: [PATCH] wlserver: Re-hook pausing on session pause During the refactor in 06a6225996b2e21e354d334f89267f05cd8724a4, the handle_session_active function lost the ultimate role of *causing a pause* when the session became inactive. The duty of pausing the session was given the `DirtyState` function on the backend, which now uses the same "moral" condition to set the paused state (`g_DRM.paused = !wlsession_active();`)... ... except that now `DirtyState` state is only called when the session is resumed. In turn, this means that on session suspend, nothing ends-up pausing the DRM backend anymore! This change unconditionally calls `DirtyState`, which in turn does the accounting for pausing the backend. Actually, it conditionally passes `false` to the argument to force nothing. This fixes what ends-up causing `drmModeAtomicCommit: Permission denied` when moving to another VT from gamescope's. --- src/wlserver.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wlserver.cpp b/src/wlserver.cpp index 78a86ee0e2..9165347bfc 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp @@ -1340,8 +1340,7 @@ bool wlsession_active() static void handle_session_active( struct wl_listener *listener, void *data ) { - if (wlserver.wlr.session->active) - GetBackend()->DirtyState( true, true ); + GetBackend()->DirtyState( wlserver.wlr.session->active, wlserver.wlr.session->active ); wl_log.infof( "Session %s", wlserver.wlr.session->active ? "resumed" : "paused" ); } #endif