mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-04 23:28:01 +00:00
feat(client): support for hardware cursor (#804)
This commit is contained in:
parent
bca455f158
commit
1236a9be99
3 changed files with 25 additions and 4 deletions
|
@ -13,7 +13,7 @@ use winit::event::{self, WindowEvent};
|
|||
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
|
||||
use winit::keyboard::ModifiersKeyState;
|
||||
use winit::platform::scancode::PhysicalKeyExtScancode;
|
||||
use winit::window::{Window, WindowAttributes};
|
||||
use winit::window::{CursorIcon, CustomCursor, Window, WindowAttributes};
|
||||
|
||||
use crate::rdp::{RdpInputEvent, RdpOutputEvent};
|
||||
|
||||
|
@ -352,6 +352,7 @@ impl ApplicationHandler<RdpOutputEvent> for App {
|
|||
window.set_cursor_visible(false);
|
||||
}
|
||||
RdpOutputEvent::PointerDefault => {
|
||||
window.set_cursor(CursorIcon::default());
|
||||
window.set_cursor_visible(true);
|
||||
}
|
||||
RdpOutputEvent::PointerPosition { x, y } => {
|
||||
|
@ -359,6 +360,20 @@ impl ApplicationHandler<RdpOutputEvent> for App {
|
|||
error!(?error, "Failed to set cursor position");
|
||||
}
|
||||
}
|
||||
RdpOutputEvent::PointerBitmap(pointer) => {
|
||||
debug!(width = ?pointer.width, height = ?pointer.height, "Received pointer bitmap");
|
||||
match CustomCursor::from_rgba(
|
||||
pointer.bitmap_data.clone(),
|
||||
pointer.width,
|
||||
pointer.height,
|
||||
pointer.hotspot_x,
|
||||
pointer.hotspot_y,
|
||||
) {
|
||||
Ok(cursor) => window.set_cursor(event_loop.create_custom_cursor(cursor)),
|
||||
Err(error) => error!(?error, "Failed to set cursor bitmap"),
|
||||
}
|
||||
window.set_cursor_visible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ impl Config {
|
|||
autologon: args.autologon,
|
||||
no_audio_playback: false,
|
||||
request_data: None,
|
||||
pointer_software_rendering: true,
|
||||
pointer_software_rendering: false,
|
||||
performance_flags: PerformanceFlags::default(),
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use ironrdp::cliprdr::backend::{ClipboardMessage, CliprdrBackendFactory};
|
||||
use ironrdp::connector::connection_activation::ConnectionActivationState;
|
||||
use ironrdp::connector::{ConnectionResult, ConnectorResult};
|
||||
use ironrdp::displaycontrol::client::DisplayControlClient;
|
||||
use ironrdp::displaycontrol::pdu::MonitorLayoutEntry;
|
||||
use ironrdp::graphics::image_processing::PixelFormat;
|
||||
use ironrdp::graphics::pointer::DecodedPointer;
|
||||
use ironrdp::pdu::input::fast_path::FastPathInputEvent;
|
||||
use ironrdp::session::image::DecodedImage;
|
||||
use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult};
|
||||
|
@ -28,6 +31,7 @@ pub enum RdpOutputEvent {
|
|||
PointerDefault,
|
||||
PointerHidden,
|
||||
PointerPosition { x: u16, y: u16 },
|
||||
PointerBitmap(Arc<DecodedPointer>),
|
||||
Terminated(SessionResult<GracefulDisconnectReason>),
|
||||
}
|
||||
|
||||
|
@ -509,8 +513,10 @@ async fn active_session(
|
|||
.send_event(RdpOutputEvent::PointerPosition { x, y })
|
||||
.map_err(|e| session::custom_err!("event_loop_proxy", e))?;
|
||||
}
|
||||
ActiveStageOutput::PointerBitmap(_) => {
|
||||
// Not applicable, because we use the software cursor rendering.
|
||||
ActiveStageOutput::PointerBitmap(pointer) => {
|
||||
event_loop_proxy
|
||||
.send_event(RdpOutputEvent::PointerBitmap(pointer))
|
||||
.map_err(|e| session::custom_err!("event_loop_proxy", e))?;
|
||||
}
|
||||
ActiveStageOutput::DeactivateAll(mut connection_activation) => {
|
||||
// Execute the Deactivation-Reactivation Sequence:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue