summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/libpanel
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-06-30 19:49:51 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-06-30 19:49:51 +0200
commit91de9fcd6374cbd7b07929057c41fa46b5040be3 (patch)
treea8d13ff2ccafbbf26e605dceb17c2121094454ce /sys/src/cmd/mothra/libpanel
parentfe0b72e93ce7eb24a8f7cabbb2540af40c1d152f (diff)
mothra: fix scrollbar mouse grab behaviour
by default, scrollbars captured the mouse unless all mouse buttons where released. this makes sense in mothra main window, but makes drop down menus with scrollbar unusable. the patch lets one select the behaviour using the USERFL-flag. if set, the scrollbar will capture the mouse. if not set, scrollbar will release the mouse when outside the scrollbar rect.
Diffstat (limited to 'sys/src/cmd/mothra/libpanel')
-rw-r--r--sys/src/cmd/mothra/libpanel/scrollbar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/src/cmd/mothra/libpanel/scrollbar.c b/sys/src/cmd/mothra/libpanel/scrollbar.c
index 22d2a1883..8515d53ff 100644
--- a/sys/src/cmd/mothra/libpanel/scrollbar.c
+++ b/sys/src/cmd/mothra/libpanel/scrollbar.c
@@ -28,11 +28,10 @@ int pl_hitscrollbar(Panel *g, Mouse *m){
size=subpt(g->r.max, g->r.min);
pl_interior(g->state, &ul, &size);
oldstate=g->state;
- if(m->buttons&OUT && m->buttons&7){
- if(m->xy.y<g->r.min.y) m->xy.y=g->r.min.y;
- if(m->xy.y>=g->r.max.y) m->xy.y=g->r.max.y-1;
- if(ptinrect(m->xy, g->r))
- m->buttons&=~OUT;
+ if(!(g->flags & USERFL) && (m->buttons&OUT || !ptinrect(m->xy, g->r))){
+ m->buttons&=~OUT;
+ g->state=UP;
+ goto out;
}
if(sp->dir==HORIZ){
pos=m->xy.x-ul.x;
@@ -71,6 +70,7 @@ int pl_hitscrollbar(Panel *g, Mouse *m){
pos, len);
g->state=UP;
}
+out:
if(oldstate!=g->state) pldraw(g, g->b);
return g->state==DOWN;
}