From c45e4749b574e388825032d110c1ae5972c16aea Mon Sep 17 00:00:00 2001 From: axlrose <26582+axlrose@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:28:46 +0800 Subject: [PATCH] Wayland: a failed output-power handshake must not block screencopy (#65) Output power management is optional: the engine comment already says so, but uu_wl_wake() only tolerated a *missing* power manager. When the compositor offers zwlr_output_power_manager_v1 and then refuses the mode (headless outputs, outputs without DPMS), power_failed is set and the function reported an error. capture::keep_display_awake() propagates that error and video.rs aborts the whole capture task with '?', so a client could connect but never received a frame. Treat a failed power handshake like a missing one: skip waking the screen and keep streaming. --- c_engine/wayland_engine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c_engine/wayland_engine.c b/c_engine/wayland_engine.c index 9978eb0..1551fc9 100644 --- a/c_engine/wayland_engine.c +++ b/c_engine/wayland_engine.c @@ -601,7 +601,11 @@ end: int uu_wl_wake(void) { pthread_mutex_lock(&lock); int result=-1; /* Output power management is optional; missing it must not block screencopy. */ - if(initialized && !power) result=0; + if(initialized && (!power || power_failed)) { + /* No power manager, or the compositor refused the mode (outputs without DPMS, + headless outputs): streaming continues, the screen simply stays as it is. */ + result=0; + } if(initialized && power && !power_failed) { zwlr_output_power_v1_set_mode(power,ZWLR_OUTPUT_POWER_V1_MODE_ON); if(sync_display()==0 && !power_failed) result=0;