GNOME Bugzilla – Bug 752599
GtkDrawingArea: Only respects background-color if "draw" signal is unconnected
Last modified: 2017-05-25 19:32:45 UTC
Created attachment 307699 [details] sample code showing the different behaviours Current git master shows a change of behavior compared to 3.16 in how a GtkDrawingArea considers the background-color property. Previously in gtk+-3.16 it would respect the property even if the application connected an own handler to the "draw" signal. That way the background could be colored independently from the actual foreground drawn by the application handler. In current git master (due to commit 6786c9d7) it only paints the background if the application doesn't register a signal handler itself (unlikely) or allows further handlers for "draw" which would cause the GtkDrawingArea to paint over everything the application has drawn. This affects the backwards compatibility with apps that rely on the old behaviour (like eog, for example). I also attached a little sample program that shows the difference. In gtk+-3.16 the window will be blue, in git master it has the default background color of the theme.
Created attachment 307769 [details] [review] Revert "drawingarea: checks parent's draw() before call it" This reverts commit b3166b745f41a901171821ccc9f0c69b9cc35e70.
Created attachment 307770 [details] [review] Revert "drawingarea: don't call gtk_style_context_set_background()" This reverts commit 6786c9d724ad57ea30e169d2afcb4a314b2e56bb.
Created attachment 307771 [details] [review] drawingarea: use same background approach as GtkLayout Call gtk_style_context_set_background() every time the style is updated and add a comment as to why we still need to do it here.
I tested these patches with the sample code and they seem to fix the issue.
Review of attachment 307771 [details] [review]: Looks good to me
Review of attachment 307770 [details] [review]: ok
Review of attachment 307769 [details] [review]: ok
Attachment 307769 [details] pushed as 11ce41d - Revert "drawingarea: checks parent's draw() before call it" Attachment 307770 [details] pushed as 90d237c - Revert "drawingarea: don't call gtk_style_context_set_background()" Attachment 307771 [details] pushed as 62af1cb - drawingarea: use same background approach as GtkLayout
Fixes the background issue for eog as well. Thanks! :)
Updated the bug status while passing by.
(In reply to Debarshi Ray from comment #10) > Updated the bug status while passing by. Sorry, I meant the status of the patches and not the bug.