diff --git a/.changes/linux-workarea-logical-size.md b/.changes/linux-workarea-logical-size.md new file mode 100644 index 000000000..a151910f6 --- /dev/null +++ b/.changes/linux-workarea-logical-size.md @@ -0,0 +1,6 @@ +--- +tauri: patch:bug +tauri-runtime-wry: patch:bug +--- + +Fix `Monitor::work_area` returns logical position and size inside the `PhysicalRect` on Linux diff --git a/crates/tauri-runtime-wry/src/monitor/linux.rs b/crates/tauri-runtime-wry/src/monitor/linux.rs index 6b6a33bce..62f87eb05 100644 --- a/crates/tauri-runtime-wry/src/monitor/linux.rs +++ b/crates/tauri-runtime-wry/src/monitor/linux.rs @@ -4,14 +4,15 @@ use gtk::prelude::MonitorExt; use tao::platform::unix::MonitorHandleExtUnix; -use tauri_runtime::dpi::{PhysicalPosition, PhysicalRect, PhysicalSize}; +use tauri_runtime::dpi::{LogicalPosition, LogicalSize, PhysicalRect}; impl super::MonitorExt for tao::monitor::MonitorHandle { fn work_area(&self) -> PhysicalRect { let rect = self.gdk_monitor().workarea(); + let scale_factor = self.scale_factor(); PhysicalRect { - size: PhysicalSize::new(rect.width() as u32, rect.height() as u32), - position: PhysicalPosition::new(rect.x(), rect.y()), + size: LogicalSize::new(rect.width() as u32, rect.height() as u32).to_physical(scale_factor), + position: LogicalPosition::new(rect.x(), rect.y()).to_physical(scale_factor), } } }