After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667598 - GtkScale marks broken for widgets using gtk_range_set_inverted()
GtkScale marks broken for widgets using gtk_range_set_inverted()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.24.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-01-09 21:19 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2012-01-20 20:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program to show the bug (4.28 KB, text/plain)
2012-01-09 21:20 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
switch from GSList to GList (gtk2) (3.60 KB, patch)
2012-01-09 21:47 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
fix the drawing code (gtk2) (5.84 KB, patch)
2012-01-09 21:48 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
switch from GSList to GList (gtk3) (3.70 KB, patch)
2012-01-13 19:09 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
fix the drawing code (gtk3) (5.29 KB, patch)
2012-01-13 19:10 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
different fix for fixing the inverted scales (7.95 KB, patch)
2012-01-16 20:01 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review
different fix for fixing the inverted scales (gtk2) (4.60 KB, patch)
2012-01-16 21:12 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
inverted scales are still buggy (10.56 KB, image/png)
2012-01-16 21:13 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
inverted scales are still buggy (gtk3) (10.70 KB, image/png)
2012-01-17 16:51 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
  Details
different fix for fixing the inverted scales (gtk2) (5.02 KB, patch)
2012-01-18 19:11 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-09 21:19:01 UTC
The marker layout code fails for widgets that invert the range.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-09 21:47:47 UTC
Created attachment 204906 [details] [review]
switch from GSList to GList (gtk2)
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-09 21:48:12 UTC
Created attachment 204907 [details] [review]
fix the drawing code (gtk2)
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-09 22:06:40 UTC
If the fix is acceptable, I'll make the same patch for gtk3.
Comment 5 Matthias Clasen 2012-01-09 23:40:48 UTC
Sure, looks acceptable.
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-13 19:09:37 UTC
Created attachment 205218 [details] [review]
switch from GSList to GList (gtk3)
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-13 19:10:01 UTC
Created attachment 205219 [details] [review]
fix the drawing code (gtk3)
Comment 8 Matthias Clasen 2012-01-15 19:12:16 UTC
The patch did not work very well (the drawing code makes assumptions about drawing in increasing direction). 

I've committed a slightly different fix to master. Leaving this bug open to backport it.
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-16 20:01:48 UTC
Created attachment 205403 [details] [review]
different fix for fixing the inverted scales

That is
http://git.gnome.org/browse/gtk+/commit/?id=eb4a685691ee3440aa9d6d100be9c5ef2d850b04

I am reattaching the change here for review.
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-16 20:03:55 UTC
Review of attachment 205403 [details] [review]:

::: gtk/gtkscale.c
@@ +203,3 @@
+  else if (G_OBJECT_CLASS (gtk_scale_parent_class)->notify)
+    G_OBJECT_CLASS (gtk_scale_parent_class)->notify (object, pspec);
+{

Shouldn't this always chain up?
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-16 20:09:16 UTC
Review of attachment 205403 [details] [review]:

::: gtk/gtkscale.c
@@ +1616,3 @@
 
+  priv->marks = g_slist_insert_sorted (priv->marks, mark,
+                                       (GCompareFunc) compare_marks);

This lacks user_data = GINT_TO_POINTER (gtk_range_get_inverted (GTK_RANGE (scale))
Comment 12 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-16 21:12:58 UTC
Created attachment 205405 [details] [review]
different fix for fixing the inverted scales (gtk2)
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-16 21:13:28 UTC
Created attachment 205406 [details]
inverted scales are still buggy
Comment 14 Matthias Clasen 2012-01-16 23:06:40 UTC
This was with a backported gtk2 patch ?

Your testcase works fine here with the current gtk3 code...
Comment 15 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-17 07:45:00 UTC
Yes, that is in gtk2. Will take another look tonight.
Comment 16 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-17 16:51:01 UTC
(In reply to comment #14)
> This was with a backported gtk2 patch ?
> 
> Your testcase works fine here with the current gtk3 code...

Are you sure. Now tried it on gtk3 and the scales are not inverted at all.
Comment 17 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-17 16:51:29 UTC
Created attachment 205458 [details]
inverted scales are still buggy (gtk3)
Comment 18 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-17 17:26:20 UTC
Matthias, in my gtk+ backport I do sorted inserts with taking the invertion state into account (which you don't do in gtk3). If I just pass FALSE I get the same behaviour as in gtk3. range-handles get flipped, but the tick-marks are not flipped.

You don't see that in the demo, as there you never construct a widget with setting the range inverted before adding the marks.
Comment 19 Matthias Clasen 2012-01-17 19:10:38 UTC
Thanks for tracking that down.
We clearly need to fix the sorted inversion.
And we should perhaps add another button for 'add some more marks' to testscale, to catch this case.
Comment 20 Matthias Clasen 2012-01-18 12:15:23 UTC
Committed some more fixes
Comment 21 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-18 19:11:07 UTC
Created attachment 205564 [details] [review]
different fix for fixing the inverted scales (gtk2)