Update to zbus 4
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
a2185be540
commit
3e2bb7985c
|
@ -13,10 +13,8 @@ resolver = "2"
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
qemu-display = { path = "qemu-display", version = "0.1" }
|
qemu-display = { path = "qemu-display", version = "0.1" }
|
||||||
keycodemap = { path = "keycodemap", version = "0.1" }
|
keycodemap = { path = "keycodemap", version = "0.1" }
|
||||||
zbus = "4"
|
zbus = { version = "4", features = ["p2p"] }
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
zbus = { git = "https://github.com/dbus2/zbus.git" }
|
|
||||||
zvariant = { git = "https://github.com/dbus2/zbus.git" }
|
|
||||||
vnc = { git = "https://github.com/elmarco/rust-vnc", branch = "server" }
|
vnc = { git = "https://github.com/elmarco/rust-vnc", branch = "server" }
|
||||||
rdw4 = { git = "https://gitlab.gnome.org/malureau/rdw.git" }
|
rdw4 = { git = "https://gitlab.gnome.org/malureau/rdw.git" }
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::os::unix::net::UnixStream;
|
||||||
use uds_windows::UnixStream;
|
use uds_windows::UnixStream;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::{dbus_interface, dbus_proxy, Connection};
|
use zbus::Connection;
|
||||||
|
|
||||||
use crate::{util, Result};
|
use crate::{util, Result};
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ pub struct Volume {
|
||||||
pub volume: Vec<u8>,
|
pub volume: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_proxy(
|
#[zbus::proxy(
|
||||||
default_service = "org.qemu",
|
default_service = "org.qemu",
|
||||||
default_path = "/org/qemu/Display1/Audio",
|
default_path = "/org/qemu/Display1/Audio",
|
||||||
interface = "org.qemu.Display1.Audio"
|
interface = "org.qemu.Display1.Audio"
|
||||||
|
@ -92,7 +92,7 @@ struct AudioOutListener<H: AudioOutHandler> {
|
||||||
handler: H,
|
handler: H,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(name = "org.qemu.Display1.AudioOutListener")]
|
#[zbus::interface(name = "org.qemu.Display1.AudioOutListener")]
|
||||||
impl<H: AudioOutHandler> AudioOutListener<H> {
|
impl<H: AudioOutHandler> AudioOutListener<H> {
|
||||||
/// Init method
|
/// Init method
|
||||||
async fn init(
|
async fn init(
|
||||||
|
@ -170,7 +170,7 @@ struct AudioInListener<H: AudioInHandler> {
|
||||||
handler: H,
|
handler: H,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(name = "org.qemu.Display1.AudioInListener")]
|
#[zbus::interface(name = "org.qemu.Display1.AudioInListener")]
|
||||||
impl<H: AudioInHandler> AudioInListener<H> {
|
impl<H: AudioInHandler> AudioInListener<H> {
|
||||||
/// Init method
|
/// Init method
|
||||||
async fn init(
|
async fn init(
|
||||||
|
|
|
@ -3,11 +3,11 @@ use crate::win32::Fd;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::{dbus_proxy, zvariant::ObjectPath};
|
use zbus::zvariant::ObjectPath;
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Chardev")]
|
#[zbus::proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Chardev")]
|
||||||
pub trait Chardev {
|
pub trait Chardev {
|
||||||
/// Register method
|
/// Register method
|
||||||
fn register(&self, stream: Fd<'_>) -> zbus::Result<()>;
|
fn register(&self, stream: Fd<'_>) -> zbus::Result<()>;
|
||||||
|
@ -16,19 +16,19 @@ pub trait Chardev {
|
||||||
fn send_break(&self) -> zbus::Result<()>;
|
fn send_break(&self) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// Echo property
|
/// Echo property
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn echo(&self) -> zbus::Result<bool>;
|
fn echo(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// FEOpened property
|
/// FEOpened property
|
||||||
#[dbus_proxy(property, name = "FEOpened")]
|
#[zbus(property, name = "FEOpened")]
|
||||||
fn fe_opened(&self) -> zbus::Result<bool>;
|
fn fe_opened(&self) -> zbus::Result<bool>;
|
||||||
|
|
||||||
/// Name property
|
/// Name property
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn name(&self) -> zbus::Result<String>;
|
fn name(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// Owner property
|
/// Owner property
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn owner(&self) -> zbus::Result<String>;
|
fn owner(&self) -> zbus::Result<String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use zbus::{
|
use zbus::zvariant::{ObjectPath, Type};
|
||||||
dbus_interface, dbus_proxy,
|
|
||||||
zvariant::{ObjectPath, Type},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
|
@ -15,7 +12,7 @@ pub enum ClipboardSelection {
|
||||||
Secondary,
|
Secondary,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_proxy(
|
#[zbus::proxy(
|
||||||
default_service = "org.qemu",
|
default_service = "org.qemu",
|
||||||
default_path = "/org/qemu/Display1/Clipboard",
|
default_path = "/org/qemu/Display1/Clipboard",
|
||||||
interface = "org.qemu.Display1.Clipboard"
|
interface = "org.qemu.Display1.Clipboard"
|
||||||
|
@ -58,7 +55,7 @@ pub(crate) struct ClipboardListener<H: ClipboardHandler> {
|
||||||
handler: H,
|
handler: H,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(name = "org.qemu.Display1.Clipboard")]
|
#[zbus::interface(name = "org.qemu.Display1.Clipboard")]
|
||||||
impl<H: ClipboardHandler> ClipboardListener<H> {
|
impl<H: ClipboardHandler> ClipboardListener<H> {
|
||||||
async fn register(&mut self) {
|
async fn register(&mut self) {
|
||||||
self.handler.register().await;
|
self.handler.register().await;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::{cell::RefCell, convert::TryFrom};
|
||||||
use uds_windows::UnixStream;
|
use uds_windows::UnixStream;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::{dbus_proxy, zvariant::ObjectPath, Connection};
|
use zbus::{zvariant::ObjectPath, Connection};
|
||||||
|
|
||||||
use crate::{util, ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, Result};
|
use crate::{util, ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, Result};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -16,13 +16,13 @@ use crate::{
|
||||||
ConsoleListenerMapHandler,
|
ConsoleListenerMapHandler,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Console")]
|
#[zbus::proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Console")]
|
||||||
pub trait Console {
|
pub trait Console {
|
||||||
/// RegisterListener method
|
/// RegisterListener method
|
||||||
fn register_listener(&self, listener: Fd<'_>) -> zbus::Result<()>;
|
fn register_listener(&self, listener: Fd<'_>) -> zbus::Result<()>;
|
||||||
|
|
||||||
/// SetUIInfo method
|
/// SetUIInfo method
|
||||||
#[dbus_proxy(name = "SetUIInfo")]
|
#[zbus(name = "SetUIInfo")]
|
||||||
fn set_ui_info(
|
fn set_ui_info(
|
||||||
&self,
|
&self,
|
||||||
width_mm: u16,
|
width_mm: u16,
|
||||||
|
@ -33,19 +33,19 @@ pub trait Console {
|
||||||
height: u32,
|
height: u32,
|
||||||
) -> zbus::Result<()>;
|
) -> zbus::Result<()>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn label(&self) -> zbus::Result<String>;
|
fn label(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn head(&self) -> zbus::Result<u32>;
|
fn head(&self) -> zbus::Result<u32>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn type_(&self) -> zbus::Result<String>;
|
fn type_(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn width(&self) -> zbus::Result<u32>;
|
fn width(&self) -> zbus::Result<u32>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn height(&self) -> zbus::Result<u32>;
|
fn height(&self) -> zbus::Result<u32>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ use derivative::Derivative;
|
||||||
use std::ops::Drop;
|
use std::ops::Drop;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
|
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
|
||||||
use zbus::dbus_interface;
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
|
|
||||||
|
@ -160,7 +159,7 @@ pub(crate) struct ConsoleListener<H: ConsoleListenerHandler> {
|
||||||
handler: H,
|
handler: H,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(name = "org.qemu.Display1.Listener")]
|
#[zbus::interface(name = "org.qemu.Display1.Listener")]
|
||||||
impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
async fn scanout(
|
async fn scanout(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -205,7 +204,7 @@ impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
#[dbus_interface(name = "ScanoutDMABUF")]
|
#[zbus(name = "ScanoutDMABUF")]
|
||||||
async fn scanout_dmabuf(
|
async fn scanout_dmabuf(
|
||||||
&mut self,
|
&mut self,
|
||||||
_fd: Fd<'_>,
|
_fd: Fd<'_>,
|
||||||
|
@ -222,7 +221,7 @@ impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[dbus_interface(name = "ScanoutDMABUF")]
|
#[zbus(name = "ScanoutDMABUF")]
|
||||||
async fn scanout_dmabuf(
|
async fn scanout_dmabuf(
|
||||||
&mut self,
|
&mut self,
|
||||||
fd: Fd<'_>,
|
fd: Fd<'_>,
|
||||||
|
@ -249,7 +248,7 @@ impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
#[dbus_interface(name = "UpdateDMABUF")]
|
#[zbus(name = "UpdateDMABUF")]
|
||||||
async fn update_dmabuf(&mut self, _x: i32, _y: i32, _w: i32, _h: i32) -> zbus::fdo::Result<()> {
|
async fn update_dmabuf(&mut self, _x: i32, _y: i32, _w: i32, _h: i32) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported(
|
Err(zbus::fdo::Error::NotSupported(
|
||||||
"DMABUF is not support on !unix".into(),
|
"DMABUF is not support on !unix".into(),
|
||||||
|
@ -257,7 +256,7 @@ impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[dbus_interface(name = "UpdateDMABUF")]
|
#[zbus(name = "UpdateDMABUF")]
|
||||||
async fn update_dmabuf(&mut self, x: i32, y: i32, w: i32, h: i32) -> zbus::fdo::Result<()> {
|
async fn update_dmabuf(&mut self, x: i32, y: i32, w: i32, h: i32) -> zbus::fdo::Result<()> {
|
||||||
self.handler
|
self.handler
|
||||||
.update_dmabuf(UpdateDMABUF { x, y, w, h })
|
.update_dmabuf(UpdateDMABUF { x, y, w, h })
|
||||||
|
@ -292,7 +291,7 @@ impl<H: ConsoleListenerHandler> ConsoleListener<H> {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(property)]
|
#[zbus(property)]
|
||||||
fn interfaces(&self) -> Vec<String> {
|
fn interfaces(&self) -> Vec<String> {
|
||||||
self.handler.interfaces()
|
self.handler.interfaces()
|
||||||
}
|
}
|
||||||
|
@ -325,7 +324,7 @@ pub(crate) struct ConsoleListenerMap<H: ConsoleListenerMapHandler> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[dbus_interface(name = "org.qemu.Display1.Listener.Win32.Map")]
|
#[zbus::interface(name = "org.qemu.Display1.Listener.Win32.Map")]
|
||||||
impl<H: ConsoleListenerMapHandler> ConsoleListenerMap<H> {
|
impl<H: ConsoleListenerMapHandler> ConsoleListenerMap<H> {
|
||||||
async fn scanout_map(
|
async fn scanout_map(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -377,7 +376,7 @@ pub(crate) struct ConsoleListenerD3d11<H: ConsoleListenerD3d11Handler> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[dbus_interface(name = "org.qemu.Display1.Listener.Win32.D3d11")]
|
#[zbus::interface(name = "org.qemu.Display1.Listener.Win32.D3d11")]
|
||||||
impl<H: ConsoleListenerD3d11Handler> ConsoleListenerD3d11<H> {
|
impl<H: ConsoleListenerD3d11Handler> ConsoleListenerD3d11<H> {
|
||||||
async fn scanout_texture2d(
|
async fn scanout_texture2d(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use enumflags2::{bitflags, BitFlags};
|
use enumflags2::{bitflags, BitFlags};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use zbus::{dbus_proxy, zvariant::Type};
|
use zbus::zvariant::Type;
|
||||||
|
|
||||||
#[bitflags]
|
#[bitflags]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
@ -11,7 +11,7 @@ pub enum KeyboardModifiers {
|
||||||
Caps = 0x4,
|
Caps = 0x4,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Keyboard")]
|
#[zbus::proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Keyboard")]
|
||||||
pub trait Keyboard {
|
pub trait Keyboard {
|
||||||
/// Press method
|
/// Press method
|
||||||
fn press(&self, keycode: u32) -> zbus::Result<()>;
|
fn press(&self, keycode: u32) -> zbus::Result<()>;
|
||||||
|
@ -19,6 +19,6 @@ pub trait Keyboard {
|
||||||
/// Release method
|
/// Release method
|
||||||
fn release(&self, keycode: u32) -> zbus::Result<()>;
|
fn release(&self, keycode: u32) -> zbus::Result<()>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn modifiers(&self) -> zbus::Result<BitFlags<KeyboardModifiers>>;
|
fn modifiers(&self) -> zbus::Result<BitFlags<KeyboardModifiers>>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
use zbus::{dbus_proxy, zvariant::Type};
|
use zbus::zvariant::Type;
|
||||||
|
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Deserialize_repr, Serialize_repr, Type, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
#[derive(Deserialize_repr, Serialize_repr, Type, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
|
@ -13,7 +13,7 @@ pub enum MouseButton {
|
||||||
Extra,
|
Extra,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Mouse")]
|
#[zbus::proxy(default_service = "org.qemu", interface = "org.qemu.Display1.Mouse")]
|
||||||
pub trait Mouse {
|
pub trait Mouse {
|
||||||
/// Press method
|
/// Press method
|
||||||
fn press(&self, button: MouseButton) -> zbus::Result<()>;
|
fn press(&self, button: MouseButton) -> zbus::Result<()>;
|
||||||
|
@ -27,6 +27,6 @@ pub trait Mouse {
|
||||||
/// RelMotion method
|
/// RelMotion method
|
||||||
fn rel_motion(&self, dx: i32, dy: i32) -> zbus::Result<()>;
|
fn rel_motion(&self, dx: i32, dy: i32) -> zbus::Result<()>;
|
||||||
|
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn is_absolute(&self) -> zbus::Result<bool>;
|
fn is_absolute(&self) -> zbus::Result<bool>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ impl DeviceHandler for Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[zbus::dbus_proxy(
|
#[zbus::proxy(
|
||||||
interface = "org.freedesktop.usbredir1",
|
interface = "org.freedesktop.usbredir1",
|
||||||
default_service = "org.freedesktop.usbredir1",
|
default_service = "org.freedesktop.usbredir1",
|
||||||
default_path = "/org/freedesktop/usbredir1"
|
default_path = "/org/freedesktop/usbredir1"
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
use zbus::dbus_proxy;
|
#[zbus::proxy(
|
||||||
|
|
||||||
#[dbus_proxy(
|
|
||||||
default_service = "org.qemu",
|
default_service = "org.qemu",
|
||||||
interface = "org.qemu.Display1.VM",
|
interface = "org.qemu.Display1.VM",
|
||||||
default_path = "/org/qemu/Display1/VM"
|
default_path = "/org/qemu/Display1/VM"
|
||||||
)]
|
)]
|
||||||
pub trait VM {
|
pub trait VM {
|
||||||
/// Name property
|
/// Name property
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn name(&self) -> zbus::Result<String>;
|
fn name(&self) -> zbus::Result<String>;
|
||||||
|
|
||||||
/// UUID property
|
/// UUID property
|
||||||
#[dbus_proxy(property)]
|
#[zbus(property)]
|
||||||
fn uuid(&self) -> zbus::Result<String>;
|
fn uuid(&self) -> zbus::Result<String>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,7 +321,7 @@ impl Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop_console(&self) -> Result<(), Box<dyn Error>> {
|
fn stop_console(&self) -> Result<(), Box<dyn Error>> {
|
||||||
let mut inner = self.inner.lock().unwrap();
|
let inner = self.inner.lock().unwrap();
|
||||||
inner.console.unregister_listener();
|
inner.console.unregister_listener();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue