session-lock: move unlock logic to single place
This commit is contained in:
parent
5a53b74265
commit
44bdca8235
3 changed files with 16 additions and 20 deletions
|
|
@ -87,16 +87,7 @@ impl ExtSessionLockV1RequestHandler for ExtSessionLockV1 {
|
||||||
return Err(ExtSessionLockV1Error::NeverLocked);
|
return Err(ExtSessionLockV1Error::NeverLocked);
|
||||||
}
|
}
|
||||||
if !self.finished.get() {
|
if !self.finished.get() {
|
||||||
let state = &self.client.state;
|
self.client.state.do_unlock();
|
||||||
state.lock.locked.set(false);
|
|
||||||
state.lock.lock.take();
|
|
||||||
for output in state.root.outputs.lock().values() {
|
|
||||||
if let Some(surface) = output.set_lock_surface(None) {
|
|
||||||
surface.destroy_node();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.tree_changed();
|
|
||||||
state.damage();
|
|
||||||
}
|
}
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -216,19 +216,12 @@ impl JayCompositorRequestHandler for JayCompositor {
|
||||||
|
|
||||||
fn unlock(&self, _req: Unlock, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
fn unlock(&self, _req: Unlock, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
let state = &self.client.state;
|
let state = &self.client.state;
|
||||||
if state.lock.locked.replace(false) {
|
if state.lock.locked.get() {
|
||||||
if let Some(lock) = state.lock.lock.take() {
|
if let Some(lock) = state.lock.lock.get() {
|
||||||
lock.finish();
|
lock.finish();
|
||||||
}
|
}
|
||||||
for output in state.root.outputs.lock().values() {
|
state.do_unlock();
|
||||||
if let Some(surface) = output.set_lock_surface(None) {
|
|
||||||
surface.destroy_node();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.tree_changed();
|
|
||||||
state.damage();
|
|
||||||
}
|
}
|
||||||
self.client.symmetric_delete.set(true);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
src/state.rs
12
src/state.rs
|
|
@ -736,6 +736,18 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn do_unlock(&self) {
|
||||||
|
self.lock.locked.set(false);
|
||||||
|
self.lock.lock.take();
|
||||||
|
for output in self.root.outputs.lock().values() {
|
||||||
|
if let Some(surface) = output.set_lock_surface(None) {
|
||||||
|
surface.destroy_node();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.tree_changed();
|
||||||
|
self.damage();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clear(&self) {
|
pub fn clear(&self) {
|
||||||
self.lock.lock.take();
|
self.lock.lock.take();
|
||||||
self.xwayland.handler.borrow_mut().take();
|
self.xwayland.handler.borrow_mut().take();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue