diff options
author | waker <wakeroid@gmail.com> | 2009-08-18 20:45:36 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2009-08-18 20:45:36 +0200 |
commit | 2d59f81467ab8ad1e646aa15ec993d00b495b819 (patch) | |
tree | 532af3b554a35b6169ee5d1ba6b837c20b4fc405 /callbacks.c | |
parent | 97ef791009c961212c64729c29a47f1e6e0ac8d7 (diff) |
added mousewheel handling to volumebar
Diffstat (limited to 'callbacks.c')
-rw-r--r-- | callbacks.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/callbacks.c b/callbacks.c index c0b51d47..7aa2608a 100644 --- a/callbacks.c +++ b/callbacks.c @@ -1101,3 +1101,29 @@ on_mainwin_delete_event (GtkWidget *widget, + +gboolean +on_volumebar_scroll_event (GtkWidget *widget, + GdkEventScroll *event, + gpointer user_data) +{ + float vol = p_get_volume (); + if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_RIGHT) { + vol += 0.1f; + } + else if (event->direction == GDK_SCROLL_DOWN || event->direction == GDK_SCROLL_LEFT) { + vol -= 0.1f; + } + if (vol < 0) { + vol = 0; + } + else if (vol > 1) { + vol = 1; + } + p_set_volume (vol); + GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); + volumebar_draw (volumebar); + volumebar_expose (volumebar, 0, 0, volumebar->allocation.width, volumebar->allocation.height); + return FALSE; +} + |