Subject: Notification: incoming/853

From: [email-masked]
Date: Thu, 07 Feb 2002 07:38:36 -0600

FVWM Bug Tracking notification

new message incoming/853

Message summary for PR#853
	From: [email-masked]
	Subject: wrong FvwmWindow.flags.is_map_pending stops iconifying
	Date: Thu, 07 Feb 2002 07:38:35 -0600
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Thu Feb 07 07:38:36 2002
From: [email-masked]
To: [email-masked]
Subject: wrong FvwmWindow.flags.is_map_pending stops iconifying
Date: Thu, 07 Feb 2002 07:38:35 -0600

Full_Name: Markus Schwarzenberg
Version: 2.4.5.
CVS_Date: 
OS: sunos 5.7
X_Server: 
Submission from: (NULL) (153.96.96.2)

after fvwm2 -restart  the FvwmWindow.flags.is_map_pending  bit
sometimes seems not to be set properly. 
This causes the function Iconify(in icons.c) to return in: 

  if (IS_MAP_PENDING(tmp_win))
  {
    /* final state: iconified */
    SET_ICONIFY_AFTER_MAP(tmp_win, 1);
    return;
  }

This makes fvwm2 sometimes refractorily ignoring any Iconify and DeIconify

actions (clicks) for windows which "survived" the restart in an iconified
state.
The bug is hard to reproduce (I have a very lengthy .fvwm2rc which
I don't want to include here) and seems to be related to a FvwmIconBox
running in my FvwmButtons. 

But here is a possible workaround (Beginning of Function Iconify(in
icons.c)):

  void Iconify(FvwmWindow *tmp_win, int def_x, int def_y)  
  {
    FvwmWindow *t;
    FvwmWindow *sf;
    XWindowAttributes winattrs = {0};
    unsigned long eventMask;

    if(!tmp_win)
      return;
  
    if (!XGetWindowAttributes(dpy, tmp_win->w, &winattrs))
    {
      return;
    }
    eventMask = winattrs.your_event_mask;
  
    /* correct is_map_pending if necessary ... */
    if((winattrs.map_state == IsViewable) && IS_MAP_PENDING(tmp_win)) {
      fprintf(stderr, "Window '%s':\nXGetWindowAttributes: IsViewable, but
MAP_PENDING set ... resetting it!\n",
      tmp_win ? tmp_win->name ? tmp_win->name : "NULL_name" : "NULL");
      SET_MAP_PENDING(tmp_win, 0);
    }
  
    if (IS_MAP_PENDING(tmp_win))
    {
      /* final state: iconified */
      SET_ICONIFY_AFTER_MAP(tmp_win, 1);
      return;
    }
  #if 0
    if (tmp_win == Scr.Hilite && HAS_CLICK_FOCUS(tmp_win) &&
tmp_win->next)
    {
    SetFocusWindow(tmp_win->next, 1);
    }
  #endif

    mark_transient_subtree(tmp_win, MARK_ALL_LAYERS, MARK_ALL, False,
True);

...

For me this completely seems to fix the bug. After the session restart
I once see the fprintf-message for every affected window and then fvwm
works OK again (of course the fprintf statement should be converted to
some debug message...).

Markus Schwarzenberg

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: [email-masked] (Markus Schwarzenberg)
Date: Mon, 11 Feb 2002 09:53:51 +0100

On Feb 8, 17:55, Dominik Vogt wrote:
> Subject: Re: Notification: incoming/853
> On Thu, Feb 07, 2002 at 07:38:36AM -0600, fvwm-bug wrote:

[ snip ]

> 
> Can you please make a patch with the 'diff' command?
> 
>   $ diff -u icons.c.orig icons.c
> 

Shure (attached). BTW, in the meantime I added the workaround also to 
the function DeIconify (In very rare circumstances it could
be necessary there too).

Markus Schwarzenberg

--- icons.c.orig	Wed Jan 16 21:39:38 2002
+++ icons.c	Mon Feb 11 09:44:37 2002
@@ -1289,14 +1289,32 @@
   FvwmWindow *t,*tmp;
   FvwmWindow *sf = get_focus_window();
 
-  if (!tmp_win)
+  XWindowAttributes winattrs = {0};
+
+  if(!tmp_win)
+    return;
+  
+  if (!XGetWindowAttributes(dpy, tmp_win->w, &winattrs))
+  {
     return;
+  }
+  
+  /* make shure  tmp_win->flags.is_map_pending  is OK */
+  if((winattrs.map_state == IsViewable) && IS_MAP_PENDING(tmp_win)) {
+    fprintf(stderr,"\
+Window '%s':\nDeIconify: XGetWindowAttributes: IsViewable, \
+but MAP_PENDING set ... resetting it!\n",
+    tmp_win->name ? tmp_win->name : "NULL_name");
+    SET_MAP_PENDING(tmp_win, 0);
+  }
+  
   if (IS_MAP_PENDING(tmp_win))
   {
     /* final state: de-iconified */
     SET_ICONIFY_AFTER_MAP(tmp_win, 0);
     return;
   }
+  
   while (IS_ICONIFIED_BY_PARENT(tmp_win))
   {
     for (t = Scr.FvwmRoot.next; t != NULL; t = t->next)
@@ -1448,17 +1466,28 @@
 
   if(!tmp_win)
     return;
-  if (IS_MAP_PENDING(tmp_win))
+  
+  if (!XGetWindowAttributes(dpy, tmp_win->w, &winattrs))
   {
-    /* final state: iconified */
-    SET_ICONIFY_AFTER_MAP(tmp_win, 1);
     return;
   }
-  if (!XGetWindowAttributes(dpy, tmp_win->w, &winattrs))
+  eventMask = winattrs.your_event_mask;
+  
+  /* make shure  tmp_win->flags.is_map_pending  is OK */
+  if((winattrs.map_state == IsViewable) && IS_MAP_PENDING(tmp_win)) {
+    fprintf(stderr, "\
+Window '%s':\nDeIconify: XGetWindowAttributes: IsViewable, \
+but MAP_PENDING set ... resetting it!\n",
+    tmp_win->name ? tmp_win->name : "NULL_name");
+    SET_MAP_PENDING(tmp_win, 0);
+  }
+  
+  if (IS_MAP_PENDING(tmp_win))
   {
+    /* final state: iconified */
+    SET_ICONIFY_AFTER_MAP(tmp_win, 1);
     return;
   }
-  eventMask = winattrs.your_event_mask;
 #if 0
   if (tmp_win == Scr.Hilite && HAS_CLICK_FOCUS(tmp_win) && tmp_win->next)
   {

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 22 Feb 2002 20:23:27 +0100

> the function DeIconify (In very rare circumstances it could

I've applied that patch.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]