From d138cfaccf65f2b5d95ff965efe848c1190ef806 Mon Sep 17 00:00:00 2001 From: Micah Johnston Date: Sun, 20 Dec 2020 15:33:52 -0600 Subject: [PATCH] treat WM_MOUSEMOVE coordinates as i16 to handle negative coordinates properly --- src/win/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index 9738c9a..a9afbe4 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -71,8 +71,8 @@ unsafe extern "system" fn wnd_proc( match msg { WM_MOUSEMOVE => { - let x = (lparam & 0xFFFF) as i32; - let y = ((lparam >> 16) & 0xFFFF) as i32; + let x = (lparam & 0xFFFF) as i16 as i32; + let y = ((lparam >> 16) & 0xFFFF) as i16 as i32; let physical_pos = PhyPoint { x, y };