Subject: Patch to prevent spurious M_NEW_PAGE being broadcast

From: Tim Phipps <[email-masked]>
Date: Fri, 15 Mar 2002 14:08:48 +0000

Hi All,
	I tracked down an endless loop with FvwmIconMan caused by

*FvwmIconMan: *Action Select SendCommand FlipFocus
*FvwmEvent: new_page my_geom_record_all

my_geom_record_all has a "PipeRead "bash -c ' echo AddToFunc...'" in and 
I think fvwm has recently started to grab the pointer with PipeRead.

The loop starts when you move the pointer to a button in FvwmIconMan. A 
FlipFocus is performed which results in an M_NEW_PAGE -> FvwmEvent -> 
my_geom_record_all -> PipeRead -> grab -> leave/eneter event to 
FvwmIconMan -> FlipFocus.

I think it's the PipeRead but I'm not sure, anyway a sensible fix is to 
not send an M_NEW_PAGE if the page hasn't changed and the attached patch 
is very simple. Is there any reason to send M_NEW_PAGE when the page 
doesn't change?

Cheers,
Tim.

Index: fvwm/virtual.c
===================================================================
RCS file: /u/phippst/share/cvsroot/fvwm/fvwm/virtual.c,v
retrieving revision 1.26
diff -u -r1.26 virtual.c
--- fvwm/virtual.c	2002/03/13 13:42:59	1.26
+++ fvwm/virtual.c	2002/03/15 13:52:19
@@ -991,11 +991,11 @@
   }
   Scr.Vx = newx;
   Scr.Vy = newy;
-  BroadcastPacket(
-    M_NEW_PAGE, 5, Scr.Vx, Scr.Vy, Scr.CurrentDesk, Scr.VxMax, Scr.VyMax);
 
   if (deltax || deltay)
   {
+    BroadcastPacket(
+      M_NEW_PAGE, 5, Scr.Vx, Scr.Vy, Scr.CurrentDesk, Scr.VxMax, Scr.VyMax);
 
     /*
      * RBW - 11/13/1998	 - new:	 chase the chain bidirectionally, all at once!

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 15 Mar 2002 18:07:50 +0100

> is very simple. Is there any reason to send M_NEW_PAGE when the page 

Yes.  It's necessary to force a M_NEW_PAGE packet when the desk
changes but the viewport does not move.  Some of the modules need
the message in this case.  I can't remember which modules.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
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: Tim Phipps <[email-masked]>
Date: Mon, 18 Mar 2002 11:17:30 +0000

> the message in this case.  I can't remember which modules.

I had a trawl through the recent module code and found the following 
uses of M_NEW_PAGE and M_NEW_DESK:

FvwmAnimate: just stashes the desk and page numbers, it deals with 
M_NEW_DESK in the same way so doesn't need the redundant M_NEW_PAGE. The 
strange thing is that FvwmAnimate doesn't ask for M_NEW_PAGE or 
M_NEW_DESK in the message mask???

FvwmBacker: stashes the new page and desk and then calls the same 
function as it does when M_NEW_DESK arrives. This looks like it's OK.

FvwmButtons: only processes M_NEW_PAGE in an #ifdef DEBUG_FVWM section 
to print out the message contents. It's OK

FvwmCommand: uses the message to print out the new page. It's OK unless 
someone has a script built on this that doesn't handle the M_NEW_DESK 
output.

FvwmDebug: just prints out the new page/desk. It's OK.

FvwmIconMan: already has code in it to avoid processing redundant 
M_NEW_PAGE messages so it's OK and that bit of code could be stripped 
out (grep for "Useless NEW_PAGE received\n").

FvwmPager: handles both M_NEW_PAGE and M_NEW_DESK with the same function 
for desk changes so it's OK.

FvwmSave: doesn't understand desks so it's OK.

FvwmSaveDesk: doesn't parse the desk field of M_NEW_PAGE so it's broken 
already, it relies on M_NEW_DESK for the current desk.

FvwmTaskBar: doesn't ask for and ignores M_NEW_PAGE messages so it's OK.

So unless someone has a buggy FvwmCommand based script to do stuff on 
desk/page changes the patch won't affect anything.

Cheers,
Tim.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 19 Mar 2002 21:43:38 +0100

> uses of M_NEW_PAGE and M_NEW_DESK:

Okay.  I think FvwmIconMan and/or FvwmPager were the culprits, but
I seem to have fixed there problems already.  I'll apply the patch.

Bye

Dominik ^_^  ^_^