summaryrefslogtreecommitdiffstats
path: root/src/widgets/ruler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/ruler.cpp')
-rw-r--r--src/widgets/ruler.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp
index 3a5e76277..fe851d592 100644
--- a/src/widgets/ruler.cpp
+++ b/src/widgets/ruler.cpp
@@ -284,17 +284,10 @@ sp_ruler_init (SPRuler *ruler)
priv->font_scale = DEFAULT_RULER_FONT_SCALE;
#if GTK_CHECK_VERSION(3,0,0)
- #if GTK_CHECK_VERSION(3,8,0)
- const gchar *str =
- "SPRuler {\n"
- " background-color: @theme_bg_color;\n"
- "}\n";
- #else
const gchar *str =
"SPRuler {\n"
" background-color: @bg_color;\n"
"}\n";
- #endif
GtkCssProvider *css = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css, str, -1, NULL);
gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (ruler)),
@@ -1425,7 +1418,6 @@ sp_ruler_get_pos_rect (SPRuler *ruler,
gdouble position)
{
GtkWidget *widget = GTK_WIDGET (ruler);
- GtkStyle *style = gtk_widget_get_style (widget);
SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler);
GtkAllocation allocation;
gint width, height;
@@ -1440,8 +1432,19 @@ sp_ruler_get_pos_rect (SPRuler *ruler,
gtk_widget_get_allocation (widget, &allocation);
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ GtkBorder padding;
+
+ gtk_style_context_get_border(context, static_cast<GtkStateFlags>(0), &padding);
+
+ xthickness = padding.left + padding.right;
+ ythickness = padding.top + padding.bottom;
+#else
+ GtkStyle *style = gtk_widget_get_style (widget);
xthickness = style->xthickness;
ythickness = style->ythickness;
+#endif
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{