config: add XWayland enabled option
This commit is contained in:
parent
4ca67772b3
commit
49274fb1c6
13 changed files with 85 additions and 10 deletions
19
src/state.rs
19
src/state.rs
|
|
@ -313,6 +313,7 @@ pub struct ScreenlockState {
|
|||
|
||||
pub struct XWaylandState {
|
||||
pub enabled: Cell<bool>,
|
||||
pub running: Cell<bool>,
|
||||
pub pidfd: CloneCell<Option<Rc<OwnedFd>>>,
|
||||
pub handler: RefCell<Option<SpawnedFuture<()>>>,
|
||||
pub queue: Rc<AsyncQueue<XWaylandEvent>>,
|
||||
|
|
@ -968,6 +969,24 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn stop_xwayland(&self) {
|
||||
if self.xwayland.running.get() {
|
||||
return;
|
||||
}
|
||||
self.xwayland.handler.take();
|
||||
}
|
||||
|
||||
pub fn set_xwayland_enabled(self: &Rc<Self>, enabled: bool) {
|
||||
if self.xwayland.enabled.replace(enabled) == enabled {
|
||||
return;
|
||||
}
|
||||
if enabled {
|
||||
self.start_xwayland();
|
||||
} else {
|
||||
self.stop_xwayland();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn next_serial(&self, client: Option<&Client>) -> u64 {
|
||||
let serial = self.serial.fetch_add(1);
|
||||
if let Some(client) = client {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue