GNOME Bugzilla – Bug 708423
GtkTextView regression: current line highlighting not working anymore in GtkSourceView
Last modified: 2014-01-09 16:37:59 UTC
I think this is another pixelcache regression in GtkTextView. The current line highlighting (background color) is not working anymore in GtkSourceView/gedit. The code for painting the line background: https://git.gnome.org/browse/gtksourceview/tree/gtksourceview/gtksourceview.c#n2353
By reverting the last GtkTextView pixelcache commit, the current line highlighting works fine. https://git.gnome.org/browse/gtk+/commit/gtk/gtktextview.c?id=9a45712ad674782841c83a01f810042ab92b60cd
The core problem is that the draw() implementation on GtkTextView now renders the background to the text window GdkWindow, which was previously not done (only the bg on the whole widget was rendered). If this is disabled in gtktextview.c:draw_text() then the highlighting works again. I don't quite remember why this was changed though, will have to look it up. However, even when it *works* its somehow suboptimal for GtkSourceView to be drawing directly to the window when the textview is using a pixel cache. Ideally we'd want the sourceview to piggyback its rendering to the pixelcache too...
Created attachment 256260 [details] [review] 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.
Comment on attachment 256260 [details] [review] GtkTextView: Fix regression in GtkSourceView drawing Attachment 256260 [details] pushed as 1ac1343 - GtkTextView: Fix regression in GtkSourceView drawing
I pushed this fix to 3.10 and master. It *does* make scrolling slower though, so i think for 3.12 we should revert that and instead have new draw vfuncs in GtkTextView that GtkSourceView 3.12 could use to draw before and after the main text rendering but on the pixelcache.
Or we could move current-line highlighting in textview. We know that what GtkSourceView does is a hack... we are more than open to do it in a better way if possible.
I think we can close this bug, as the current line highlighting works again in GtkSourceView. I've opened the bug #721012 for moving the current-line highlighting in GtkTextView, to have a cleaner implementation, and be able to draw directly to the pixel cache.
The fix for this caused a regression in rgba AA rendering as per bug 715008. I've added patches there that solves the problem in this bug in a different way.