Subject: [PATCH] Fix FvwmAuto reraising

From: Bjoern Steinbrink <[email-masked]>
Date: Mon, 21 Jun 2004 00:28:43 +0200

Hi,

i've tried to use FvwmAuto to automatically shade windows, emulating
auto-hide panels. For example my FvwmPager is in the upper-right corner
and shaded, if i put the mouse over it, it is automatically unshaded, if
the mouse leaves it, it is shaded again.

The problem with FvwmAuto is that if the mouse leaves the window for a
short time (less then the delay set for FvwmAuto) and re-enters it,
FvwmAuto calls both, the leave and enter functions, on the window, which
results in the mouse leaving the window again when it is shaded (leave)
and re-entering again when it is unshaded (enter), creating a loop. This
leads to flickering of the window.

You can reproduce this using:
Module FvwmAuto 500 -menterleave "Silent WindowShade" \
"Silent WindowShade"

Then enter a window with the mouse (a shaded one will probably work
better), leave it for a short amount of time and re-enter it.

The attached patch simply compares the last 'raised' window (which would
be 'lowered') to the one that has been entered, if they are the same,
the action is canceled.

Please CC me when replying.

Bjoern
Index: fvwm/modules/ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v
retrieving revision 1.1112
diff -u -r1.1112 ChangeLog
--- fvwm/modules/ChangeLog	8 Jun 2004 17:40:51 -0000	1.1112
+++ fvwm/modules/ChangeLog	20 Jun 2004 22:01:23 -0000
@@ -1,3 +1,9 @@
+2004-06-20  Bjoern Steinbrink <[email-masked]>
+
+	* FvwmAuto/FvwmAuto.c (main):
+	Added check to avoid calling enter and leave function for the same window
+	if the focus was lost for less than delay time.
+
 2004-06-08  Dominik Vogt  <[email-masked]>
 
 	* FvwmWinList/ButtonArray.c (DoButton):
Index: fvwm/modules/FvwmAuto/FvwmAuto.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmAuto/FvwmAuto.c,v
retrieving revision 1.44
diff -u -r1.44 FvwmAuto.c
--- fvwm/modules/FvwmAuto/FvwmAuto.c	6 Jul 2003 14:34:07 -0000	1.44
+++ fvwm/modules/FvwmAuto/FvwmAuto.c	20 Jun 2004 22:01:23 -0000
@@ -402,6 +402,10 @@
 					have_new_window = 1;
 					raise_window_now = 0;
 				}
+				else if (focus_win == last_win)
+				{
+					have_new_window = 0;
+				}
 				else
 				{
 					myfprintf((stderr,