mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2025-01-30 15:25:15 +00:00
qemu-display: Add a MultiTouch interface implementation
This commit is contained in:
parent
912d39dc20
commit
504611a853
@ -9,7 +9,10 @@ use uds_windows::UnixStream;
|
||||
use zbus::zvariant::Fd;
|
||||
use zbus::{zvariant::ObjectPath, Connection};
|
||||
|
||||
use crate::{util, ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, Result};
|
||||
use crate::{
|
||||
util, ConsoleListener, ConsoleListenerHandler, KeyboardProxy, MouseProxy, MultiTouchProxy,
|
||||
Result,
|
||||
};
|
||||
#[cfg(windows)]
|
||||
use crate::{
|
||||
ConsoleListenerD3d11, ConsoleListenerD3d11Handler, ConsoleListenerMap,
|
||||
@ -58,6 +61,8 @@ pub struct Console {
|
||||
pub keyboard: KeyboardProxy<'static>,
|
||||
#[derivative(Debug = "ignore")]
|
||||
pub mouse: MouseProxy<'static>,
|
||||
#[derivative(Debug = "ignore")]
|
||||
pub multi_touch: MultiTouchProxy<'static>,
|
||||
listener: RwLock<Option<Connection>>,
|
||||
#[cfg(windows)]
|
||||
peer_pid: u32,
|
||||
@ -72,10 +77,15 @@ impl Console {
|
||||
.build()
|
||||
.await?;
|
||||
let mouse = MouseProxy::builder(conn).path(&obj_path)?.build().await?;
|
||||
let multi_touch = MultiTouchProxy::builder(conn)
|
||||
.path(&obj_path)?
|
||||
.build()
|
||||
.await?;
|
||||
Ok(Self {
|
||||
proxy,
|
||||
keyboard,
|
||||
mouse,
|
||||
multi_touch,
|
||||
listener: RwLock::new(None),
|
||||
#[cfg(windows)]
|
||||
peer_pid,
|
||||
|
@ -36,6 +36,9 @@ pub use mouse::*;
|
||||
mod display;
|
||||
pub use display::*;
|
||||
|
||||
mod multi_touch;
|
||||
pub use multi_touch::*;
|
||||
|
||||
#[cfg(unix)]
|
||||
mod usbredir;
|
||||
#[cfg(unix)]
|
||||
|
22
qemu-display/src/multi_touch.rs
Normal file
22
qemu-display/src/multi_touch.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(Type, Debug, PartialEq, Copy, Clone, Eq, Serialize, Deserialize)]
|
||||
pub enum TouchEventKind {
|
||||
Begin = 0,
|
||||
Update = 1,
|
||||
End = 2,
|
||||
Cancel = 3,
|
||||
}
|
||||
|
||||
#[zbus::proxy(
|
||||
default_service = "org.qemu",
|
||||
interface = "org.qemu.Display1.MultiTouch"
|
||||
)]
|
||||
pub trait MultiTouch {
|
||||
fn send_event(&self, kind: TouchEventKind, num_slot: u64, x: f64, y: f64) -> zbus::Result<()>;
|
||||
|
||||
#[dbus_proxy(property)]
|
||||
fn max_slots(&self) -> zbus::Result<i32>;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user