diff options
-rw-r--r-- | source/widgets/scrollbar.c | 17 | ||||
-rw-r--r-- | test/scrollbar-test.c | 9 |
2 files changed, 17 insertions, 9 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; } diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c index bd3881f0..c9fdc140 100644 --- a/test/scrollbar-test.c +++ b/test/scrollbar-test.c @@ -33,6 +33,8 @@ #include <glib.h> #include <string.h> #include <widgets/scrollbar.h> +#include <widgets/textbox.h> +#include <widgets/listview.h> #include <widgets/widget.h> #include <widgets/widget-internal.h> #include "rofi.h" @@ -67,12 +69,15 @@ char * rofi_expand_path ( G_GNUC_UNUSED const char *path ) { return NULL; } -int textbox_get_estimated_char_height ( void ); -int textbox_get_estimated_char_height ( void ) +double textbox_get_estimated_char_height ( void ) { return 16; } +void listview_set_selected ( G_GNUC_UNUSED listview *lv, G_GNUC_UNUSED unsigned int selected ) +{ + +} void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height ) { |