]> git.sur5r.net Git - i3/i3/commitdiff
Properly handle windows unsetting WM_TRANSIENT_FOR (Thanks Janus)
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 26 Aug 2014 08:00:14 +0000 (10:00 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 26 Aug 2014 08:00:14 +0000 (10:00 +0200)
fixes #1351

src/ipc.c
src/render.c
src/window.c
testcases/t/114-client-leader.t

index 59f0938dfb3d7aac4665be84e736af4003272562..03b3d5ad8e2c71323eff1193a958520c42d28627 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -339,6 +339,11 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
             ystr(i3string_as_utf8(con->window->name));
         }
 
+        ystr("transient_for");
+        if (con->window->transient_for == XCB_NONE)
+            y(null);
+        else y(integer, con->window->transient_for);
+
         y(map_close);
     }
 
index ed35eb0c3c0f0772ddf2c6da8472b0e0d1594aa1..3cc5006367eafc021001cfbbed37eda84864e973 100644 (file)
@@ -288,6 +288,8 @@ void render_con(Con *con, bool render_fullscreen) {
                     while (transient_con != NULL &&
                            transient_con->window != NULL &&
                            transient_con->window->transient_for != XCB_NONE) {
+                        DLOG("transient_con = 0x%08x, transient_con->window->transient_for = 0x%08x, fullscreen_id = 0x%08x\n",
+                                transient_con->window->id, transient_con->window->transient_for, fullscreen->window->id);
                         if (transient_con->window->transient_for == fullscreen->window->id) {
                             is_transient_for = true;
                             break;
index 538f4629fd9f86fc109e71f8f256ef5378bdbe8a..e406752a54c63fa5bd2f2b77ddb96419cef407c3 100644 (file)
@@ -125,7 +125,8 @@ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bo
  */
 void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop) {
     if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
-        DLOG("CLIENT_LEADER not set.\n");
+        DLOG("CLIENT_LEADER not set on window 0x%08x.\n", win->id);
+        win->leader = XCB_NONE;
         FREE(prop);
         return;
     }
@@ -149,7 +150,8 @@ void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop) {
  */
 void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop) {
     if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
-        DLOG("TRANSIENT_FOR not set.\n");
+        DLOG("TRANSIENT_FOR not set on window 0x%08x.\n", win->id);
+        win->transient_for = XCB_NONE;
         FREE(prop);
         return;
     }
@@ -160,7 +162,7 @@ void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop)
         return;
     }
 
-    DLOG("Transient for changed to %08x\n", transient_for);
+    DLOG("Transient for changed to 0x%08x (window 0x%08x)\n", transient_for, win->id);
 
     win->transient_for = transient_for;
 
index 63e92c3ca422c6bf8644efd21e269ba980cc3034..1efe34bf67369c5a05dff7211fefb9cd1216eedb 100644 (file)
@@ -99,4 +99,25 @@ is($x->input_focus, $child->id, "Child window focused");
 
 }
 
+################################################################################
+# Verify that transient_for can be set and unset.
+################################################################################
+
+$tmp = fresh_workspace;
+
+$fwindow = open_window({ dont_map => 1 });
+$fwindow->transient_for($right);
+$fwindow->map;
+
+my $floating_con = get_ws($tmp)->{floating_nodes}[0]->{nodes}[0];
+is($floating_con->{window_properties}->{transient_for}, $right->id, 'WM_TRANSIENT_FOR properly parsed');
+
+$x->delete_property($fwindow->id, $x->atom(name => 'WM_TRANSIENT_FOR')->id);
+$x->flush;
+
+sync_with_i3;
+
+$floating_con = get_ws($tmp)->{floating_nodes}[0]->{nodes}[0];
+is($floating_con->{window_properties}->{transient_for}, undef, 'WM_TRANSIENT_FOR properly removed');
+
 done_testing;