]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/113-urgent.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 113-urgent.t
index 2eb853de1cd958c4880ac934aee76ba7698b7a9a..e88c37a283e366ca03bf0e02aff4b257746edf26 100644 (file)
@@ -24,8 +24,11 @@ my $_NET_WM_STATE_TOGGLE = 2;
 sub set_urgency {
     my ($win, $urgent_flag, $type) = @_;
     if ($type == 1) {
+        # Because X11::XCB does not keep track of clearing the urgency hint
+        # when receiving focus, we just delete it in all cases and then re-set
+        # it if appropriate.
+        $win->delete_hint('urgency');
         $win->add_hint('urgency') if ($urgent_flag);
-        $win->delete_hint('urgency') if (!$urgent_flag);
     } elsif ($type == 2) {
         my $msg = pack "CCSLLLLLL",
             X11::XCB::CLIENT_MESSAGE, # response_type
@@ -50,10 +53,10 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
 force_display_urgency_hint 0ms
 EOT
 
-my $type;
+my ($type, $tmp, $w1, $w2);
 for ($type = 1; $type <= 2; $type++) {
     my $pid = launch_with_config($config);
-    my $tmp = fresh_workspace;
+    $tmp = fresh_workspace;
 
 #####################################################################
 # Create two windows and put them in stacking mode
@@ -266,8 +269,8 @@ for ($type = 1; $type <= 2; $type++) {
     my $ws1 = fresh_workspace;
     my $ws2 = fresh_workspace;
     cmd "workspace $ws1";
-    my $w1 = open_window;
-    my $w2 = open_window;
+    $w1 = open_window;
+    $w2 = open_window;
     cmd "workspace $ws2";
     sync_with_i3;
     set_urgency($w1, 1, $type);
@@ -281,10 +284,10 @@ for ($type = 1; $type <= 2; $type++) {
 ##############################################################################
 # Check if urgent flag can be unset if we move the window out of the container
 ##############################################################################
-    my $tmp = fresh_workspace;
+    $tmp = fresh_workspace;
     cmd 'layout tabbed';
-    my $w1 = open_window;
-    my $w2 = open_window;
+    $w1 = open_window;
+    $w2 = open_window;
     sync_with_i3;
     cmd '[id="' . $w2->id . '"] focus';
     sync_with_i3;
@@ -304,6 +307,33 @@ for ($type = 1; $type <= 2; $type++) {
     my $ws = get_ws($tmp);
     ok(!$ws->{urgent}, 'urgent flag not set on workspace');
 
+##############################################################################
+# Regression test for #1187: Urgency hint moves to new workspace when moving
+# a container to another workspace.
+##############################################################################
+
+    my $tmp_source = fresh_workspace;
+    my $tmp_target = fresh_workspace;
+    cmd 'workspace ' . $tmp_source;
+    sync_with_i3;
+    $w1 = open_window;
+    $w2 = open_window;
+    sync_with_i3;
+    cmd '[id="' . $w1->id . '"] focus';
+    sync_with_i3;
+    cmd 'mark urgent_con';
+    cmd '[id="' . $w2->id . '"] focus';
+    set_urgency($w1, 1, $type);
+    sync_with_i3;
+    cmd '[con_mark="urgent_con"] move container to workspace ' . $tmp_target;
+    sync_with_i3;
+    my $source_ws = get_ws($tmp_source);
+    my $target_ws = get_ws($tmp_target);
+    ok(!$source_ws->{urgent}, 'Source workspace is no longer marked urgent');
+    is($target_ws->{urgent}, 1, 'Target workspace is now marked urgent');
+
+##############################################################################
+
     exit_gracefully($pid);
 }