summaryrefslogtreecommitdiff
path: root/sys/src/cmd/abaco/scrl.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/abaco/scrl.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/abaco/scrl.c')
-rw-r--r--sys/src/cmd/abaco/scrl.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/sys/src/cmd/abaco/scrl.c b/sys/src/cmd/abaco/scrl.c
index 3b7072f97..3651b8363 100644
--- a/sys/src/cmd/abaco/scrl.c
+++ b/sys/src/cmd/abaco/scrl.c
@@ -108,11 +108,10 @@ textscroll(Text *t, int but)
{
uint p0, oldp0;
Rectangle s;
- int x, y, my, h, first;
+ int y, my, h, first;
s = insetrect(t->scrollr, 1);
h = s.max.y-s.min.y;
- x = (s.min.x+s.max.x)/2;
oldp0 = ~0;
first = TRUE;
do{
@@ -122,10 +121,6 @@ textscroll(Text *t, int but)
my = s.min.y;
if(my >= s.max.y)
my = s.max.y;
- if(!eqpt(mouse->xy, Pt(x, my))){
- moveto(mousectl, Pt(x, my));
- readmouse(mousectl); /* absorb event generated by moveto() */
- }
if(but == 2){
y = my;
p0 = (vlong)t->rs.nr*(y-s.min.y)/h;
@@ -240,10 +235,12 @@ pagescroll(Page *p, int but, int horizontal)
else
m = mouse->xy.y;
- if(m > om)
- m += (m-om)*Panspeed;
- else if(m < om)
- m -= (om-m)*Panspeed;
+ if(but != 2){
+ if(m > om)
+ m += (m-om)*Panspeed;
+ else if(m < om)
+ m -= (om-m)*Panspeed;
+ }
if(m < smin)
m = smin;
@@ -255,10 +252,6 @@ pagescroll(Page *p, int but, int horizontal)
mxy = Pt(m, i);
else
mxy = Pt(i, m);
- if(!eqpt(mouse->xy, mxy)){
- moveto(mousectl, mxy);
- readmouse(mousectl); /* absorb event generated by moveto() */
- }
if(but == 2){
p0 = muldiv(m-smin, size, ss);
p0 = max(p0, 0);