summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-11-09 22:18:05 +0100
committerAlexander Larsson <alexl@redhat.com>2015-11-10 08:39:47 +0100
commit0af457639dc5eb14a060183fbd3051870055c9ab (patch)
treef30bf4841ece0b752e9dd93a1ee553a62d41fec3 /gtk/gtktextview.c
parentb0a6af3783a8dd50781ca921de81d3879aafbb00 (diff)
downloadgtk+-0af457639dc5eb14a060183fbd3051870055c9ab.tar.gz
TextView: Use saner coordinate space in draw_layer.
When I added the draw_layer vfunc it accidentally got passed a cairo_t that was configured with to draw in the viewport coordinate space (rather than the buffer coordinate space). This makes things unnecessary complex, because you have to convert between the two. The pixel cache is shared between the text and the layers, so there is no way to use draw_layer to get a stationary overlay effect. Thus it makes much more sense for the draw_layer vfunc to draw in the buffer space. Just changing this would break ABI for existing code, so this is fixed by adding new layer types and deprecating the old ones. Also, we use the new layer types to fix gtk3-widget-factory. https://bugzilla.gnome.org/show_bug.cgi?id=757856
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r--gtk/gtktextview.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3b8f16ea5e..773a87f2cf 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5813,6 +5813,11 @@ draw_text (cairo_t *cr,
cairo_save (cr);
GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW, cr);
cairo_restore (cr);
+
+ cairo_save (cr);
+ cairo_translate (cr, -text_view->priv->xoffset, -text_view->priv->yoffset);
+ GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW_TEXT, cr);
+ cairo_restore (cr);
}
gtk_text_view_paint (widget, cr);
@@ -5822,6 +5827,11 @@ draw_text (cairo_t *cr,
cairo_save (cr);
GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE, cr);
cairo_restore (cr);
+
+ cairo_save (cr);
+ cairo_translate (cr, -text_view->priv->xoffset, -text_view->priv->yoffset);
+ GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE_TEXT, cr);
+ cairo_restore (cr);
}
}