-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi list,

finally again an awesome patch. ;)

The C code in client_manage() recursively follows transient_fors to find the
top-level transient_for client. It then places the new client on this screen.

Then, later on the lua manage hook is run which ends up running
awful.tag.withcurrent() (registered to the manage hook in the same file). This
function places the new window on its direct transient_for's window. Thus, the C
code's screen is always overwritten anyway.

The attached patch just makes the C code select the same screen that
awful.tag.withcurrent later on select again. Alternatively one could remove that
code from the C core completely, but I like the attached solution more.

Uli
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBCAAGBQJKfJM1AAoJECLkKOvLj8sGRfMIAKDW43KeaZgM4V+hXCrbE8yF
L4b1jVZejInmtW177dEnI/l72ZBOxwHB9pHr6GHM3AN7ud0lubixZ1U6LSOmWsjW
1z1dOLN192OofUZemZi+HqBggeW4d8tn+JvjF+HzXO47bqn/+esROsxewA5CW2HV
caRxYxz/yOV+zaM0B+CW6Vr3h4lBbjpd407Etqr5b6e6vpdY+t5Q7/KNrFKUGzkF
sISn/wb7u68n0VHGJ/Lw3qRR53bKUOG37GB/I/r5CgjHuTXGyemkaeX088WTTjbl
jhk2zNI+h4O0Ib/hGzh+M9IIhQBfywtxkU6uIP1P4A5Oss682JOpv8E/aaOFVHo=
=HcZq
-----END PGP SIGNATURE-----
>From feb1c98218c9e56e8feab8480acae0cefcc174de Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psyc...@znc.in>
Date: Fri, 7 Aug 2009 22:30:32 +0200
Subject: [PATCH] Don't follow transient_fors recursivly in client_map()

This code uses the top-most transient_for to decide on which screen this window
should appear, but awful.tag.withcurrent (which is attached to the manage hook)
will move it to the direct transient_for's screen anyway, effectively disabling
the effect of this for loop. Therefor this change shouldn't really result in any
behavior change.

Plus this improves our reaction to transient_fors which form a loop. Before we
went into an endless loop in the for loop which this patch removes. After this
patch, we will enter an endless loop in the client_raise() call in
client_manage(). No idea for that one. :/

Signed-off-by: Uli Schlachter <psyc...@znc.in>
---
 client.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/client.c b/client.c
index 5589fa8..8be4065 100644
--- a/client.c
+++ b/client.c
@@ -493,7 +493,7 @@ void
 client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, bool startup)
 {
     xcb_get_property_cookie_t ewmh_icon_cookie;
-    client_t *c, *tc = NULL;
+    client_t *c;
     screen_t *screen;
     const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK };
 
@@ -550,10 +550,9 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
     property_update_wm_transient_for(c, NULL);
     property_update_wm_client_leader(c, NULL);
 
-    /* Recursively find the parent. */
-    for(tc = c; tc->transient_for; tc = tc->transient_for);
-    if(tc != c && tc->phys_screen == c->phys_screen)
-        screen = tc->screen;
+    /* Move this client to its parent's screen */
+    if(c->transient_for && c->transient_for->phys_screen == c->phys_screen)
+        screen = c->transient_for->screen;
 
     /* Then check clients hints */
     ewmh_client_check_hints(c);
-- 
1.6.3.3

Reply via email to