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