summaryrefslogtreecommitdiff
path: root/sys/src/cmd/samterm/scroll.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-08-05 00:25:40 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-08-05 00:25:40 +0200
commit1df707a0b2aaddb750fb707ae413dc67a19027a3 (patch)
tree1ced2c77d885e8c8f323c465c998d8083551d21a /sys/src/cmd/samterm/scroll.c
parentcdc0b89d816aab6322e04f715019a7f8da2f2b75 (diff)
unsticky scrollbars
scrollbars used to put the mouse on the scrollbar while scrolling. if latency is high, this often results to the cursor jumping back. instead, make button 2 srolling work without needing the mouse to be inside the scrollbar and leave the mouse position alone.
Diffstat (limited to 'sys/src/cmd/samterm/scroll.c')
-rw-r--r--sys/src/cmd/samterm/scroll.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/src/cmd/samterm/scroll.c b/sys/src/cmd/samterm/scroll.c
index 105944b1b..d40ab688f 100644
--- a/sys/src/cmd/samterm/scroll.c
+++ b/sys/src/cmd/samterm/scroll.c
@@ -120,10 +120,10 @@ scroll(Flayer *l, int but)
draw(scrback, Rect(0,0,Dx(l->scroll), Dy(l->scroll)), l->f.b, nil, l->scroll.min);
do{
oin = in;
- in = abs(x-mousep->xy.x)<=FLSCROLLWID/2;
+ in = (but > 3) || (but == 2) || abs(x-mousep->xy.x)<=FLSCROLLWID/2;
if(oin && !in)
scrunmark(l, r);
- if(but > 3 || in){
+ if(in){
scrmark(l, r);
oy = y;
my = mousep->xy.y;
@@ -131,8 +131,6 @@ scroll(Flayer *l, int but)
my = s.min.y;
if(my >= s.max.y)
my = s.max.y;
- if(in && !eqpt(mousep->xy, Pt(x, my)))
- moveto(mousectl, Pt(x, my));
if(but == 1 || but == 4){
p0 = l->origin-frcharofpt(&l->f, Pt(s.max.x, my));
rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
@@ -153,7 +151,7 @@ scroll(Flayer *l, int but)
}
}
}while(but <= 3 && button(but));
- if(but > 3 || in){
+ if(in){
h = s.max.y-s.min.y;
scrunmark(l, r);
p0 = 0;