|
2 | 2 | // SPDX-License-Identifier: Apache-2.0
|
3 | 3 | // SPDX-License-Identifier: MIT
|
4 | 4 |
|
5 |
| -use tauri_runtime::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalRect}; |
| 5 | +use tauri_runtime::dpi::{LogicalSize, PhysicalRect}; |
6 | 6 |
|
7 | 7 | impl super::MonitorExt for tao::monitor::MonitorHandle {
|
8 | 8 | fn work_area(&self) -> PhysicalRect<i32, u32> {
|
9 | 9 | use objc2_app_kit::NSScreen;
|
10 | 10 | use tao::platform::macos::MonitorHandleExtMacOS;
|
11 | 11 | if let Some(ns_screen) = self.ns_screen() {
|
12 | 12 | let ns_screen: &NSScreen = unsafe { &*ns_screen.cast() };
|
13 |
| - let rect = ns_screen.visibleFrame(); |
| 13 | + let screen_frame = ns_screen.frame(); |
| 14 | + let visible_frame = ns_screen.visibleFrame(); |
| 15 | + |
14 | 16 | let scale_factor = self.scale_factor();
|
| 17 | + |
| 18 | + let mut position = self.position().to_logical::<f64>(scale_factor); |
| 19 | + |
| 20 | + position.x += visible_frame.origin.x - screen_frame.origin.x; |
| 21 | + position.y -= visible_frame.origin.y - screen_frame.origin.y; |
| 22 | + |
15 | 23 | PhysicalRect {
|
16 |
| - size: LogicalSize::new(rect.size.width, rect.size.height).to_physical(scale_factor), |
17 |
| - position: LogicalPosition::new(rect.origin.x, rect.origin.y).to_physical(scale_factor), |
| 24 | + size: LogicalSize::new(visible_frame.size.width, visible_frame.size.height) |
| 25 | + .to_physical(scale_factor), |
| 26 | + position: position.to_physical(scale_factor), |
18 | 27 | }
|
19 | 28 | } else {
|
20 | 29 | PhysicalRect {
|
|
0 commit comments