Index: gdk/win32/gdkwindow-win32.c
===================================================================
--- gdk/win32/gdkwindow-win32.c	(revision 1840)
+++ gdk/win32/gdkwindow-win32.c	(working copy)
@@ -716,6 +716,23 @@
   return window;
 }
 
+static HWND
+get_skip_taskbar_owner (void)
+{
+  static GdkWindow *owner = NULL;
+  GdkWindowAttr wa;
+
+  if (owner == NULL)
+    {
+      wa.window_type = GDK_WINDOW_TEMP;
+      wa.wclass = GDK_INPUT_OUTPUT;
+      wa.width = wa.height = 1;
+      wa.event_mask = 0;
+      owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
+    }
+  return GDK_WINDOW_HWND (owner);
+}
+
 GdkWindow*
 gdk_window_new (GdkWindow     *parent,
 		GdkWindowAttr *attributes,
@@ -839,6 +856,8 @@
 void
 gdk_window_destroy_notify (GdkWindow *window)
 {
+  HWND hwnd_owner;
+
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -847,6 +866,10 @@
 		     GDK_WINDOW_HWND (window),
 		     (GDK_WINDOW_DESTROYED (window) ? " (destroyed)" : "")));
 
+  hwnd_owner = GetWindow (GDK_WINDOW_HWND (window), GW_OWNER);
+  if (hwnd_owner && hwnd_owner != get_skip_taskbar_owner ())
+    SetActiveWindow (hwnd_owner);
+
   if (!GDK_WINDOW_DESTROYED (window))
     {
       if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
@@ -2995,9 +3018,6 @@
 gdk_window_set_skip_taskbar_hint (GdkWindow *window,
 				  gboolean   skips_taskbar)
 {
-  static GdkWindow *owner = NULL;
-  GdkWindowAttr wa;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
 
   GDK_NOTE (MISC, g_print ("gdk_window_set_skip_taskbar_hint: %p: %s\n",
@@ -3006,17 +3026,8 @@
 
   if (skips_taskbar)
     {
-      if (owner == NULL)
-	{
-	  wa.window_type = GDK_WINDOW_TEMP;
-	  wa.wclass = GDK_INPUT_OUTPUT;
-	  wa.width = wa.height = 1;
-	  wa.event_mask = 0;
-	  owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
-	}
-
       SetWindowLong (GDK_WINDOW_HWND (window), GWL_HWNDPARENT,
-		     (long) GDK_WINDOW_HWND (owner));
+		     (long) get_skip_taskbar_owner ());
 
 #if 0 /* Should we also turn off the minimize and maximize buttons? */
       SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
