rio: make scrollwheel handling consistent with sam
scrollwheel now works proportional to y mouse position. special case is when shift is hold down. then scrollwheel will work like before and scroll one line up or down.
This commit is contained in:
parent
536423eba6
commit
f912e01854
2 changed files with 14 additions and 22 deletions
|
@ -153,7 +153,7 @@ wscroll(Window *w, int but)
|
||||||
readmouse(&w->mc);
|
readmouse(&w->mc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(but == 1)
|
if(but == 1 || but == 4)
|
||||||
p0 = wbacknl(w, w->org, (my-s.min.y)/w->font->height);
|
p0 = wbacknl(w, w->org, (my-s.min.y)/w->font->height);
|
||||||
else
|
else
|
||||||
p0 = w->org+frcharofpt(w, Pt(s.max.x, my));
|
p0 = w->org+frcharofpt(w, Pt(s.max.x, my));
|
||||||
|
@ -163,6 +163,8 @@ wscroll(Window *w, int but)
|
||||||
/* debounce */
|
/* debounce */
|
||||||
if(first){
|
if(first){
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
|
if(but > 3)
|
||||||
|
return;
|
||||||
sleep(200);
|
sleep(200);
|
||||||
nbrecv(w->mc.c, &w->mc.Mouse);
|
nbrecv(w->mc.c, &w->mc.Mouse);
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
|
|
|
@ -900,32 +900,22 @@ wmousectl(Window *w)
|
||||||
{
|
{
|
||||||
int but;
|
int but;
|
||||||
|
|
||||||
if(w->mc.buttons == 1)
|
for(but=1;; but++){
|
||||||
but = 1;
|
if(but > 5)
|
||||||
else if(w->mc.buttons == 2)
|
return;
|
||||||
but = 2;
|
if(w->mc.buttons == 1<<(but-1))
|
||||||
else if(w->mc.buttons == 4)
|
break;
|
||||||
but = 3;
|
|
||||||
else{
|
|
||||||
if(w->mc.buttons == 8)
|
|
||||||
wkeyctl(w, Kscrolloneup);
|
|
||||||
if(w->mc.buttons == 16)
|
|
||||||
wkeyctl(w, Kscrollonedown);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
incref(w); /* hold up window while we track */
|
incref(w); /* hold up window while we track */
|
||||||
if(w->i==nil)
|
if(w->i != nil){
|
||||||
goto Return;
|
if(shiftdown && but > 3)
|
||||||
if(ptinrect(w->mc.xy, w->scrollr)){
|
wkeyctl(w, but == 4 ? Kscrolloneup : Kscrollonedown);
|
||||||
if(but)
|
else if(ptinrect(w->mc.xy, w->scrollr) || (but > 3))
|
||||||
wscroll(w, but);
|
wscroll(w, but);
|
||||||
goto Return;
|
else if(but == 1)
|
||||||
|
wselect(w);
|
||||||
}
|
}
|
||||||
if(but == 1)
|
|
||||||
wselect(w);
|
|
||||||
/* else all is handled by main process */
|
|
||||||
Return:
|
|
||||||
wclose(w);
|
wclose(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue