GNOME Bugzilla – Bug 667598
GtkScale marks broken for widgets using gtk_range_set_inverted()
Last modified: 2012-01-20 20:58:37 UTC
The marker layout code fails for widgets that invert the range.
Created attachment 204904 [details] test program to show the bug Latest version: http://buzztard.git.sourceforge.net/git/gitweb.cgi?p=buzztard/buzztard;a=blob;f=design/gui/scalemarkers.c;h=517cbb40342538f8f3cff455f30a248b177e55d9;hb=HEAD
Created attachment 204906 [details] [review] switch from GSList to GList (gtk2)
Created attachment 204907 [details] [review] fix the drawing code (gtk2)
If the fix is acceptable, I'll make the same patch for gtk3.
Sure, looks acceptable.
Created attachment 205218 [details] [review] switch from GSList to GList (gtk3)
Created attachment 205219 [details] [review] fix the drawing code (gtk3)
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.
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.
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?
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))
Created attachment 205405 [details] [review] different fix for fixing the inverted scales (gtk2)
Created attachment 205406 [details] inverted scales are still buggy
This was with a backported gtk2 patch ? Your testcase works fine here with the current gtk3 code...
Yes, that is in gtk2. Will take another look tonight.
(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.
Created attachment 205458 [details] inverted scales are still buggy (gtk3)
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.
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.
Committed some more fixes
Created attachment 205564 [details] [review] different fix for fixing the inverted scales (gtk2)