mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
refactor(displaycontrol): make physical_size an Option (#449)
This commit is contained in:
@@ -64,16 +64,15 @@ impl GuiContext {
|
||||
Event::WindowEvent { window_id, event } if window_id == window.id() => match event {
|
||||
WindowEvent::Resized(size) => {
|
||||
let scale_factor = (window.scale_factor() * 100.0) as u32;
|
||||
// TODO: it should be possible to get the physical size here, however winit doesn't make it straightforward.
|
||||
// FreeRDP does it based on DPI reading grabbed via [`SDL_GetDisplayDPI`](https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI):
|
||||
// https://github.com/FreeRDP/FreeRDP/blob/ba8cf8cf2158018fb7abbedb51ab245f369be813/client/SDL/sdl_monitor.cpp#L250-L262
|
||||
let (physical_width, physical_height) = (0, 0);
|
||||
|
||||
let _ = input_event_sender.send(RdpInputEvent::Resize {
|
||||
width: u16::try_from(size.width).unwrap(),
|
||||
height: u16::try_from(size.height).unwrap(),
|
||||
scale_factor,
|
||||
physical_width,
|
||||
physical_height,
|
||||
// TODO: it should be possible to get the physical size here, however winit doesn't make it straightforward.
|
||||
// FreeRDP does it based on DPI reading grabbed via [`SDL_GetDisplayDPI`](https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI):
|
||||
// https://github.com/FreeRDP/FreeRDP/blob/ba8cf8cf2158018fb7abbedb51ab245f369be813/client/SDL/sdl_monitor.cpp#L250-L262
|
||||
physical_size: None,
|
||||
});
|
||||
}
|
||||
WindowEvent::CloseRequested => {
|
||||
|
||||
@@ -34,8 +34,8 @@ pub enum RdpInputEvent {
|
||||
width: u16,
|
||||
height: u16,
|
||||
scale_factor: u32,
|
||||
physical_width: u32,
|
||||
physical_height: u32,
|
||||
/// The physical size of the display in millimeters (width, height).
|
||||
physical_size: Option<(u32, u32)>,
|
||||
},
|
||||
FastPath(SmallVec<[FastPathInputEvent; 2]>),
|
||||
Close,
|
||||
|
||||
Reference in New Issue
Block a user