]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/i3test.pm
Merge pull request #1805 from lasers/next
[i3/i3] / testcases / lib / i3test.pm
index d71a6e86cb9ece155cf90a67093cfb7b2aeb6567..ac1a26cadbd4d691350f3a53e02e102c2d84f917 100644 (file)
@@ -226,7 +226,7 @@ you might have to map it on your own and use this function:
 sub wait_for_map {
     my ($win) = @_;
     my $id = (blessed($win) && $win->isa('X11::XCB::Window')) ? $win->id : $win;
-    wait_for_event 2, sub {
+    wait_for_event 4, sub {
         $_[0]->{response_type} == MAP_NOTIFY and $_[0]->{window} == $id
     };
 }
@@ -248,7 +248,7 @@ event.
 sub wait_for_unmap {
     my ($win) = @_;
     # my $id = (blessed($win) && $win->isa('X11::XCB::Window')) ? $win->id : $win;
-    wait_for_event 2, sub {
+    wait_for_event 4, sub {
         $_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id
     };
     sync_with_i3();
@@ -337,6 +337,7 @@ sub open_window {
     $args{name} //= 'Window ' . counter_window();
 
     my $window = $x->root->create_child(%args);
+    $window->add_hint('input');
 
     if ($before_map) {
         # TODO: investigate why _create is not needed
@@ -605,7 +606,7 @@ sub get_dock_clients {
 
 =head2 cmd($command)
 
-Sends the specified command to i3.
+Sends the specified command to i3 and returns the output.
 
   my $ws = unused_workspace;
   cmd "workspace $ws";
@@ -714,8 +715,10 @@ sub sync_with_i3 {
     # event mask, it will get the ClientMessage.
     $x->send_event(0, $root, EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
 
+    return $myrnd if $args{dont_wait_for_event};
+
     # now wait until the reply is here
-    return wait_for_event 2, sub {
+    return wait_for_event 4, sub {
         my ($event) = @_;
         # TODO: const
         return 0 unless $event->{response_type} == 161;
@@ -781,7 +784,7 @@ To avoid caching:
 =cut
 sub get_socket_path {
     my ($cache) = @_;
-    $cache ||= 1;
+    $cache //= 1;
 
     if ($cache && defined($_cached_socket_path)) {
         return $_cached_socket_path;