diff options
author | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-05-30 12:44:41 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-05-30 13:45:19 +0200 |
commit | 0555d15c469d0dffbbfc33f351f4eed5882b3370 (patch) | |
tree | 8b65446f32211d9e773f8da52525e905fc7964a4 /source | |
parent | 823a45f711b4d999bbf7cebf4fbcb5113b35b000 (diff) |
scrollbar: Make it scroll again
On click for now, will add motion grab in the following commit
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'source')
-rw-r--r-- | source/widgets/scrollbar.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index f7d54877..1dc1ad3c 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -28,6 +28,8 @@ #include <config.h> #include <xkbcommon/xkbcommon.h> #include <glib.h> +#include "widgets/textbox.h" +#include "widgets/listview.h" #include "widgets/scrollbar.h" #include "x11-helper.h" @@ -68,6 +70,11 @@ guint scrollbar_scroll_get_line ( const scrollbar *sb, int y ) return MIN ( sel, sb->length - 1 ); } +static void scrollbar_scroll ( scrollbar *sb, int y ) +{ + listview_set_selected ( (listview *) sb->widget.parent, scrollbar_scroll_get_line ( sb, y ) ); +} + static gboolean scrollbar_trigger_action ( widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, gint y, G_GNUC_UNUSED void *user_data ) { scrollbar *sb = (scrollbar *) wid; @@ -76,9 +83,7 @@ static gboolean scrollbar_trigger_action ( widget *wid, MouseBindingMouseDefault case MOUSE_CLICK_DOWN: return TRUE; case MOUSE_CLICK_UP: - /* FIXME: scoll - scrollbar_scroll(sb, y); - */ + scrollbar_scroll ( sb, y ); return TRUE; case MOUSE_DCLICK_DOWN: case MOUSE_DCLICK_UP: @@ -89,10 +94,8 @@ static gboolean scrollbar_trigger_action ( widget *wid, MouseBindingMouseDefault static gboolean scrollbar_motion_notify ( widget *wid, G_GNUC_UNUSED gint x, gint y ) { - /* FIXME: scoll - scrollbar *sb = (scrollbar *) wid; - scrollbar_scroll(sb, xme->event_y); - */ + scrollbar *sb = (scrollbar *) wid; + scrollbar_scroll ( sb, y ); return TRUE; } |