diff -c -r fvwm-2.0.46/fvwm/fvwm.c fvwm-2.0.46-MouseFocusOnStartup.patched/fvwm/fvwm.c *** fvwm-2.0.46/fvwm/fvwm.c Mon Aug 4 16:53:32 1997 --- fvwm-2.0.46-MouseFocusOnStartup.patched/fvwm/fvwm.c Sun Nov 9 20:25:31 1997 *************** *** 460,465 **** --- 460,466 ---- #endif MyXUngrabServer(dpy); UnBlackoutScreen(); /* if we need to remove blackout window */ + CoerceEnterNotifyOnCurrentWindow(); DBUG("main","Entering HandleEvents loop..."); HandleEvents(); DBUG("main","Back from HandleEvents loop? Exitting..."); diff -c -r fvwm-2.0.46/fvwm/misc.c fvwm-2.0.46-MouseFocusOnStartup.patched/fvwm/misc.c *** fvwm-2.0.46/fvwm/misc.c Tue Jun 24 10:01:39 1997 --- fvwm-2.0.46-MouseFocusOnStartup.patched/fvwm/misc.c Sun Nov 9 20:26:55 1997 *************** *** 764,766 **** --- 764,791 ---- } /* fvwm_msg */ + /* CoerceEnterNotifyOnCurrentWindow() + * Pretends to get a HandleEnterNotify on the + * window that the pointer currently is in so that + * the focus gets set correctly from the beginning + * Note that this presently only works if the current + * window is not click_to_focus; I think that + * that behaviour is correct and desirable. --11/08/97 gjb */ + void + CoerceEnterNotifyOnCurrentWindow() + { + extern FvwmWindow *Tmp_win; /* from events.c */ + Window child, root; + int root_x, root_y; + int win_x, win_y; + Bool f = XQueryPointer(dpy, Scr.Root, &root, + &child, &root_x, &root_y, &win_x, &win_y, &JunkMask); + if (f && child != None) { + Event.xany.window = child; + if (XFindContext(dpy, child, FvwmContext, (caddr_t *) &Tmp_win) == + XCNOENT) + Tmp_win = NULL; + HandleEnterNotify(); + Tmp_win = None; + } + }