[gtk+/gtk-2-22] win32: Further fixing _gdk_window_impl_new()



commit 707f1a9a84876de2eb8e612782a5cff3b7253e62
Author: Hans Breuer <hans breuer org>
Date:   Sun Aug 29 14:18:58 2010 +0200

    win32: Further fixing _gdk_window_impl_new()
    
     - attributes->wclass is not consistently set anymore,
       use private->input_only instead [1]
     - don't put window into parent->children a second time
       (now there is no window reference problem anymore)

 gdk/win32/gdkwindow-win32.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index e3d0c1d..f45c177 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -463,7 +463,7 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
 /*
  * Create native windows.
  *
- * With the default Gdk the created windows are only toplevel.
+ * With the default Gdk the created windows are mostly toplevel windows.
  * A lot of child windows are only created for GDK_NATIVE_WINDOWS.
  *
  * Placement of the window is derived from the passed in window,
@@ -544,7 +544,11 @@ _gdk_window_impl_new (GdkWindow     *window,
 
   impl->extension_events_selected = FALSE;
 
-  if (attributes->wclass == GDK_INPUT_OUTPUT)
+  /* wclass is not any longer set always, but if is ... */
+  if ((attributes_mask & GDK_WA_WMCLASS) == GDK_WA_WMCLASS)
+    g_assert ((attributes->wclass == GDK_INPUT_OUTPUT) == !private->input_only);
+
+  if (!private->input_only)
     {
       dwExStyle = 0;
 
@@ -637,8 +641,6 @@ _gdk_window_impl_new (GdkWindow     *window,
   else
     {
       /* adjust position relative to real_parent */
-      GdkWindowObject *parent = private->parent;
-
       window_width = private->width;
       window_height = private->height;
       /* use given position for initial placement, native coordinates */
@@ -661,9 +663,6 @@ _gdk_window_impl_new (GdkWindow     *window,
   if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
     dwExStyle |= WS_EX_TOOLWINDOW;
 
-  if (private->parent)
-    private->parent->children = g_list_prepend (private->parent->children, window);
-
   klass = RegisterGdkClass (private->window_type, impl->type_hint);
 
   wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
@@ -888,8 +887,7 @@ gdk_window_destroy_notify (GdkWindow *window)
     }
   
   gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
-  // crash on GDK_NATIVE_WINDOWS:
-  // g_object_unref (window);
+  g_object_unref (window);
 }
 
 static void



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