forge
Explore
Log in

Don't you dare go Hollow

tty: Delay output config update until resume

Browse files at this commit

df48337d83f78bbd2a923863e73941b6bd236a28Ivan MolodetskikhParent: f5e9b40
We can't do anything while paused.
src/backend/tty.rsmodified+14 -0
@@ -74,6 +74,8 @@ pub struct Tty {
74 // The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to74 // The allocator for the primary GPU. It is only `Some()` if we have a device corresponding to
75 // the primary GPU.75 // the primary GPU.
76 primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>,76 primary_allocator: Option<DmabufAllocator<GbmAllocator<DrmDeviceFd>>>,
77+ // The output config had changed, but the session is paused, so we need to update it on resume.
78+ update_output_config_on_resume: bool,
77 ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>,79 ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>,
78 enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,80 enabled_outputs: Arc<Mutex<HashMap<String, Output>>>,
79 }81 }
@@ -222,6 +224,7 @@ impl Tty {
222 devices: HashMap::new(),224 devices: HashMap::new(),
223 dmabuf_global: None,225 dmabuf_global: None,
224 primary_allocator: None,226 primary_allocator: None,
227+ update_output_config_on_resume: false,
225 ipc_outputs: Rc::new(RefCell::new(HashMap::new())),228 ipc_outputs: Rc::new(RefCell::new(HashMap::new())),
226 enabled_outputs: Arc::new(Mutex::new(HashMap::new())),229 enabled_outputs: Arc::new(Mutex::new(HashMap::new())),
227 }230 }
@@ -370,6 +373,10 @@ impl Tty {
370 }373 }
371 }374 }
372 375
376+ if self.update_output_config_on_resume {
377+ self.on_output_config_changed(niri);
378+ }
379+
373 self.refresh_ipc_outputs();380 self.refresh_ipc_outputs();
374 }381 }
375 }382 }
@@ -1234,6 +1241,13 @@ impl Tty {
1234 pub fn on_output_config_changed(&mut self, niri: &mut Niri) {1241 pub fn on_output_config_changed(&mut self, niri: &mut Niri) {
1235 let _span = tracy_client::span!("Tty::on_output_config_changed");1242 let _span = tracy_client::span!("Tty::on_output_config_changed");
1236 1243
1244+ // If we're inactive, we can't do anything, so just set a flag for later.
1245+ if !self.session.is_active() {
1246+ self.update_output_config_on_resume = true;
1247+ return;
1248+ }
1249+ self.update_output_config_on_resume = false;
1250+
1237 let mut to_disconnect = vec![];1251 let mut to_disconnect = vec![];
1238 let mut to_connect = vec![];1252 let mut to_connect = vec![];
1239 1253