wayland: dispatcher: move overriding visibility manager to root
D-Bus support is large, and should have an option to be excluded. Move the struct implementing D-Bus support from the dispatcher to the main file, so it can be replaced with a stub.
This commit is contained in:
parent
15c9402b99
commit
379ac88a5a
2 changed files with 23 additions and 30 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -20,6 +20,21 @@ use std::sync::Arc;
|
|||
use std::time::Instant;
|
||||
use tokio::task;
|
||||
use wayland_client::globals;
|
||||
use zbus::InterfaceRef;
|
||||
|
||||
pub struct VisibilityManager(InterfaceRef<OSK0<Dispatcher>>);
|
||||
|
||||
impl VisibilityManager {
|
||||
pub fn set_visible(&self, visible: bool)
|
||||
{
|
||||
let osk = self.0.clone();
|
||||
|
||||
task::spawn(async move {
|
||||
let osk = osk.get().await;
|
||||
osk.set_visible(visible).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main()
|
||||
|
|
@ -48,7 +63,7 @@ async fn main()
|
|||
let gfx = dispatcher.graphics();
|
||||
let osk = OSK0::start(&conn_zbus, gfx, conn_wl.clone()).await;
|
||||
match osk {
|
||||
Ok(k) => dispatcher.set_osk(k),
|
||||
Ok(k) => dispatcher.set_osk(VisibilityManager(k)),
|
||||
Err(e) => eprintln!("warn: bind to sm.puri.OSK0 failed: {}", e),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue