mirror of
https://github.com/rustdesk/qemu-display.git
synced 2025-07-01 15:25:29 +00:00
Update to current zbus git
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
b6f12103e9
commit
8fd2af4583
@ -61,7 +61,7 @@ trait Audio {
|
|||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct Audio {
|
pub struct Audio {
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub proxy: AsyncAudioProxy<'static>,
|
pub proxy: AudioProxy<'static>,
|
||||||
out_listener: Option<Connection>,
|
out_listener: Option<Connection>,
|
||||||
in_listener: Option<Connection>,
|
in_listener: Option<Connection>,
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ impl<H: AudioInHandler> AudioInListener<H> {
|
|||||||
|
|
||||||
impl Audio {
|
impl Audio {
|
||||||
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
|
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
|
||||||
let proxy = AsyncAudioProxy::new(conn).await?;
|
let proxy = AudioProxy::new(conn).await?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
proxy,
|
proxy,
|
||||||
in_listener: None,
|
in_listener: None,
|
||||||
|
@ -34,16 +34,13 @@ pub trait Chardev {
|
|||||||
#[derive(derivative::Derivative)]
|
#[derive(derivative::Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct Chardev {
|
pub struct Chardev {
|
||||||
pub proxy: AsyncChardevProxy<'static>,
|
pub proxy: ChardevProxy<'static>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Chardev {
|
impl Chardev {
|
||||||
pub async fn new(conn: &zbus::Connection, id: &str) -> Result<Self> {
|
pub async fn new(conn: &zbus::Connection, id: &str) -> Result<Self> {
|
||||||
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Chardev_{}", id))?;
|
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Chardev_{}", id))?;
|
||||||
let proxy = AsyncChardevProxy::builder(conn)
|
let proxy = ChardevProxy::builder(conn).path(&obj_path)?.build().await?;
|
||||||
.path(&obj_path)?
|
|
||||||
.build()
|
|
||||||
.await?;
|
|
||||||
Ok(Self { proxy })
|
Ok(Self { proxy })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,14 +90,14 @@ impl<H: ClipboardHandler> ClipboardListener<H> {
|
|||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct Clipboard {
|
pub struct Clipboard {
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub proxy: AsyncClipboardProxy<'static>,
|
pub proxy: ClipboardProxy<'static>,
|
||||||
conn: zbus::Connection,
|
conn: zbus::Connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clipboard {
|
impl Clipboard {
|
||||||
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
|
pub async fn new(conn: &zbus::Connection) -> Result<Self> {
|
||||||
let obj_path = ObjectPath::try_from("/org/qemu/Display1/Clipboard").unwrap();
|
let obj_path = ObjectPath::try_from("/org/qemu/Display1/Clipboard").unwrap();
|
||||||
let proxy = AsyncClipboardProxy::builder(conn)
|
let proxy = ClipboardProxy::builder(conn)
|
||||||
.path(&obj_path)?
|
.path(&obj_path)?
|
||||||
.build()
|
.build()
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -9,7 +9,7 @@ use zbus::{
|
|||||||
Connection,
|
Connection,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{AsyncKeyboardProxy, AsyncMouseProxy, ConsoleListener, ConsoleListenerHandler, Result};
|
use crate::{ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, Result};
|
||||||
|
|
||||||
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Console")]
|
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Console")]
|
||||||
pub trait Console {
|
pub trait Console {
|
||||||
@ -48,29 +48,23 @@ pub trait Console {
|
|||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct Console {
|
pub struct Console {
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub proxy: AsyncConsoleProxy<'static>,
|
pub proxy: ConsoleProxy<'static>,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub keyboard: AsyncKeyboardProxy<'static>,
|
pub keyboard: KeyboardProxy<'static>,
|
||||||
#[derivative(Debug = "ignore")]
|
#[derivative(Debug = "ignore")]
|
||||||
pub mouse: AsyncMouseProxy<'static>,
|
pub mouse: MouseProxy<'static>,
|
||||||
listener: RefCell<Option<Connection>>,
|
listener: RefCell<Option<Connection>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Console {
|
impl Console {
|
||||||
pub async fn new(conn: &Connection, idx: u32) -> Result<Self> {
|
pub async fn new(conn: &Connection, idx: u32) -> Result<Self> {
|
||||||
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Console_{}", idx))?;
|
let obj_path = ObjectPath::try_from(format!("/org/qemu/Display1/Console_{}", idx))?;
|
||||||
let proxy = AsyncConsoleProxy::builder(conn)
|
let proxy = ConsoleProxy::builder(conn).path(&obj_path)?.build().await?;
|
||||||
.path(&obj_path)?
|
let keyboard = KeyboardProxy::builder(conn)
|
||||||
.build()
|
|
||||||
.await?;
|
|
||||||
let keyboard = AsyncKeyboardProxy::builder(conn)
|
|
||||||
.path(&obj_path)?
|
|
||||||
.build()
|
|
||||||
.await?;
|
|
||||||
let mouse = AsyncMouseProxy::builder(conn)
|
|
||||||
.path(&obj_path)?
|
.path(&obj_path)?
|
||||||
.build()
|
.build()
|
||||||
.await?;
|
.await?;
|
||||||
|
let mouse = MouseProxy::builder(conn).path(&obj_path)?.build().await?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
proxy,
|
proxy,
|
||||||
keyboard,
|
keyboard,
|
||||||
|
@ -11,7 +11,7 @@ use zbus::{
|
|||||||
};
|
};
|
||||||
use zvariant::OwnedObjectPath;
|
use zvariant::OwnedObjectPath;
|
||||||
|
|
||||||
use crate::{AsyncVMProxy, Audio, Chardev, Clipboard, Error, Result, UsbRedir};
|
use crate::{Audio, Chardev, Clipboard, Error, Result, UsbRedir, VMProxy};
|
||||||
|
|
||||||
pub struct Display {
|
pub struct Display {
|
||||||
conn: Connection,
|
conn: Connection,
|
||||||
@ -21,7 +21,7 @@ pub struct Display {
|
|||||||
impl Display {
|
impl Display {
|
||||||
pub async fn by_name(conn: &Connection) -> Result<HashMap<String, OwnedUniqueName>> {
|
pub async fn by_name(conn: &Connection) -> Result<HashMap<String, OwnedUniqueName>> {
|
||||||
let mut hm = HashMap::new();
|
let mut hm = HashMap::new();
|
||||||
let list = match fdo::AsyncDBusProxy::new(conn)
|
let list = match fdo::DBusProxy::new(conn)
|
||||||
.await?
|
.await?
|
||||||
.list_queued_owners(WellKnownName::from_str_unchecked("org.qemu"))
|
.list_queued_owners(WellKnownName::from_str_unchecked("org.qemu"))
|
||||||
.await
|
.await
|
||||||
@ -31,7 +31,7 @@ impl Display {
|
|||||||
Err(e) => return Err(e.into()),
|
Err(e) => return Err(e.into()),
|
||||||
};
|
};
|
||||||
for dest in list.into_iter() {
|
for dest in list.into_iter() {
|
||||||
let name = AsyncVMProxy::builder(conn)
|
let name = VMProxy::builder(conn)
|
||||||
.destination(UniqueName::from(&dest))?
|
.destination(UniqueName::from(&dest))?
|
||||||
.build()
|
.build()
|
||||||
.await?
|
.await?
|
||||||
@ -52,7 +52,7 @@ impl Display {
|
|||||||
} else {
|
} else {
|
||||||
"org.qemu".try_into().unwrap()
|
"org.qemu".try_into().unwrap()
|
||||||
};
|
};
|
||||||
let objects = fdo::AsyncObjectManagerProxy::builder(conn)
|
let objects = fdo::ObjectManagerProxy::builder(conn)
|
||||||
.destination(dest)?
|
.destination(dest)?
|
||||||
.path("/org/qemu/Display1")?
|
.path("/org/qemu/Display1")?
|
||||||
.build()
|
.build()
|
||||||
|
@ -91,7 +91,7 @@ impl Handler {
|
|||||||
Err(rusb::Error::Access) => {
|
Err(rusb::Error::Access) => {
|
||||||
let (bus, dev) = (device.bus_number(), device.address());
|
let (bus, dev) = (device.bus_number(), device.address());
|
||||||
let sysbus = zbus::Connection::system().await?;
|
let sysbus = zbus::Connection::system().await?;
|
||||||
let fd = AsyncSystemHelperProxy::new(&sysbus)
|
let fd = SystemHelperProxy::new(&sysbus)
|
||||||
.await?
|
.await?
|
||||||
.open_bus_dev(bus, dev)
|
.open_bus_dev(bus, dev)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -12,7 +12,7 @@ use gtk::{
|
|||||||
gdk, gio, glib,
|
gdk, gio, glib,
|
||||||
prelude::{DisplayExt, *},
|
prelude::{DisplayExt, *},
|
||||||
};
|
};
|
||||||
use qemu_display::{AsyncClipboardProxy, Clipboard, ClipboardHandler, ClipboardSelection};
|
use qemu_display::{Clipboard, ClipboardHandler, ClipboardProxy, ClipboardSelection};
|
||||||
use rdw::gtk;
|
use rdw::gtk;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -25,7 +25,7 @@ pub struct Handler {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct InnerHandler {
|
struct InnerHandler {
|
||||||
proxy: AsyncClipboardProxy<'static>,
|
proxy: ClipboardProxy<'static>,
|
||||||
serials: Arc<[AtomicU32; 2]>,
|
serials: Arc<[AtomicU32; 2]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ impl Drop for Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn watch_clipboard(
|
fn watch_clipboard(
|
||||||
proxy: AsyncClipboardProxy<'static>,
|
proxy: ClipboardProxy<'static>,
|
||||||
selection: ClipboardSelection,
|
selection: ClipboardSelection,
|
||||||
serials: Arc<[AtomicU32; 2]>,
|
serials: Arc<[AtomicU32; 2]>,
|
||||||
) -> Option<SignalHandlerId> {
|
) -> Option<SignalHandlerId> {
|
||||||
|
@ -12,7 +12,7 @@ use std::{
|
|||||||
use clap::Clap;
|
use clap::Clap;
|
||||||
use image::GenericImage;
|
use image::GenericImage;
|
||||||
use keycodemap::*;
|
use keycodemap::*;
|
||||||
use qemu_display::{AsyncVMProxy, Console, ConsoleListenerHandler, MouseButton};
|
use qemu_display::{Console, ConsoleListenerHandler, MouseButton, VMProxy};
|
||||||
use vnc::{
|
use vnc::{
|
||||||
server::{Event as VncEvent, FramebufferUpdate},
|
server::{Event as VncEvent, FramebufferUpdate},
|
||||||
Encoding, Error as VncError, PixelFormat, Rect, Screen, Server as VncServer,
|
Encoding, Error as VncError, PixelFormat, Rect, Screen, Server as VncServer,
|
||||||
@ -478,7 +478,7 @@ async fn run() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
.expect("Failed to connect to DBus");
|
.expect("Failed to connect to DBus");
|
||||||
|
|
||||||
let vm_name = AsyncVMProxy::new(&dbus).await?.name().await?;
|
let vm_name = VMProxy::new(&dbus).await?.name().await?;
|
||||||
|
|
||||||
let console = Console::new(&dbus.into(), 0)
|
let console = Console::new(&dbus.into(), 0)
|
||||||
.await
|
.await
|
||||||
|
Loading…
x
Reference in New Issue
Block a user