summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-18 20:45:36 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-18 20:45:36 +0200
commit2d59f81467ab8ad1e646aa15ec993d00b495b819 (patch)
tree532af3b554a35b6169ee5d1ba6b837c20b4fc405
parent97ef791009c961212c64729c29a47f1e6e0ac8d7 (diff)
added mousewheel handling to volumebar
-rw-r--r--callbacks.c26
-rw-r--r--callbacks.h5
-rw-r--r--deadbeef.glade1
-rw-r--r--interface.c3
4 files changed, 35 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;
+}
+
diff --git a/callbacks.h b/callbacks.h
index ccf0e0d2..3a5a2fca 100644
--- a/callbacks.h
+++ b/callbacks.h
@@ -477,3 +477,8 @@ gboolean
on_addprogress_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
+
+gboolean
+on_volumebar_scroll_event (GtkWidget *widget,
+ GdkEventScroll *event,
+ gpointer user_data);
diff --git a/deadbeef.glade b/deadbeef.glade
index fd3d153e..f0abac40 100644
--- a/deadbeef.glade
+++ b/deadbeef.glade
@@ -487,6 +487,7 @@
<signal name="configure_event" handler="on_volumebar_configure_event" last_modification_time="Tue, 11 Aug 2009 18:57:55 GMT"/>
<signal name="expose_event" handler="on_volumebar_expose_event" last_modification_time="Tue, 11 Aug 2009 18:58:00 GMT"/>
<signal name="motion_notify_event" handler="on_volumebar_motion_notify_event" last_modification_time="Tue, 11 Aug 2009 18:58:05 GMT"/>
+ <signal name="scroll_event" handler="on_volumebar_scroll_event" last_modification_time="Tue, 18 Aug 2009 18:44:31 GMT"/>
</widget>
<packing>
<property name="padding">2</property>
diff --git a/interface.c b/interface.c
index 0ec60777..4aa51781 100644
--- a/interface.c
+++ b/interface.c
@@ -441,6 +441,9 @@ create_mainwin (void)
g_signal_connect ((gpointer) volumebar, "motion_notify_event",
G_CALLBACK (on_volumebar_motion_notify_event),
NULL);
+ g_signal_connect ((gpointer) volumebar, "scroll_event",
+ G_CALLBACK (on_volumebar_scroll_event),
+ NULL);
g_signal_connect ((gpointer) seekbar, "button_press_event",
G_CALLBACK (on_seekbar_button_press_event),
NULL);