aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tty.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-26 10:42:56 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-26 13:45:03 +0400
commit906ee36a934154221f1b8ef6d919f80e9ac950fb (patch)
tree84e4355d06e86784633d3969315e77b75a479092 /src/backend/tty.rs
parentac16717f4eb6d339ae0a544ac35b8305ffc8802e (diff)
downloadniri-906ee36a934154221f1b8ef6d919f80e9ac950fb.tar.gz
niri-906ee36a934154221f1b8ef6d919f80e9ac950fb.tar.bz2
niri-906ee36a934154221f1b8ef6d919f80e9ac950fb.zip
Skip rendering when backend is inactive
Diffstat (limited to 'src/backend/tty.rs')
-rw-r--r--src/backend/tty.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 5204c44a..9cfd46ee 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -813,6 +813,14 @@ impl Tty {
pub fn gbm_device(&self) -> Option<GbmDevice<DrmDeviceFd>> {
self.output_device.as_ref().map(|d| d.gbm.clone())
}
+
+ pub fn is_active(&self) -> bool {
+ let Some(device) = &self.output_device else {
+ return false;
+ };
+
+ device.drm.is_active()
+ }
}
fn refresh_interval(mode: DrmMode) -> Duration {