--- keyboard.c.~1.969.~ 2008-08-15 14:47:16.000000000 +0200 +++ keyboard.c 2008-08-23 10:23:12.000000000 +0200 @@ -1602,6 +1602,21 @@ (at your option) any later version. && !EQ (internal_last_event_frame, selected_frame)) Fselect_frame (internal_last_event_frame); #endif +#if 1 + { + if (!detect_input_pending() + && NILP(internal_last_event_frame)) { + Display *dpy = FRAME_X_DISPLAY (check_x_frame(selected_frame)); + Window focus; + int revert_to; + XGetInputFocus (dpy, &focus, &revert_to); + if (focus != None + && focus != FRAME_X_WINDOW (check_x_frame(selected_frame))) + Fx_focus_frame (selected_frame); + } + } +#endif + /* If it has changed current-menubar from previous value, really recompute the menubar from the value. */ if (! NILP (Vlucid_menu_bar_dirty_flag)