changeset 3053:712b3d476e06

Correct slider behaviour in doublesize
author Tomasz Mon <desowin@gmail.com>
date Fri, 13 Jul 2007 09:47:21 +0200
parents b1b48ea20c16
children 34f37c59e87b
files src/audacious/ui_skinned_horizontal_slider.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_skinned_horizontal_slider.c	Thu Jul 12 21:10:16 2007 +0200
+++ b/src/audacious/ui_skinned_horizontal_slider.c	Fri Jul 13 09:47:21 2007 +0200
@@ -239,6 +239,9 @@
     GdkPixmap *obj = NULL;
     GdkGC *gc;
 
+    if (priv->position > priv->max) priv->position = priv->max;
+    else if (priv->position < priv->min) priv->position = priv->min;
+
     obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth);
     gc = gdk_gc_new(obj);
 
@@ -300,10 +303,10 @@
         if (event->button == 1) {
         gint x;
 
-        x = event->x - priv->knob_width / 2;
+        x = event->x - (priv->knob_width / (priv->double_size ? 1 : 2));
         hs->pressed = TRUE;
 
-        priv->position = x;
+        priv->position = x/(1+priv->double_size);
         if (priv->position < priv->min)
                     priv->position = priv->min;
                 if (priv->position > priv->max)
@@ -340,8 +343,8 @@
     if (hs->pressed) {
         gint x;
 
-        x = event->x - priv->knob_width / 2;
-        priv->position = x;
+        x = event->x - (priv->knob_width / (priv->double_size ? 1 : 2));
+        priv->position = x/(1+priv->double_size);
 
         if (priv->position < priv->min)
             priv->position = priv->min;