]> git.sur5r.net Git - i3/i3/commitdiff
Call con_activate after moving scratchpad window to current ws 3363/head
authorOrestis Floros <orestisf1993@gmail.com>
Fri, 17 Aug 2018 09:34:20 +0000 (12:34 +0300)
committerOrestis Floros <orestisf1993@gmail.com>
Fri, 17 Aug 2018 09:34:20 +0000 (12:34 +0300)
Fixes #3361

src/scratchpad.c
testcases/t/299-regress-scratchpad-focus.t [new file with mode: 0644]

index 2774396f01614514df5f09f198c67cb8a6ad1937..d564bf3208e1ac7768522db2c9ca9a09295a0a44 100644 (file)
@@ -141,6 +141,7 @@ bool scratchpad_show(Con *con) {
             DLOG("Found a visible scratchpad window on another workspace,\n");
             DLOG("moving it to this workspace: con = %p\n", walk_con);
             con_move_to_workspace(walk_con, focused_ws, true, false, false);
+            con_activate(con_descend_focused(walk_con));
             return true;
         }
     }
diff --git a/testcases/t/299-regress-scratchpad-focus.t b/testcases/t/299-regress-scratchpad-focus.t
new file mode 100644 (file)
index 0000000..504ecd3
--- /dev/null
@@ -0,0 +1,33 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Please read the following documents before working on tests:
+# • https://build.i3wm.org/docs/testsuite.html
+#   (or docs/testsuite)
+#
+# • https://build.i3wm.org/docs/lib-i3test.html
+#   (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • https://build.i3wm.org/docs/ipc.html
+#   (or docs/ipc)
+#
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
+#   (unless you are already familiar with Perl)
+#
+# Regression test: verify that a scratchpad container that was open in another
+# workspace and is moved to the current workspace after a 'scratchpad show' is
+# focused.
+# Ticket: #3361
+# Bug still in: 4.15-190-g4b3ff9cd
+use i3test;
+
+my $expected_focus = open_window;
+cmd 'move to scratchpad';
+cmd 'scratchpad show';
+my $ws = fresh_workspace;
+open_window;
+cmd 'scratchpad show';
+sync_with_i3;
+is($x->input_focus, $expected_focus->id, 'scratchpad window brought from other workspace is focused');
+
+done_testing;