shithub: drawterm

Download patch

ref: e10ae98365bfd6d4f0cfb67304e32a5f16483f7d
parent: e3a4e2d595c94744e71667c64d4497c9fab9ae0d
author: cinap_lenrek <[email protected]>
date: Fri May 19 21:27:30 EDT 2017

gui-win32: fix WM_SCROLLWHEEL mouse position

the lParam for WM_SCROLLWHEEL is in *SCREEN* coordinates while
WM_MOUSEMOVE uses window coordinates, so just ignore lParam for
WM_SCROLLWHEEL and use call mousetrack() with zero delta.

--- a/gui-win32/screen.c
+++ b/gui-win32/screen.c
@@ -364,7 +364,8 @@
 			b |=8;
 		else
 			b |=16;
-		// fallthrough
+		mousetrack(0, 0, b, ticks());
+		break;
 	case WM_MOUSEMOVE:
 	case WM_LBUTTONUP:
 	case WM_MBUTTONUP:
--- a/kern/devmouse.c
+++ b/kern/devmouse.c
@@ -312,6 +312,12 @@
 }
 
 void
+mousetrack(int dx, int dy, int b, ulong msec)
+{
+	absmousetrack(mouse.state.xy.x + dx, mouse.state.xy.y + dy, b, msec);
+}
+
+void
 absmousetrack(int x, int y, int b, ulong msec)
 {
 	int lastb;
--- a/kern/screen.h
+++ b/kern/screen.h
@@ -56,4 +56,5 @@
 
 void	terminit(void);
 
+void	mousetrack(int, int, int, ulong);
 void	absmousetrack(int, int, int, ulong);