]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/i3test.pm
Merge branch 'master' into next
[i3/i3] / testcases / lib / i3test.pm
index 8204f842de85a24f154ca59bafec3fc0842e4f91..f7be1b665d8a9f3eb8697e1d27a7bbf155ce97a2 100644 (file)
@@ -247,7 +247,7 @@ sub open_empty_con {
     my ($i3) = @_;
 
     my $reply = $i3->command('open')->recv;
-    return $reply->{id};
+    return $reply->[0]->{id};
 }
 
 sub get_workspace_names {
@@ -409,16 +409,22 @@ sub focused_ws {
 # See also docs/testsuite for a long explanation
 #
 sub sync_with_i3 {
+    my %args = @_ == 1 ? %{$_[0]} : @_;
+
     # Since we need a (mapped) window for receiving a ClientMessage, we create
     # one on the first call of sync_with_i3. It will be re-used in all
     # subsequent calls.
-    if (!defined($_sync_window)) {
+    if (!exists($args{window_id}) &&
+        (!defined($_sync_window) || exists($args{no_cache}))) {
         $_sync_window = open_window(
             rect => [ -15, -15, 10, 10 ],
             override_redirect => 1,
         );
     }
 
+    my $window_id = delete $args{window_id};
+    $window_id //= $_sync_window->id;
+
     my $root = $x->get_root_window();
     # Generate a random number to identify this particular ClientMessage.
     my $myrnd = int(rand(255)) + 1;
@@ -431,7 +437,7 @@ sub sync_with_i3 {
          $root,  # destination window
          $x->atom(name => 'I3_SYNC')->id,
 
-         $_sync_window->id,    # data[0]: our own window id
+         $window_id,    # data[0]: our own window id
          $myrnd, # data[1]: a random value to identify the request
          0,
          0,