Hi all,

Just another small bug fixed on lxmusic which got annoying. Scrolling on the
volume icon effected an jump over of the volume level from 0% to 100% which
was rather a ear shock every now and then :-) This patch will fix it.

Greets,
Manu
From db4e4fa8c2d8af2492582f5c40b2d136ca7a1d27 Mon Sep 17 00:00:00 2001
From: Manuel Luitz <[email protected]>
Date: Tue, 3 Aug 2010 00:58:40 +0200
Subject: [PATCH] Bugfix for volume control

Scrolling on the volume control icon or the
tray icon effected a jumping volume level.
When you reached 0% volume the level jumped
back to 100%. This patch fixes the issue.
---
 src/lxmusic.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/lxmusic.c b/src/lxmusic.c
index 02bb260..06eeea3 100644
--- a/src/lxmusic.c
+++ b/src/lxmusic.c
@@ -2002,7 +2002,7 @@ static void on_volume_btn_changed(GtkScaleButton* btn, gdouble val, gpointer use
 
 static void on_volume_btn_scrolled(GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 {
-	guint volume;
+	gshort volume;
 	GtkAdjustment *vol_adj;
 	xmmsc_result_t *res;
 	res = xmmsc_playback_volume_get(con);
@@ -2013,10 +2013,16 @@ static void on_volume_btn_scrolled(GtkWidget *widget, GdkEventScroll *event, gpo
 	{
 		case GDK_SCROLL_UP:
 			volume = gtk_adjustment_get_value (vol_adj) + 2;
+			if ( volume >= 100 ){
+			  volume = 100;
+			}
 			gtk_adjustment_set_value (GTK_ADJUSTMENT(vol_adj), volume);
 			break;
 		case GDK_SCROLL_DOWN:
 			volume = gtk_adjustment_get_value (vol_adj) - 2;
+			if ( volume <= 0 ){
+			  volume = 0;
+			}
 			gtk_adjustment_set_value (GTK_ADJUSTMENT(vol_adj), volume);
 			break;
 		default:
-- 
1.7.1

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to