shithub: zuke

Download patch

ref: adf3364518a46ee0e55ef0252ebb711170b7bc34
parent: b15a1446254cdc25014575e401e6420df9e4d21f
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Dec 28 19:52:22 EST 2019

make the whole window work as a scroll bar

--- a/zuke.c
+++ b/zuke.c
@@ -698,7 +698,6 @@
 threadmain(int argc, char **argv)
 {
 	char tmp[256];
-	Point lastclick;
 	Rune key;
 	Mouse m;
 	Alt a[] =
@@ -708,7 +707,7 @@
 		{ nil, &key, CHANRCV },
 		{ nil, nil, CHANEND },
 	};
-	int fd, scrolling, oldscroll, oldpcur, oldscrolling, usingscrollbar;
+	int fd, scrolling, oldpcur;
 
 	USED(argc); USED(argv);
 
@@ -739,7 +738,6 @@
 	colb = display->black;
 	srand(time(0));
 	pcurplaying = -1;
-	scrolling = oldscroll = usingscrollbar = 0;
 	fmtinstall('P', positionfmt);
 	threadsetname("zuke");
 
@@ -756,13 +754,7 @@
 
 		switch(alt(a)){
 		case 0:
-			oldscrolling = scrolling;
 			scrolling = m.buttons & 2;
-			if(!oldscrolling && (m.buttons & 2) != 0){
-				usingscrollbar = m.xy.x < screen->r.min.x+Scrollwidth;
-				lastclick = m.xy;
-				oldscroll = scroll;
-			}
 			if(m.buttons == 0)
 				break;
 
@@ -769,10 +761,7 @@
 			if(scrolling){
 				if(scrollsz >= plnum)
 					break;
-				if(usingscrollbar)
-					scroll = (m.xy.y - screen->r.min.y - Scrollheight/4)*(plnum - scrollsz) / (Dy(screen->r)-Scrollheight/2);
-				else
-					scroll = oldscroll + (lastclick.y - m.xy.y) / f->height;
+				scroll = (m.xy.y - screen->r.min.y - Scrollheight/4)*(plnum-scrollsz) / (Dy(screen->r)-Scrollheight/2);
 				if(scroll > plnum-scrollsz-1)
 					scroll = plnum-scrollsz-1;
 				if(scroll < 0)