mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-20 07:53:19 +03:00
add debug information to xdgrdp backend
This commit is contained in:
@@ -8,7 +8,7 @@ use ashpd::{
|
|||||||
};
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use crate::consumer::EventConsumer;
|
use crate::{consumer::EventConsumer, event::{Event::{Keyboard, Pointer}, PointerEvent, KeyboardEvent}, client::ClientEvent};
|
||||||
|
|
||||||
pub struct DesktopPortalConsumer<'a> {
|
pub struct DesktopPortalConsumer<'a> {
|
||||||
proxy: RemoteDesktop<'a>,
|
proxy: RemoteDesktop<'a>,
|
||||||
@@ -17,8 +17,11 @@ pub struct DesktopPortalConsumer<'a> {
|
|||||||
|
|
||||||
impl<'a> DesktopPortalConsumer<'a> {
|
impl<'a> DesktopPortalConsumer<'a> {
|
||||||
pub async fn new() -> Result<DesktopPortalConsumer<'a>> {
|
pub async fn new() -> Result<DesktopPortalConsumer<'a>> {
|
||||||
|
log::debug!("connecting to org.freedesktop.portal.RemoteDesktop portal ...");
|
||||||
let proxy = RemoteDesktop::new().await?;
|
let proxy = RemoteDesktop::new().await?;
|
||||||
|
log::debug!("creating session ...");
|
||||||
let session = proxy.create_session().await?;
|
let session = proxy.create_session().await?;
|
||||||
|
log::debug!("selecting devices ...");
|
||||||
proxy
|
proxy
|
||||||
.select_devices(&session, DeviceType::Keyboard | DeviceType::Pointer)
|
.select_devices(&session, DeviceType::Keyboard | DeviceType::Pointer)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -27,6 +30,7 @@ impl<'a> DesktopPortalConsumer<'a> {
|
|||||||
.start(&session, &WindowIdentifier::default())
|
.start(&session, &WindowIdentifier::default())
|
||||||
.await?
|
.await?
|
||||||
.response()?;
|
.response()?;
|
||||||
|
log::debug!("started session");
|
||||||
|
|
||||||
Ok(Self { proxy, session })
|
Ok(Self { proxy, session })
|
||||||
}
|
}
|
||||||
@@ -36,9 +40,9 @@ impl<'a> DesktopPortalConsumer<'a> {
|
|||||||
impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
||||||
async fn consume(&mut self, event: crate::event::Event, _client: crate::client::ClientHandle) {
|
async fn consume(&mut self, event: crate::event::Event, _client: crate::client::ClientHandle) {
|
||||||
match event {
|
match event {
|
||||||
crate::event::Event::Pointer(p) => {
|
Pointer(p) => {
|
||||||
match p {
|
match p {
|
||||||
crate::event::PointerEvent::Motion {
|
PointerEvent::Motion {
|
||||||
time: _,
|
time: _,
|
||||||
relative_x,
|
relative_x,
|
||||||
relative_y,
|
relative_y,
|
||||||
@@ -51,7 +55,7 @@ impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
|||||||
log::warn!("{e}");
|
log::warn!("{e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crate::event::PointerEvent::Button {
|
PointerEvent::Button {
|
||||||
time: _,
|
time: _,
|
||||||
button,
|
button,
|
||||||
state,
|
state,
|
||||||
@@ -68,7 +72,7 @@ impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
|||||||
log::warn!("{e}");
|
log::warn!("{e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crate::event::PointerEvent::Axis {
|
PointerEvent::Axis {
|
||||||
time: _,
|
time: _,
|
||||||
axis,
|
axis,
|
||||||
value,
|
value,
|
||||||
@@ -86,12 +90,12 @@ impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
|||||||
log::warn!("{e}");
|
log::warn!("{e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crate::event::PointerEvent::Frame {} => {}
|
PointerEvent::Frame {} => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crate::event::Event::Keyboard(k) => {
|
Keyboard(k) => {
|
||||||
match k {
|
match k {
|
||||||
crate::event::KeyboardEvent::Key {
|
KeyboardEvent::Key {
|
||||||
time: _,
|
time: _,
|
||||||
key,
|
key,
|
||||||
state,
|
state,
|
||||||
@@ -108,7 +112,7 @@ impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
|||||||
log::warn!("{e}");
|
log::warn!("{e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crate::event::KeyboardEvent::Modifiers { .. } => {
|
KeyboardEvent::Modifiers { .. } => {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,7 +121,7 @@ impl<'a> EventConsumer for DesktopPortalConsumer<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn notify(&mut self, _client: crate::client::ClientEvent) {}
|
async fn notify(&mut self, _client: ClientEvent) {}
|
||||||
|
|
||||||
async fn destroy(&mut self) {
|
async fn destroy(&mut self) {
|
||||||
log::debug!("closing remote desktop session");
|
log::debug!("closing remote desktop session");
|
||||||
|
|||||||
Reference in New Issue
Block a user