FVWM: Bug: fvwm failing to unmap window sometimes

From: Grant McDorman <grant_at_isgtec.com>
Date: Tue, 26 Nov 1996 09:51:50 -0500 (EST)

I have discovered, and patched, a bug in 2.0.43.

If a Motif client quickly maps and then immediately unmaps a window, the events sent
are:
 client: MapRequest
           synthetic UnmapNotify with selecting window ('event') equal to the root
 fvwm: Map (as per MapRequest)
           synthetic UnmapNotify ignored because 'event' field (selecting window)
                not equal to 'window' (window being unmapped)

The result is typically a blank window; moreover, as far as the application is
concerned this window isn't there.

Comments and code in events.c appear to be checking for this synthetic event;
however, because of the immediately preceeding 'if' statement the code in
question will never get executed:


void HandleUnmapNotify()
{
  int dstx, dsty;
  Window dumwin;
  XEvent dummy;
  extern FvwmWindow *colormap_win;

  if(Event.xunmap.event != Event.xunmap.window)
    return;
  /*
   * The July 27, 1988 ICCCM spec states that a client wishing to switch
   * to WithdrawnState should send a synthetic UnmapNotify with the
   * event field set to (pseudo-)root, in case the window is already
   * unmapped (which is the case for fvwm for IconicState). Unfortunately,
   * we looked for the FvwmContext using that field, so try the window
   * field also.
   */
  if (!Tmp_win)
    {
      Event.xany.window = Event.xunmap.window;
      if (XFindContext(dpy, Event.xany.window,
                       FvwmContext, (caddr_t *)&Tmp_win) == XCNOENT)
        Tmp_win = NULL;
    }

The obvious quick fix is to remove the if statement and Unmap() the window.
However, presumably the if statement is there for some reason; so my patch
changes the if statement to return if the 'event' and 'window' fields don't
match AND the 'event' field is not the root window, or the event is not
synthetic (send_event is false).

The patch is attached.
  

Grant McDorman <grant_at_isgtec.com>
ISG Technologies, Inc. http://www.isgtec.com
Mississauga, Ontario, Canada



*** events.c.orig Mon May 27 15:33:26 1996
--- events.c Mon Nov 25 11:48:11 1996
***************
*** 872,880 ****
    Window dumwin;
    XEvent dummy;
    extern FvwmWindow *colormap_win;
  
! if(Event.xunmap.event != Event.xunmap.window)
! return;
    /*
     * The July 27, 1988 ICCCM spec states that a client wishing to switch
     * to WithdrawnState should send a synthetic UnmapNotify with the
--- 872,887 ----
    Window dumwin;
    XEvent dummy;
    extern FvwmWindow *colormap_win;
+ int weMustUnmap;
  
! /*
! * Don't ignore events as described below.
! */
! if(Event.xunmap.event != Event.xunmap.window &&
! (Event.xunmap.event != Scr.Root || !Event.xunmap.send_event) )
! {
! return;
! }
    /*
     * The July 27, 1988 ICCCM spec states that a client wishing to switch
     * to WithdrawnState should send a synthetic UnmapNotify with the
***************
*** 883,891 ****
--- 890,900 ----
     * we looked for the FvwmContext using that field, so try the window
     * field also.
     */
+ weMustUnmap = 0;
    if (!Tmp_win)
      {
        Event.xany.window = Event.xunmap.window;
+ weMustUnmap = 1;
        if (XFindContext(dpy, Event.xany.window,
                         FvwmContext, (caddr_t *)&Tmp_win) == XCNOENT)
          Tmp_win = NULL;
***************
*** 893,898 ****
--- 902,910 ----
    
    if(!Tmp_win)
      return;
+
+ if(weMustUnmap)
+ XUnmapWindow(dpy, Event.xunmap.window);
  
    if(Tmp_win == Scr.Hilite)
      Scr.Hilite = NULL;

End of MIME message
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Nov 26 1996 - 09:10:21 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST