Allow dragging scrollbar.

This commit is contained in:
Dave Davenport 2015-09-14 18:13:52 +02:00
parent 6a8a367cbd
commit ae043d5246
2 changed files with 9 additions and 1 deletions

View File

@ -1190,6 +1190,14 @@ MenuReturn menu ( Switcher *sw, char **input, char *prompt,
}
state.update = TRUE;
}
else if ( ev.type == MotionNotify ) {
while ( XCheckTypedEvent ( display, MotionNotify, &ev ) ) {
;
}
XMotionEvent xme = ev.xmotion;
state.selected = scrollbar_clicked ( state.scrollbar, xme.y );
state.update = TRUE;
}
// Button press event.
else if ( ev.type == ButtonPress ) {
while ( XCheckTypedEvent ( display, ButtonPress, &ev ) ) {

View File

@ -59,7 +59,7 @@ scrollbar *scrollbar_create ( Window parent, XVisualInfo *vinfo, Colormap map,
sb->window = XCreateWindow ( display, sb->parent, sb->x, sb->y, sb->w, sb->h, 0, vinfo->depth,
InputOutput, vinfo->visual, CWColormap | CWBorderPixel | CWBackPixel, &attr );
XSelectInput ( display, sb->window, ExposureMask | ButtonPressMask );
XSelectInput ( display, sb->window, ExposureMask | ButtonPressMask | Button1MotionMask );
sb->gc = XCreateGC ( display, sb->window, 0, 0 );
XSetForeground ( display, sb->gc, color_separator ( display ) );
//XSetFillStyle ( display, sb->gc, FillSolid);