1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

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>
This commit is contained in:
Quentin Glidic 2017-05-30 12:44:41 +02:00
parent 823a45f711
commit 0555d15c46
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7
2 changed files with 17 additions and 9 deletions

View file

@ -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;
}

View file

@ -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 )
{