summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2016-04-12 11:20:09 +0000
committerMartin Owens <doctormo@gmail.com>2016-04-12 11:20:09 +0000
commitadb2151187f3ce389feca24c34d2c5581a8fe417 (patch)
treecc19b6cebc28bb93104613549eba4e2bf4a78458 /src
parentHackfest 2016: un-obfuscate the SPCanvas widget. (diff)
downloadinkscape-adb2151187f3ce389feca24c34d2c5581a8fe417.tar.gz
inkscape-adb2151187f3ce389feca24c34d2c5581a8fe417.zip
Latest gtk3 cleanup
(bzr r14791)
Diffstat (limited to 'src')
-rw-r--r--src/widgets/eek-preview.cpp29
-rw-r--r--src/widgets/ruler.cpp14
2 files changed, 33 insertions, 10 deletions
diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp
index de14caa12..9951a8957 100644
--- a/src/widgets/eek-preview.cpp
+++ b/src/widgets/eek-preview.cpp
@@ -496,14 +496,11 @@ gboolean eek_preview_draw(GtkWidget *widget,
otherArea.y = possible.y + (possible.height - otherArea.height) / 2;
}
#if GTK_CHECK_VERSION(3,0,0)
- gtk_paint_diamond( style,
- cr,
- gtk_widget_get_state (widget),
- GTK_SHADOW_ETCHED_OUT,
- widget,
- NULL,
- otherArea.x, otherArea.y,
- otherArea.width, otherArea.height );
+ // This should be a diamond too?
+ gtk_render_check(context,
+ cr,
+ otherArea.x, otherArea.y,
+ otherArea.width, otherArea.height );
#else
gtk_paint_diamond( style,
window,
@@ -550,7 +547,11 @@ static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->within = TRUE;
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_set_state_flags( widget, priv->hot ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_PRELIGHT, false );
+#else
gtk_widget_set_state( widget, priv->hot ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT );
+#endif
}
return FALSE;
@@ -563,7 +564,11 @@ static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->within = FALSE;
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_NORMAL, false );
+#else
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
+#endif
}
return FALSE;
@@ -588,7 +593,11 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton*
if ( priv->within )
{
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_ACTIVE, false );
+#else
gtk_widget_set_state( widget, GTK_STATE_ACTIVE );
+#endif
}
}
}
@@ -603,7 +612,11 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton
EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview);
priv->hot = FALSE;
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_NORMAL, false );
+#else
gtk_widget_set_state( widget, GTK_STATE_NORMAL );
+#endif
if ( priv->within &&
(event->button == PRIME_BUTTON_MAGIC_NUMBER ||
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp
index 0b473f173..fe851d592 100644
--- a/src/widgets/ruler.cpp
+++ b/src/widgets/ruler.cpp
@@ -286,7 +286,7 @@ sp_ruler_init (SPRuler *ruler)
#if GTK_CHECK_VERSION(3,0,0)
const gchar *str =
"SPRuler {\n"
- " background-color: @theme_bg_color;\n"
+ " background-color: @bg_color;\n"
"}\n";
GtkCssProvider *css = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css, str, -1, NULL);
@@ -1418,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;
@@ -1433,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)
{