]> Pileus Git - ~andy/gtk/commitdiff
Win32: Ensure native back-end for windows where the user requests their handle
authorPeter Clifton <pcjc2@cam.ac.uk>
Fri, 9 Sep 2011 14:17:29 +0000 (15:17 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 10 Nov 2011 16:40:49 +0000 (17:40 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=658841

gdk/win32/gdkwindow-win32.c

index 25851e011590eadaa256a5327e0e8f0a82e18589..a8f1cbcf308919f5adb70fc5c1c341c266b1690e 100644 (file)
@@ -3409,5 +3409,15 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
 HGDIOBJ
 gdk_win32_window_get_handle (GdkWindow *window)
 {
+  /* Try to ensure the window has a native window */
+  if (!_gdk_window_has_impl (window))
+    gdk_window_ensure_native (window);
+
+  if (!GDK_WINDOW_IS_WIN32 (window))
+    {
+      g_warning (G_STRLOC " window is not a native Win32 window");
+      return NULL;
+    }
+
   return GDK_WINDOW_HWND (window);
 }