On Sun, Nov 20, 2016 at 10:02:39PM +0000, Jürgen Hartmann wrote:
> > > What is the secret behind this move? How does it work?
> >
> > I have no idea, and I'd not even call that a workaround.  It just
> > seems that if you change random things, it starts to work.
> 
> I see. That obsoletes my next question in the queue addressing side effects.
> 
> What would you propose to proceed?

1) Don't panic.  ;)
2) Try the attached patch.

Now, if I'd understand what (a) the patch in
HandleMapRequestKeepRaised() is supposed to do, and (b) why
XUnmapWIndow() is called in HandleUnmapNotify(), I think I could
write a decent fix instead of jsut disabling the parts of the code
that cause trouble.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
>From c179137faffbdebc5e2875a0f418b4679dc4fe94 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <dominik.v...@gmx.de>
Date: Sun, 20 Nov 2016 23:47:52 +0100
Subject: [PATCH] fix

---
 fvwm/events.c |   33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/fvwm/events.c b/fvwm/events.c
index cc4cc8f..93cb251 100644
--- a/fvwm/events.c
+++ b/fvwm/events.c
@@ -518,6 +518,7 @@ static Bool test_map_request(
 	return rc;
 }
 
+#if 0 /*!!!*/
 /* Test for ICCCM2 withdraw requests by syntetic events on the root window */
 static Bool test_withdraw_request(
 	Display *display, XEvent *event, XPointer arg)
@@ -544,6 +545,7 @@ static Bool test_withdraw_request(
 
 	return rc;
 }
+#endif
 
 static int _pred_weed_accumulate_expose(
 	Display *display, XEvent *ev, XPointer arg)
@@ -3339,6 +3341,7 @@ void HandleMapRequestKeepRaised(
 	/* If the window has never been mapped before ... */
 	if (!fw || (fw && DO_REUSE_DESTROYED(fw)))
 	{
+#if 0 /*!!!*/
 		check_if_event_args args;
 		XEvent dummy;
 
@@ -3392,6 +3395,7 @@ void HandleMapRequestKeepRaised(
 
 			return;
 		}
+#endif
 
 		/* Add decorations. */
 		fw = AddWindow(
@@ -4159,20 +4163,31 @@ void HandleUnmapNotify(const evh_args_t *ea)
 	XEvent dummy;
 	XEvent map_event;
 	const XEvent *te = ea->exc->x.etrigger;
-	int weMustUnmap;
 	Bool focus_grabbed;
 	Bool must_return = False;
 	Bool do_map = False;
+	int do_unmap;
 	FvwmWindow * const fw = ea->exc->w.fw;
 	Window pw;
 	Window cw;
 
 	DBUG("HandleUnmapNotify", "Routine Entered");
 
-	/* Don't ignore events as described below. */
-	if (te->xunmap.event != te->xunmap.window &&
-	   (te->xunmap.event != Scr.Root || !te->xunmap.send_event))
+	if (te->xunmap.event == te->xunmap.window)
+	{
+		/* Handle normally. */
+		do_unmap = 1;
+	}
+	else if (te->xunmap.event == Scr.Root && te->xunmap.send_event)
+	{
+		/* Synthetic event on the root window; the client should have
+		 * taken care of calling XUnmapWindow. */
+		do_unmap = 0;
+	}
+	else
 	{
+		/* Nothing to do except updating some states. */
+		do_unmap = 0;
 		must_return = True;
 	}
 
@@ -4183,10 +4198,12 @@ void HandleUnmapNotify(const evh_args_t *ea)
 	 * unmapped (which is the case for fvwm for IconicState).
 	 * Unfortunately, we looked for the FvwmContext using that field, so
 	 * try the window field also. */
-	weMustUnmap = 0;
-	if (!fw)
+	if (fw)
+	{
+		do_unmap = 0;
+	}
+	else
 	{
-		weMustUnmap = 1;
 		if (XFindContext(
 			    dpy, te->xunmap.window, FvwmContext,
 			    (caddr_t *)&fw) == XCNOENT)
@@ -4206,7 +4223,7 @@ void HandleUnmapNotify(const evh_args_t *ea)
 		return;
 	}
 
-	if (weMustUnmap)
+	if (do_unmap)
 	{
 		Bool is_map_request_pending;
 		check_if_event_args args;
-- 
1.7.10.4

Reply via email to