shithub: drawterm

Download patch

ref: e10ae98365bfd6d4f0cfb67304e32a5f16483f7d
parent: e3a4e2d595c94744e71667c64d4497c9fab9ae0d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 19 19: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	Tue May  9 16:19:58 2017
+++ b/gui-win32/screen.c	Fri May 19 19:27:30 2017
@@ -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	Tue May  9 16:19:58 2017
+++ b/kern/devmouse.c	Fri May 19 19:27:30 2017
@@ -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	Tue May  9 16:19:58 2017
+++ b/kern/screen.h	Fri May 19 19:27:30 2017
@@ -56,4 +56,5 @@
 
 void	terminit(void);
 
+void	mousetrack(int, int, int, ulong);
 void	absmousetrack(int, int, int, ulong);