Merge branch 'master' into next
This commit is contained in:
commit
ed957d60a7
|
@ -1238,15 +1238,6 @@ void cmd_focus_level(I3_CMD, char *level) {
|
||||||
*/
|
*/
|
||||||
void cmd_focus(I3_CMD) {
|
void cmd_focus(I3_CMD) {
|
||||||
DLOG("current_match = %p\n", current_match);
|
DLOG("current_match = %p\n", current_match);
|
||||||
if (focused &&
|
|
||||||
focused->type != CT_WORKSPACE &&
|
|
||||||
focused->fullscreen_mode != CF_NONE) {
|
|
||||||
LOG("Cannot change focus while in fullscreen mode.\n");
|
|
||||||
ysuccess(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
owindow *current;
|
|
||||||
|
|
||||||
if (match_is_empty(current_match)) {
|
if (match_is_empty(current_match)) {
|
||||||
ELOG("You have to specify which window/container should be focused.\n");
|
ELOG("You have to specify which window/container should be focused.\n");
|
||||||
|
@ -1263,6 +1254,7 @@ void cmd_focus(I3_CMD) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
owindow *current;
|
||||||
TAILQ_FOREACH(current, &owindows, owindows) {
|
TAILQ_FOREACH(current, &owindows, owindows) {
|
||||||
Con *ws = con_get_workspace(current->con);
|
Con *ws = con_get_workspace(current->con);
|
||||||
/* If no workspace could be found, this was a dock window.
|
/* If no workspace could be found, this was a dock window.
|
||||||
|
@ -1270,6 +1262,17 @@ void cmd_focus(I3_CMD) {
|
||||||
if (!ws)
|
if (!ws)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* Don't allow the focus switch if the focused and current
|
||||||
|
* containers are in the same workspace. */
|
||||||
|
if (focused &&
|
||||||
|
focused->type != CT_WORKSPACE &&
|
||||||
|
focused->fullscreen_mode != CF_NONE &&
|
||||||
|
con_get_workspace(focused) == ws) {
|
||||||
|
LOG("Cannot change focus while in fullscreen mode (same workspace).\n");
|
||||||
|
ysuccess(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* If the container is not on the current workspace,
|
/* If the container is not on the current workspace,
|
||||||
* workspace_show() will switch to a different workspace and (if
|
* workspace_show() will switch to a different workspace and (if
|
||||||
* enabled) trigger a mouse pointer warp to the currently focused
|
* enabled) trigger a mouse pointer warp to the currently focused
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
# vim:ts=4:sw=4:expandtab
|
# vim:ts=4:sw=4:expandtab
|
||||||
#
|
#
|
||||||
# Test if new containers get focused when there is a fullscreen container at
|
# Test if new containers get focused when there is a fullscreen container at
|
||||||
# the time of launching the new one.
|
# the time of launching the new one. Also make sure that focusing containers
|
||||||
|
# in other workspaces work even when there is a fullscreen container.
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
|
@ -85,4 +86,21 @@ is(scalar @$nodes, 2, 'precisely two windows');
|
||||||
is($nodes->[0]->{id}, $old_id, 'id unchanged');
|
is($nodes->[0]->{id}, $old_id, 'id unchanged');
|
||||||
is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
|
is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Make sure it's possible to focus a container in a different workspace even if
|
||||||
|
# we are currently focusing a fullscreen container.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
$tmp2 = fresh_workspace;
|
||||||
|
my $focusable_window = open_window;
|
||||||
|
|
||||||
|
cmd "workspace $tmp";
|
||||||
|
cmd '[id="' . $focusable_window->id . '"] focus';
|
||||||
|
|
||||||
|
is(focused_ws(), $tmp2, 'focus went to a different workspace');
|
||||||
|
|
||||||
|
$nodes = get_ws_content($tmp2);
|
||||||
|
is(scalar @$nodes, 1, 'precisely one window');
|
||||||
|
is($nodes->[0]->{focused}, 1, 'focusable window focused');
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue