From 222d57862b24511eda733812524df1736cd1f64d Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Mon, 2 Sep 2024 16:52:05 +0300 Subject: [PATCH] fix(windows): fix monitor from_point retunring invalid handle (#971) 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 24853e1f5..e209df746 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