After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694925 - non-expose based draw() doesn't render window background
non-expose based draw() doesn't render window background
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-03-01 11:15 UTC by Alexander Larsson
Modified: 2013-03-01 11:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Draw gdkwindow backgrounds during for non-exposed draws (3.00 KB, patch)
2013-03-01 11:17 UTC, Alexander Larsson
none Details | Review
TextView: Properly render background (1.42 KB, patch)
2013-03-01 11:25 UTC, Alexander Larsson
committed Details | Review

Description Alexander Larsson 2013-03-01 11:15:03 UTC
The GdStack widget uses what amounts to gtk_widget_draw() during animations, rather than relying on expose events. However, this does not work for instance with GtkTextview, because that is a windowed widget which uses gtk_style_context_set_background(), but not gtk_render_background(), but gtk_widget_draw() does not cleat the resulting draw to the window background.

There are two possibilities here that I see:

a) Make the drawing machinery clear to the window bg in this case. In the full generality this is kind of hard, but for the simple case of a windowed widget and/or subwindows that are direct children of widget->window we can make this sort of work (patch attached)

b) Declare that such widgets are wrong and fix them.
Comment 1 Alexander Larsson 2013-03-01 11:17:27 UTC
Created attachment 237697 [details] [review]
Draw gdkwindow backgrounds during for non-exposed draws

If we get a draw signal which is not from an expose we don't
clear the background as per the GdkWindow background during the
expose call, so we do this during the draw() signal handler.
Comment 2 Alexander Larsson 2013-03-01 11:25:05 UTC
Created attachment 237699 [details] [review]
TextView: Properly render background

We always need to render the background, as the window
background is not always set (i.e. during gtk_widget_draw()) or
when its partially visible.
Comment 3 Benjamin Otte (Company) 2013-03-01 11:32:38 UTC
gtk_style_context_set_background() is essentially deprecated. We only use it for the gdk_window_move_region() hack if we can guarantee that a window is opaque, otherwise we set the window backgrounds to none. We have to, as for transparency we'd draw the background twice (once by the GdkWindow, once by the widget).

So the obviously correct solution is (b).

As a side-note, we only check the CSS background-color for the window background as that's the only thing that can be represented using X semantics. Background images can be modified in so many amazing ways, that there's no way we could create a pixmap that represents the widget's background nearly well enough.
Comment 4 Alexander Larsson 2013-03-01 11:50:48 UTC
Attachment 237699 [details] pushed as b5ee44b - TextView: Properly render background