Subject: FVWM: Timing bug in FvwmPager

From: Grant McDorman <[email-masked]>
Date: Tue, 06 Feb 1996 11:47:42 EST

Discovered a timing bug in the FvwmPager on Solaris 2.4, with both OpenWindows
and the Consortium X11R6 server.

FvwmPager, when moving a window to the current desk, does an XReparentWindow
followed by an XSetInputFocus. The XSetInputFocus can get the following error:

  X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Serial number of failed request:  5232
  Current serial number in output stream:  5247    

By adding a XSync, a "sleep_a_little(50000)", and another XSync just before
the XSetInputFocus the problem goes away. The patch is attached.

50 ms may be a bit long for the sleep; I haven't tried shorter periods, though.

Grant McDorman <[email-masked]>
				ISG Technologies, Inc.
*** x_pager.c.orig	Wed Nov 15 16:10:31 1995
--- x_pager.c	Tue Feb  6 11:53:39 1996
***************
*** 1427,1432 ****
--- 1427,1435 ----
  	}
        if(Scr.CurrentDesk == t->desk)
        {
+ 	  XSync(dpy,0);
+ 	  sleep_a_little(50000);
+ 	  XSync(dpy,0);
  	  if(t->flags & ICONIFIED)
  	    XSetInputFocus (dpy, t->icon_w, RevertToParent, Event->xbutton.time); 
  	  else