Bugfix: Make level up a noop during fullscreen mode (+testcase) (Thanks dothebart)
Fixes #341
This commit is contained in:
parent
74b90cd83f
commit
86637d2e07
|
@ -264,11 +264,17 @@ void tree_split(Con *con, orientation_t orientation) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void level_up() {
|
void level_up() {
|
||||||
|
/* We cannot go up when we are in fullscreen mode at the moment, that would
|
||||||
|
* be totally not intuitive */
|
||||||
|
if (focused->fullscreen_mode != CF_NONE) {
|
||||||
|
LOG("Currently in fullscreen, not going up\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* We can focus up to the workspace, but not any higher in the tree */
|
/* We can focus up to the workspace, but not any higher in the tree */
|
||||||
if ((focused->parent->type != CT_CON &&
|
if ((focused->parent->type != CT_CON &&
|
||||||
focused->parent->type != CT_WORKSPACE) ||
|
focused->parent->type != CT_WORKSPACE) ||
|
||||||
focused->type == CT_WORKSPACE) {
|
focused->type == CT_WORKSPACE) {
|
||||||
printf("cannot go up\n");
|
LOG("Cannot go up any further\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
con_focus(focused->parent);
|
con_focus(focused->parent);
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!perl
|
||||||
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
#
|
||||||
|
# Regression test: level up should be a noop during fullscreen mode
|
||||||
|
#
|
||||||
|
use X11::XCB qw(:all);
|
||||||
|
use Time::HiRes qw(sleep);
|
||||||
|
use i3test;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use_ok('X11::XCB::Window');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $x = X11::XCB::Connection->new;
|
||||||
|
my $i3 = i3("/tmp/nestedcons");
|
||||||
|
|
||||||
|
my $tmp = get_unused_workspace;
|
||||||
|
cmd "workspace $tmp";
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# open a window, verify it’s not in fullscreen mode
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
my $win = open_standard_window($x);
|
||||||
|
|
||||||
|
my $nodes = get_ws_content $tmp;
|
||||||
|
is(@$nodes, 1, 'exactly one client');
|
||||||
|
is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen');
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# make it fullscreen
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
cmd 'nop making fullscreen';
|
||||||
|
cmd 'fullscreen';
|
||||||
|
|
||||||
|
my $nodes = get_ws_content $tmp;
|
||||||
|
is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now');
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# send level up, try to un-fullscreen
|
||||||
|
#####################################################################
|
||||||
|
cmd 'level up';
|
||||||
|
cmd 'fullscreen';
|
||||||
|
|
||||||
|
my $nodes = get_ws_content $tmp;
|
||||||
|
is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen any longer');
|
||||||
|
|
||||||
|
does_i3_live;
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
Reference in New Issue