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
This commit is contained in:
Alexander Larsson
2015-11-09 22:18:05 +01:00
parent b0a6af3783
commit 0af457639d
3 changed files with 22 additions and 5 deletions

View File

@ -1034,7 +1034,7 @@ my_tv_draw_layer (GtkTextView *widget,
{
MyTextView *tv = (MyTextView *)widget;
if (layer == GTK_TEXT_VIEW_LAYER_BELOW && tv->surface)
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->surface)
{
cairo_save (cr);
cairo_set_source_surface (cr, tv->surface, 0.0, 0.0);