[gtk+] widget: Improve gtk_cairo_should_draw_window()



commit efc899bd2b2a351221cd2c455773f62defc06b9c
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 21 16:53:25 2016 +0100

    widget: Improve gtk_cairo_should_draw_window()
    
    Check that non-native window are indeed children of the event window and
    only then confirm that they should be drawn.
    
    Fixes Glade thinking that it's okay to have the draw function do
    different things depending on what window to draw. (This should really
    be fixed in Glade.)

 gtk/gtkwidget.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ba85df6..2c9f776 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6927,13 +6927,15 @@ gtk_cairo_should_draw_window (cairo_t *cr,
   g_return_val_if_fail (cr != NULL, FALSE);
   g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
 
-  if (!gdk_window_has_native (window))
+  event_window = gtk_cairo_get_event_window (cr);
+
+  if (event_window == NULL)
     return TRUE;
 
-  event_window = gtk_cairo_get_event_window (cr);
+  while (!gdk_window_has_native (window))
+    window = gdk_window_get_parent (window);
 
-  return event_window == NULL ||
-    event_window == window;
+  return event_window == window;
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]