Index: gtkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwindow.c,v
retrieving revision 1.272
diff -u -6 -p -r1.272 gtkwindow.c
--- gtkwindow.c	9 Aug 2004 16:59:53 -0000	1.272
+++ gtkwindow.c	29 Aug 2004 21:07:30 -0000
@@ -40,12 +40,15 @@
 #include "gtkmain.h"
 #include "gtkiconfactory.h"
 #include "gtkicontheme.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkplug.h"
+#ifndef GDK_WINDOWING_X11
+#include "gdk/win32/gdkwin32.h"
+#endif
 
 enum {
   SET_FOCUS,
   FRAME_EVENT,
   ACTIVATE_FOCUS,
   ACTIVATE_DEFAULT,
@@ -4002,12 +4005,32 @@ static void
 gtk_window_map (GtkWidget *widget)
 {
   GtkWindow *window = GTK_WINDOW (widget);
   GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
   GdkWindow *toplevel;
 
+	g_print( "Enter gtk_dialog_map\n" );
+#ifndef GDK_WINDOWING_X11
+  g_print( "notifying win32 event loop of required focus\n" );
+	{
+    /* make sure the win32 window is focused */
+    HWND hwnd = (HWND)GDK_WINDOW_HWND( widget->window );
+    HWND toplevel = (HWND)GDK_WINDOW_HWND( gtk_widget_get_toplevel( widget )->window );
+		gdk_pointer_ungrab( GDK_CURRENT_TIME );
+    SendMessage( toplevel, WM_SETFOCUS, (WPARAM)0, 0 );
+    SendMessage( toplevel, WM_KILLFOCUS, (WPARAM)hwnd, 0 );
+    SendMessage( toplevel, WM_PARENTNOTIFY, 
+                           (WPARAM)WM_LBUTTONDOWN, 
+                           MAKELPARAM( widget->allocation.x,
+                                       widget->allocation.y ) );
+    SendMessage( toplevel, WM_MOUSEACTIVATE, (WPARAM)hwnd, 1 ); 
+    SetFocus( hwnd );
+  }
+
+#endif
+
   GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
 
   if (window->bin.child &&
       GTK_WIDGET_VISIBLE (window->bin.child) &&
       !GTK_WIDGET_MAPPED (window->bin.child))
     gtk_widget_map (window->bin.child);
@@ -4053,12 +4076,13 @@ gtk_window_map (GtkWidget *widget)
   if (!disable_startup_notification &&
       !sent_startup_notification)
     {
       sent_startup_notification = TRUE;
       gdk_notify_startup_complete ();
     }
+	g_print( "Leave gtk_dialog_map\n" );
 }
 
 static void
 gtk_window_unmap (GtkWidget *widget)
 {
   GtkWindow *window = GTK_WINDOW (widget);
