This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit ff293d12d28989119513116043c8ed46983e8311
Author: Kim Woelders <[email protected]>
AuthorDate: Sun Dec 11 08:53:21 2022 +0100

    ewins: Tweak spurious MapRequest handling
    
    Some clients produce multiple MapRequests (presumably by doing
    multiple XMapWindow()s early, which hits case "B").
    Not sure when case "A" is hit, maybe in connection with incorrect
    iconification or withdrawal and re-map.
    
    Now we only reparent (and move) if not already reparented, and place
    correcly in the no-container case (which most likely is to do nothing
    as the window probably already is parented/placed correctly).
    Also always print a message to the console on spurious MapRequests.
    
    This fixes client window placement within the frame in the no-container
    case with some clients.
---
 src/ewins.c | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/ewins.c b/src/ewins.c
index a37b3198..222c5723 100644
--- a/src/ewins.c
+++ b/src/ewins.c
@@ -1134,6 +1134,30 @@ EwinWithdraw(EWin * ewin, Win to)
    EUngrabServer();
 }
 
+static void
+_EwinRemanage(EWin * ewin, const char *str)
+{
+   int                 reparent, move = 0;
+#if USE_CONTAINER_WIN
+   int                 x = 0, y = 0;
+#else
+   const EImageBorder *pad = BorderGetSize(ewin->border);
+   int                 x = (pad) ? pad->left : 0;
+   int                 y = (pad) ? pad->top : 0;
+
+   move = WinGetX(EwinGetContainerWin(ewin)) != x ||
+      WinGetY(EwinGetContainerWin(ewin)) != y;
+#endif
+
+   reparent = WinGetParent(EwinGetClientWin(ewin)) != EwinGetContainerWin(ewin);
+
+   Eprintf("%s: Already managing %s %#x %s: rp=%d mo=%d\n", __func__, str,
+	   EwinGetClientXwin(ewin), EwinGetTitle(ewin), reparent, move);
+
+   if (reparent || move)
+      EReparentWindow(EwinGetClientWin(ewin), EwinGetContainerWin(ewin), x, y);
+}
+
 static void
 EwinEventMapRequest(EWin * ewin, XEvent * ev)
 {
@@ -1148,13 +1172,7 @@ EwinEventMapRequest(EWin * ewin, XEvent * ev)
 	else if (ewin->state.state == EWIN_STATE_WITHDRAWN)
 	   AddToFamily(ewin, xwin, NULL, 0);
 	else
-	  {
-	     if (EDebug(EDBUG_TYPE_EWINS))
-		Eprintf("%s: Already managing %s %#x\n", __func__, "A",
-			EwinGetClientXwin(ewin));
-	     EReparentWindow(EwinGetClientWin(ewin), EwinGetContainerWin(ewin),
-			     0, 0);
-	  }
+	   _EwinRemanage(ewin, "A");
      }
    else
      {
@@ -1164,11 +1182,8 @@ EwinEventMapRequest(EWin * ewin, XEvent * ev)
 	/* Some clients MapRequest more than once ?!? */
 	if (ewin)
 	  {
-	     if (EDebug(EDBUG_TYPE_EWINS))
-		Eprintf("%s: Already managing %s %#x\n", __func__, "B",
-			EwinGetClientXwin(ewin));
-	     EReparentWindow(EwinGetClientWin(ewin), EwinGetContainerWin(ewin),
-			     0, 0);
+	     /* Client has probably issued multiple XMapWindow()s */
+	     _EwinRemanage(ewin, "B");
 	     EwinShow(ewin);
 	  }
 	else
@@ -2559,7 +2574,7 @@ EwinHandleEventsToplevel(Win win __UNUSED__, XEvent * ev, void *prm)
 	if (EwinHandleContainerEvents(ewin, ev))
 	   break;
 #if DEBUG_EWIN_EVENTS
-	Eprintf("%s: type=%2d win=%#lx: %s\n", __func__,
+	Eprintf("%s: type=%2d win=%#x: %s\n", __func__,
 		ev->type, EwinGetClientXwin(ewin), EwinGetTitle(ewin));
 #endif
 	break;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to