mothra: keep scrolling while mouse buttons are down

front
cinap_lenrek 2011-11-14 17:53:16 +01:00
parent ad08f08800
commit 6332fddecd
1 changed files with 17 additions and 19 deletions

View File

@ -46,25 +46,23 @@ int pl_hitscrollbar(Panel *g, Mouse *m){
else if(pos>len) pos=len;
if(m->buttons&7){
g->state=DOWN;
if(g->r.min.x<=m->xy.x && m->xy.x<g->r.max.x){
sp->buttons=m->buttons;
switch(m->buttons){
case 1:
dy=pos*(sp->hi-sp->lo)/len;
pl_sliderupd(g->b, sp->interior, sp->dir, sp->lo-dy,
sp->hi-dy);
break;
case 2:
if(g->scrollee && g->scrollee->scroll)
g->scrollee->scroll(g->scrollee, sp->dir,
m->buttons, pos, len);
break;
case 4:
dy=pos*(sp->hi-sp->lo)/len;
pl_sliderupd(g->b, sp->interior, sp->dir, sp->lo+dy,
sp->hi+dy);
break;
}
sp->buttons=m->buttons;
switch(m->buttons){
case 1:
dy=pos*(sp->hi-sp->lo)/len;
pl_sliderupd(g->b, sp->interior, sp->dir, sp->lo-dy,
sp->hi-dy);
break;
case 2:
if(g->scrollee && g->scrollee->scroll)
g->scrollee->scroll(g->scrollee, sp->dir,
m->buttons, pos, len);
break;
case 4:
dy=pos*(sp->hi-sp->lo)/len;
pl_sliderupd(g->b, sp->interior, sp->dir, sp->lo+dy,
sp->hi+dy);
break;
}
}
else{