output-transactions: unify state application after transactions
This commit is contained in:
parent
a52986f3f4
commit
3c1475041f
5 changed files with 54 additions and 25 deletions
|
|
@ -105,10 +105,7 @@ impl ConnectorHandler {
|
|||
async fn handle_connected(&self, info: MonitorInfo) {
|
||||
log::info!("Connector {} connected", self.data.connector.kernel_id());
|
||||
self.data.connected.set(true);
|
||||
let old_state = self.data.state.get();
|
||||
if old_state.serial < info.state.serial {
|
||||
self.data.state.set(info.state);
|
||||
}
|
||||
self.data.set_state(&self.state, info.state);
|
||||
let name = self.state.globals.name();
|
||||
if info.non_desktop {
|
||||
self.handle_non_desktop_connected(info).await;
|
||||
|
|
@ -290,7 +287,7 @@ impl ConnectorHandler {
|
|||
on.global.formats.set(formats);
|
||||
}
|
||||
ConnectorEvent::State(state) => {
|
||||
on.update_state(state);
|
||||
self.data.set_state(&self.state, state);
|
||||
}
|
||||
ev => unreachable!("received unexpected event {:?}", ev),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ impl Idle {
|
|||
}
|
||||
|
||||
fn try_set_idle(&self, idle: bool) -> Result<(), BackendConnectorTransactionError> {
|
||||
let mut tran = ConnectorTransaction::default();
|
||||
let mut tran = ConnectorTransaction::new(&self.state);
|
||||
for connector in self.state.connectors.lock().values() {
|
||||
let mut state = connector.state.get();
|
||||
state.active = !idle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue