summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kris@lanedo.com>2012-09-28 06:50:13 +0200
committerMichael Natterer <mitch@gimp.org>2012-09-28 10:11:16 +0200
commit4ccf8609ab696d46fc4bb88597f8b92a23cec498 (patch)
tree205f7e60a380b9783ff9d31255ab229e1eb06ad8
parented3f5a5db44163dcc66dd462f2f799dff9d11168 (diff)
downloadgtk+-4ccf8609ab696d46fc4bb88597f8b92a23cec498.tar.gz
quartz: Fix garbage content when windows are initially mapped
The garbage would be visible if any widget enabled the toplevel NSView's CALayer in order to do custom native rendering. (cherry picked from commit 92ea94af5f1a4d0970628b58997192ccf74cab36)
-rw-r--r--gdk/quartz/GdkQuartzView.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
index d2f791c4f4..4955347710 100644
--- a/gdk/quartz/GdkQuartzView.c
+++ b/gdk/quartz/GdkQuartzView.c
@@ -81,6 +81,25 @@
if (NSEqualRects (rect, NSZeroRect))
return;
+ if (!GDK_WINDOW_IS_MAPPED (gdk_window))
+ {
+ /* If the window is not yet mapped, clip_region_with_children
+ * will be empty causing the usual code below to draw nothing.
+ * To not see garbage on the screen, we draw an aesthetic color
+ * here. The garbage would be visible if any widget enabled
+ * the NSView's CALayer in order to add sublayers for custom
+ * native rendering.
+ */
+ [NSGraphicsContext saveGraphicsState];
+
+ [[[self window] backgroundColor] setFill];
+ [NSBezierPath fillRect:rect];
+
+ [NSGraphicsContext restoreGraphicsState];
+
+ return;
+ }
+
/* Clear our own bookkeeping of regions that need display */
if (impl->needs_display_region)
{