changeset 3724:9a8e54ffdd76

prevent info text being stuck after changing volume
author Tomasz Mon <desowin@gmail.com>
date Fri, 12 Oct 2007 14:26:02 +0200
parents d4794783f2ee
children b0f65f70467d
files src/audacious/ui_main.c src/audacious/ui_skinned_horizontal_slider.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Fri Oct 12 09:42:14 2007 +0300
+++ b/src/audacious/ui_main.c	Fri Oct 12 14:26:02 2007 +0200
@@ -163,6 +163,7 @@
 static gint mainwin_timeout_id;
 
 static gboolean mainwin_info_text_locked = FALSE;
+static guint mainwin_volume_release_timeout = 0;
 
 static int ab_position_a = -1;
 static int ab_position_b = -1;
@@ -1604,10 +1605,11 @@
     equalizerwin_set_volume_slider(vol);
 }
 
-void
+gboolean
 mainwin_volume_release_cb(GtkWidget *widget, gint pos)
 {
     mainwin_adjust_volume_release();
+    return FALSE;
 }
 
 gint
@@ -1643,6 +1645,10 @@
     setting_volume = FALSE;
     mainwin_set_volume_slider(vol);
     equalizerwin_set_volume_slider(vol);
+
+    if (mainwin_volume_release_timeout)
+       g_source_remove(mainwin_volume_release_timeout);
+    mainwin_volume_release_timeout = g_timeout_add(700, (GSourceFunc)(mainwin_volume_release_cb), NULL);
 }
 
 void
--- a/src/audacious/ui_skinned_horizontal_slider.c	Fri Oct 12 09:42:14 2007 +0300
+++ b/src/audacious/ui_skinned_horizontal_slider.c	Fri Oct 12 14:26:02 2007 +0200
@@ -311,6 +311,11 @@
             g_signal_emit_by_name(widget, "motion", priv->position);
             gtk_widget_queue_draw(widget);
         } else if (event->button == 3) {
+            if (hs->pressed) {
+                hs->pressed = FALSE;
+                g_signal_emit_by_name(widget, "release", priv->position);
+                gtk_widget_queue_draw(widget);
+            }
             event->x = event->x + hs->x;
             event->y = event->y + hs->y;
             return FALSE;
@@ -323,7 +328,7 @@
     UiSkinnedHorizontalSlider *hs = UI_SKINNED_HORIZONTAL_SLIDER(widget);
     UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(widget);
 
-    if (event->button == 1) {
+    if (hs->pressed) {
         hs->pressed = FALSE;
         g_signal_emit_by_name(widget, "release", priv->position);
         gtk_widget_queue_draw(widget);