9fcb0f8
--- gtk+-1.2.10/gtk/gtkwindow.c.focus	Fri Mar  9 18:39:16 2001
9fcb0f8
+++ gtk+-1.2.10/gtk/gtkwindow.c	Thu Jul  5 10:34:00 2001
9fcb0f8
@@ -985,7 +985,13 @@
9fcb0f8
       break;
9fcb0f8
     case EnterNotify:
9fcb0f8
     case LeaveNotify:
9fcb0f8
-      if (xev->xcrossing.detail != NotifyInferior &&
9fcb0f8
+      /* We only track the actual destination of keyboard events for real
9fcb0f8
+       * toplevels, not for embedded toplevels such as GtkPlug. The reason for
9fcb0f8
+       * this is that GtkPlug redirects events so the widget may effectively not
9fcb0f8
+       * have the focus even if it actually has the focus.
9fcb0f8
+       */
9fcb0f8
+      if (gdk_window_get_parent (GTK_WIDGET (window)->window) == GDK_ROOT_PARENT () &&
9fcb0f8
+	  xev->xcrossing.detail != NotifyInferior &&
9fcb0f8
 	  xev->xcrossing.focus && !window->window_has_focus)
9fcb0f8
 	{
9fcb0f8
 	  window->window_has_pointer_focus = (xev->xany.type == EnterNotify) ? TRUE : FALSE;