Skip to content

Commit b582557

Browse files
committed
fix(linux): work area returns logical rect
1 parent 91becd9 commit b582557

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tauri: patch:bug
3+
tauri-runtime-wry: patch:bug
4+
---
5+
6+
Fix `Monitor::work_area` returns logical position and size inside the `PhysicalRect` on Linux

crates/tauri-runtime-wry/src/monitor/linux.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
use gtk::prelude::MonitorExt;
66
use tao::platform::unix::MonitorHandleExtUnix;
7-
use tauri_runtime::dpi::{PhysicalPosition, PhysicalRect, PhysicalSize};
7+
use tauri_runtime::dpi::{LogicalPosition, LogicalSize, PhysicalRect};
88

99
impl super::MonitorExt for tao::monitor::MonitorHandle {
1010
fn work_area(&self) -> PhysicalRect<i32, u32> {
1111
let rect = self.gdk_monitor().workarea();
12+
let scale_factor = self.scale_factor();
1213
PhysicalRect {
13-
size: PhysicalSize::new(rect.width() as u32, rect.height() as u32),
14-
position: PhysicalPosition::new(rect.x(), rect.y()),
14+
size: LogicalSize::new(rect.width() as u32, rect.height() as u32).to_physical(scale_factor),
15+
position: LogicalPosition::new(rect.x(), rect.y()).to_physical(scale_factor),
1516
}
1617
}
1718
}

0 commit comments

Comments
 (0)