From 7a10535eaaadc4e239d974e8ac8737090755833d Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sun, 10 Nov 2024 04:52:58 +0100 Subject: [PATCH] Fix DPMS handling regressions This patch fixes two separate regressions. The first one was introduced in 3d04f9ee, where the `sleeping` field was renamed to `display_on`. Since the field's value was inverted, it was necessary to switch all conditionals accessing this field, which was forgotten for the one that toggles the accelerometer timer on DPMS on/off. Then 64279b21 made use of the same conditional to simulate activity whenever the display is turned on, however it accidentally checked for the display to be off. As a result turning the display off would automatically cause activity, waking the display back up. --- src/catacomb.rs | 16 ++++++++-------- src/input.rs | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/catacomb.rs b/src/catacomb.rs index 2b46e94..478a6ec 100644 --- a/src/catacomb.rs +++ b/src/catacomb.rs @@ -447,15 +447,15 @@ impl Catacomb { // Pause accelerometer checks while display is off. if on { - trace_error!(self.event_loop.disable(&self.accelerometer_token)); - } else if !self.windows.orientation_locked() { - trace_error!(self.event_loop.enable(&self.accelerometer_token)); - } - - // Count wakeup as activity, to ensure that clients like wayidle receive a - // resume and new idle events after waking the monitor back up. - if !on { + // Count wakeup as activity, to ensure that clients like wayidle receive a + // resume and new idle events after waking the monitor back up. self.idle_notifier_state.notify_activity(&self.seat); + + if !self.windows.orientation_locked() { + trace_error!(self.event_loop.enable(&self.accelerometer_token)); + } + } else { + trace_error!(self.event_loop.disable(&self.accelerometer_token)); } self.backend.set_display_status(on); diff --git a/src/input.rs b/src/input.rs index 403808a..220847b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -449,7 +449,6 @@ impl Catacomb { self.touch_state.last_tap = Some((Instant::now(), event.position)); }, - // TODO: Update idle timeout. Some(TouchAction::DoubleTap) => self.set_display_status(true), _ => (), }