From ae043d524679c581e434f58a6bb2668f10b336cd Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 14 Sep 2015 18:13:52 +0200 Subject: [PATCH] Allow dragging scrollbar. --- source/rofi.c | 8 ++++++++ source/scrollbar.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/rofi.c b/source/rofi.c index 423f1671..627864d8 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -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 ) ) { diff --git a/source/scrollbar.c b/source/scrollbar.c index 0452b1cd..85ad3bb7 100644 --- a/source/scrollbar.c +++ b/source/scrollbar.c @@ -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);