forked from AuroraMiddleware/gtk
GtkRange: Check "inverted" property when drawing
The direction in which the slider moves can be inverted by setting the inverted property. But the draw method does not check this, instead it checks if the direction of the widget is set to be right to left. Call the should_invert function in order to determine if the direction of the range should be inverted. It too checks the widget's direction, but also checks the "inverted" property, and allows the range to be drawn inverted even if it is vertically oriented. https://bugzilla.gnome.org/show_bug.cgi?id=746712
This commit is contained in:
parent
1ed9d33d24
commit
38f61dd445
@ -2037,8 +2037,6 @@ gtk_range_draw (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
gint trough_change_pos_x = width;
|
||||
gint trough_change_pos_y = height;
|
||||
|
||||
@ -2053,15 +2051,13 @@ gtk_range_draw (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_save (context);
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
|
||||
if (!is_rtl)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
}
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
else
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
||||
|
||||
if (!should_invert (range))
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
|
||||
gtk_render_background (context, cr, x, y,
|
||||
trough_change_pos_x,
|
||||
trough_change_pos_y);
|
||||
@ -2079,17 +2075,12 @@ gtk_range_draw (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_save (context);
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
|
||||
if (is_rtl)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
}
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
else
|
||||
{
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
}
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
|
||||
if (should_invert (range))
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HIGHLIGHT);
|
||||
|
||||
gtk_render_background (context, cr,
|
||||
x + trough_change_pos_x, y + trough_change_pos_y,
|
||||
|
Loading…
Reference in New Issue
Block a user