[gtk+/gtk-3-10] GtkTextView: Fix regression in GtkSourceView drawing
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-10] GtkTextView: Fix regression in GtkSourceView drawing
- Date: Wed, 2 Oct 2013 14:25:00 +0000 (UTC)
commit 9f04e9ccb1e7cae94d2ef60fa1a82c3c47e8e16c
Author: Alexander Larsson <alexl redhat com>
Date: Wed Oct 2 15:14:56 2013 +0200
GtkTextView: Fix regression in GtkSourceView drawing
GtkSourceView draws before chaining upo to GtkTextView and assumes
that this will be visible, but the pixelcache will just overdraw
that with background.
So, we stop drawing the background to the pixel cache and instead
make it an CAIRO_CONTENT_COLOR_ALPHA surface to make the previously
drawn content see through.
This is slower, but more backwards compatible.
https://bugzilla.gnome.org/show_bug.cgi?id=708423
gtk/gtktextview.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 75d0d97..98988eb 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1474,6 +1474,13 @@ gtk_text_view_init (GtkTextView *text_view)
priv->pixel_cache = _gtk_pixel_cache_new ();
+ /* Widgets inheriting from GtkTextView (like GtkSourceView) rely on being able to
+ paint before chaining up to GtkTextView.draw() and having that be visible, that
+ doesn't work unless we have alpha in the textview pixelcache. This is slightly
+ suboptimal, as it means drawing the cache is slower (and OVER operation) rather
+ than a pure blit, but is required for backwards compat. */
+ _gtk_pixel_cache_set_content (priv->pixel_cache, CAIRO_CONTENT_COLOR_ALPHA);
+
/* Set up default style */
priv->wrap_mode = GTK_WRAP_NONE;
priv->pixels_above_lines = 0;
@@ -5243,18 +5250,6 @@ draw_text (cairo_t *cr,
gpointer user_data)
{
GtkWidget *widget = user_data;
- GtkStyleContext *context;
- GdkRectangle bg_rect;
-
- gdk_cairo_get_clip_rectangle (cr, &bg_rect);
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_render_background (context, cr,
- bg_rect.x, bg_rect.y,
- bg_rect.width, bg_rect.height);
- gtk_style_context_restore (context);
gtk_text_view_paint (widget, cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]