- gint trough_change_pos_x = width;
- gint trough_change_pos_y = height;
-
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- trough_change_pos_x = (priv->slider.x +
- priv->slider.width / 2 -
- x);
- else
- trough_change_pos_y = (priv->slider.y +
- priv->slider.height / 2 -
- y);
-
- /* FIXME: was trough-upper and trough-lower really used,
- * in that case, it should still be exposed somehow.
- */
- gtk_render_background (context, cr, x, y,
- trough_change_pos_x,
- trough_change_pos_y);
-
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- trough_change_pos_y = 0;
- else
- trough_change_pos_x = 0;
-
- gtk_render_background (context, cr,
- x + trough_change_pos_x, y + trough_change_pos_y,
- width - trough_change_pos_x,
- height - trough_change_pos_y);
-
- gtk_render_frame (context, cr,
- x, y, width, height);
- }
- else
- {
- gtk_render_background (context, cr,
- x, y, width, height);
- gtk_render_frame (context, cr,
- x, y, width, height);
+ if (!priv->has_origin || !draw_slider)
+ {
+ gtk_render_background (context, cr,
+ x, y, width, height);
+
+ gtk_render_frame (context, cr,
+ x, y, width, height);
+ }
+ 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;
+
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ trough_change_pos_x = (priv->slider.x +
+ priv->slider.width / 2 -
+ x);
+ else
+ trough_change_pos_y = (priv->slider.y +
+ priv->slider.height / 2 -
+ y);
+
+ 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);
+ }
+ else
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+
+ gtk_render_background (context, cr, x, y,
+ trough_change_pos_x,
+ trough_change_pos_y);
+
+ gtk_render_frame (context, cr, x, y,
+ trough_change_pos_x,
+ trough_change_pos_y);
+
+ gtk_style_context_restore (context);
+
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ trough_change_pos_y = 0;
+ else
+ trough_change_pos_x = 0;
+
+ 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);
+ }
+ else
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ 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,
+ width - trough_change_pos_x,
+ height - trough_change_pos_y);
+
+ gtk_render_frame (context, cr,
+ x + trough_change_pos_x, y + trough_change_pos_y,
+ width - trough_change_pos_x,
+ height - trough_change_pos_y);
+
+ gtk_style_context_restore (context);
+ }