diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2016-07-29 13:35:20 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2016-07-29 13:35:20 +0000 |
| commit | 1bd64804910f28ff16ea47e34baed41f22768fee (patch) | |
| tree | 9526c7c2de3e5c10d76260e76c970367505ffb82 /src/widgets/ruler.cpp | |
| parent | Finish removing GTK+ 2 fallbacks (diff) | |
| download | inkscape-1bd64804910f28ff16ea47e34baed41f22768fee.tar.gz inkscape-1bd64804910f28ff16ea47e34baed41f22768fee.zip | |
ruler: Backport upstream patches
(bzr r15023.2.9)
Diffstat (limited to 'src/widgets/ruler.cpp')
| -rw-r--r-- | src/widgets/ruler.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 92c2b611d..8b0a344f6 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -642,8 +642,14 @@ static gboolean sp_ruler_draw (GtkWidget *widget, cairo_t *cr) { - SPRuler *ruler = SP_RULER (widget); - SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler); + SPRuler *ruler = SP_RULER (widget); + SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler); + GtkStyleContext *context = gtk_widget_get_style_context (widget); + GtkAllocation allocation; + + gtk_widget_get_allocation (widget, &allocation); + gtk_render_background (context, cr, 0, 0, allocation.width, allocation.height); + gtk_render_frame (context, cr, 0, 0, allocation.width, allocation.height); sp_ruler_draw_ticks (ruler); @@ -669,7 +675,7 @@ sp_ruler_make_pixmap (SPRuler *ruler) priv->backing_store = gdk_window_create_similar_surface (gtk_widget_get_window (widget), - CAIRO_CONTENT_COLOR, + CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height); @@ -1088,9 +1094,10 @@ sp_ruler_draw_ticks (SPRuler *ruler) cr = cairo_create (priv->backing_store); - gtk_render_background (context, cr, 0, 0, allocation.width, allocation.height); - gtk_render_frame (context, cr, 0, 0, allocation.width, allocation.height); - + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + cairo_paint (cr); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget), &color); gdk_cairo_set_source_rgba (cr, &color); @@ -1319,9 +1326,6 @@ sp_ruler_get_pos_rect (SPRuler *ruler, rect.y = ROUND ((position - lower) * increment) + (ythickness - rect.height) / 2 - 1; } - rect.x += allocation.x; - rect.y += allocation.y; - return rect; } @@ -1344,18 +1348,21 @@ sp_ruler_queue_pos_redraw (SPRuler *ruler) { SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler); const GdkRectangle rect = sp_ruler_get_pos_rect (ruler, priv->position); + GtkAllocation allocation; + + gtk_widget_get_allocation (GTK_WIDGET(ruler), &allocation); gtk_widget_queue_draw_area (GTK_WIDGET(ruler), - rect.x, - rect.y, + rect.x + allocation.x, + rect.y + allocation.y, rect.width, rect.height); if (priv->last_pos_rect.width != 0 || priv->last_pos_rect.height != 0) { gtk_widget_queue_draw_area (GTK_WIDGET(ruler), - priv->last_pos_rect.x, - priv->last_pos_rect.y, + priv->last_pos_rect.x + allocation.x, + priv->last_pos_rect.y + allocation.y, priv->last_pos_rect.width, priv->last_pos_rect.height); |
