shithub: drawterm

Download patch

ref: ee4b58548e0df76a402c09ffcf0964d0e6cddbfa
parent: 969f1e1ceb07a5ce0b45802fc6513ba2d67f1c0b
author: 23hiro <23hiro@gmail.com>
date: Sat Feb 20 13:45:27 EST 2016

win32: fix scrolling, add pageup/down/home/end keys

--- a/gui-win32/screen.c	Fri Feb 19 13:13:08 2016
+++ b/gui-win32/screen.c	Sat Feb 20 13:45:27 2016
@@ -330,6 +330,8 @@
 	int i;
 	Rectangle r;
 
+	b = 0;
+
 	switch(msg) {
 	case WM_CREATE:
 		break;
@@ -342,9 +344,10 @@
 		return DefWindowProc(hwnd, msg, wparam, lparam);
 	case WM_MOUSEWHEEL:
 		if ((int)(wparam & 0xFFFF0000)>0)
-			b|=8;
+			b |=8;
 		else
-			b|=16;
+			b |=16;
+		// fallthrough
 	case WM_MOUSEMOVE:
 	case WM_LBUTTONUP:
 	case WM_MBUTTONUP:
@@ -354,9 +357,8 @@
 	case WM_RBUTTONDOWN:
 		x = LOWORD(lparam);
 		y = HIWORD(lparam);
-		b = 0;
 		if(wparam & MK_LBUTTON)
-			b = 1;
+			b |= 1;
 		if(wparam & MK_MBUTTON)
 			b |= 2;
 		if(wparam & MK_RBUTTON) {
@@ -428,6 +430,18 @@
 			break;
 		case VK_RIGHT:
 			kbdputc(kbdq, Kright);
+			break;
+		case VK_HOME:
+			kbdputc(kbdq, Khome);
+			break;
+		case VK_END:
+			kbdputc(kbdq, Kend);
+			break;
+		case VK_PRIOR:
+			kbdputc(kbdq, Kpgup);
+			break;
+		case VK_NEXT:
+			kbdputc(kbdq, Kpgdown);
 			break;
 		}
 		break;