aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tty.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-01-21 10:25:39 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-01-21 10:25:39 +0400
commitdf48337d83f78bbd2a923863e73941b6bd236a28 (patch)
tree390e16f0b1c9f2d955ff0a5ae0acaf3fa0d5ccb3 /src/backend/tty.rs
parentf5e9b40140e64cf907520aa0d8adf43f7141e1d2 (diff)
downloadniri-df48337d83f78bbd2a923863e73941b6bd236a28.tar.gz
niri-df48337d83f78bbd2a923863e73941b6bd236a28.tar.bz2
niri-df48337d83f78bbd2a923863e73941b6bd236a28.zip
tty: Delay output config update until resume
We can't do anything while paused.
Diffstat (limited to 'src/backend/tty.rs')
-rw-r--r--src/backend/tty.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index c093d722..cecb0e29 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -74,6 +74,8 @@ pub struct Tty {
// The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to
// the primary GPU.
primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>,
+ // The output config had changed, but the session is paused, so we need to update it on resume.
+ update_output_config_on_resume: bool,
ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>,
enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
}
@@ -222,6 +224,7 @@ impl Tty {
devices: HashMap::new(),
dmabuf_global: None,
primary_allocator: None,
+ update_output_config_on_resume: false,
ipc_outputs: Rc::new(RefCell::new(HashMap::new())),
enabled_outputs: Arc::new(Mutex::new(HashMap::new())),
}
@@ -370,6 +373,10 @@ impl Tty {
}
}
+ if self.update_output_config_on_resume {
+ self.on_output_config_changed(niri);
+ }
+
self.refresh_ipc_outputs();
}
}
@@ -1234,6 +1241,13 @@ impl Tty {
pub fn on_output_config_changed(&mut self, niri: &mut Niri) {
let _span = tracy_client::span!("Tty::on_output_config_changed");
+ // If we're inactive, we can't do anything, so just set a flag for later.
+ if !self.session.is_active() {
+ self.update_output_config_on_resume = true;
+ return;
+ }
+ self.update_output_config_on_resume = false;
+
let mut to_disconnect = vec![];
let mut to_connect = vec![];