From 38940f154961fe5e9b2f6e6294fb7aac47470c19 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 2 Sep 2024 16:43:04 +0300 Subject: [PATCH] fix(windows): fix monitor from_point retunring invalid handle closes tauri-apps/plugins-workspace#1714 --- .changes/fix-monitor-from-point-handle.md | 5 +++++ src/platform_impl/windows/monitor.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-monitor-from-point-handle.md diff --git a/.changes/fix-monitor-from-point-handle.md b/.changes/fix-monitor-from-point-handle.md new file mode 100644 index 000000000..d65054728 --- /dev/null +++ b/.changes/fix-monitor-from-point-handle.md @@ -0,0 +1,5 @@ +--- +"tao": patch +--- + +On Windows, fix `Window::monitor_from_point` and `EventLoopTargetWindow::monitor_from_point` returning invalid monitor handle. diff --git a/src/platform_impl/windows/monitor.rs b/src/platform_impl/windows/monitor.rs index 0c2e7e334..7a7eef86a 100644 --- a/src/platform_impl/windows/monitor.rs +++ b/src/platform_impl/windows/monitor.rs @@ -133,7 +133,7 @@ pub fn from_point(x: f64, y: f64) -> Option { MONITOR_DEFAULTTONULL, ) }; - if hmonitor.is_invalid() { + if !hmonitor.is_invalid() { Some(MonitorHandle::new(hmonitor)) } else { None