[gtk+/client-side-windows: 11/284] Change assert to warning with some information



commit 07f76be87a70edb88ce76e6fb3b1d8b46718092d
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 4 10:22:28 2008 +0100

    Change assert to warning with some information
---
 gdk/gdkwindow.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ea059c5..2ac5321 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1047,7 +1047,7 @@ gdk_window_set_has_native (GdkWindow *window, gboolean has_native)
       visual = gdk_drawable_get_visual (window);
 
       old_impl = private->impl;
-      _gdk_window_impl_new (window, private->parent, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
+      _gdk_window_impl_new (window, (GdkWindow *)private->parent, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
       new_impl = private->impl;
       
       private->impl = old_impl;
@@ -7252,8 +7252,21 @@ _gdk_windowing_got_event (GdkDisplay *display,
 	is_motion_type (event->type)))
     return;
 
-  /* We should only get these events on toplevel windows */
-  g_assert (GDK_WINDOW_TYPE (event_private->parent) == GDK_WINDOW_ROOT);
+  if (GDK_WINDOW_TYPE (event_private->parent) != GDK_WINDOW_ROOT)
+    {
+      GEnumValue *event_type_value, *window_type_value;
+      
+      event_type_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (GDK_TYPE_EVENT_TYPE),
+					   event->type);
+      window_type_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (GDK_TYPE_WINDOW_TYPE),
+					    event_private->window_type);
+      
+     /* We should only get these events on toplevel windows */
+      g_warning ("got unexpected event of type %s on non-toplevel window (type %s)",
+		 event_type_value->value_name,
+		 window_type_value->value_name);
+      return;
+    }
   
   gdk_event_get_coords (event, &x, &y);
   pointer_window = _gdk_window_find_descendant_at (event_window, x, y,



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