Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'vanilla/master' into gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Airblader committed Apr 23, 2020
2 parents 238d6d3 + dae37a9 commit f1ff320
Show file tree
Hide file tree
Showing 17 changed files with 195 additions and 92 deletions.
2 changes: 1 addition & 1 deletion I3_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.18-non-git
4.18.1-non-git
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ EXTRA_DIST = \
I3_VERSION \
LICENSE \
PACKAGE-MAINTAINER \
RELEASE-NOTES-4.18 \
RELEASE-NOTES-4.18.1 \
generate-command-parser.pl \
parser-specs/commands.spec \
parser-specs/config.spec \
Expand Down
71 changes: 0 additions & 71 deletions RELEASE-NOTES-4.18

This file was deleted.

32 changes: 32 additions & 0 deletions RELEASE-NOTES-4.18.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

┌──────────────────────────────┐
│ Release notes for i3 v4.18.1 │
└──────────────────────────────┘

This is i3 v4.18.1. This version is considered stable. All users of i3 are
strongly encouraged to upgrade.

This is a bugfix release for v4.18.

┌────────────────────────────┐
│ Bugfixes │
└────────────────────────────┘

• Move parent nodes in scratchpad correctly
• i3bar: Call cont_child() more liberally
• Fix load_layout crash when floating node doesn't have CT_FLOATING_CON parent
• Fix SEGFAULT when i3bar receives invalid input
• Revert "floating_reposition: avoid extra tree_render"
• Call tree_render if floating move changes workspace
• Update EWMH properties on workspace move
• cmd_focus_sibling: Fix crash on workspace level

┌────────────────────────────┐
│ Thanks! │
└────────────────────────────┘

Thanks for testing, bugfixes, discussions and everything I forgot go out to:

Heman Gandhi, Orestis Floros

-- Michael Stapelberg, 2020-04-22
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Run autoreconf -fi to generate a configure script from this file.

AC_PREREQ([2.69])
AC_INIT([i3], [4.18], [https://github.com/i3/i3/issues])
AC_INIT([i3], [4.18.1], [https://github.com/i3/i3/issues])
# For AX_EXTEND_SRCDIR
AX_ENABLE_BUILDDIR
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2])
Expand Down
1 change: 0 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ i3-wm (4.16.1-1) unstable; urgency=medium

* New upstream release.

>>>>>>> vanilla/next
-- Michael Stapelberg <[email protected]> Sun, 27 Jan 2019 16:45:11 +0100

i3-wm (4.16-1) unstable; urgency=medium
Expand Down
15 changes: 15 additions & 0 deletions i3bar/src/child.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ static int stdin_map_key(void *context, const unsigned char *key, size_t len) {

static int stdin_boolean(void *context, int val) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "urgent") == 0) {
ctx->block.urgent = val;
return 1;
Expand All @@ -208,6 +213,11 @@ static int stdin_boolean(void *context, int val) {

static int stdin_string(void *context, const unsigned char *val, size_t len) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "full_text") == 0) {
ctx->block.full_text = i3string_from_markup_with_length((const char *)val, len);
return 1;
Expand Down Expand Up @@ -260,6 +270,11 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {

static int stdin_integer(void *context, long long val) {
parser_ctx *ctx = context;

if (!ctx->last_map_key) {
return 0;
}

if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
ctx->block.min_width = (uint32_t)val;
return 1;
Expand Down
8 changes: 1 addition & 7 deletions i3bar/src/xcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,20 +677,14 @@ static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
continue;
}
if (output->bar.id == event->window) {
if (output->visible == visible) {
return;
}
output->visible = visible;
}
num_visible += output->visible;
}

if (num_visible == 0) {
stop_child();
} else if (num_visible == visible) {
/* Wake the child only when transitioning from 0 to 1 visible bar.
* We cannot transition from 0 to 2 or more visible bars at once since
* visibility events are delivered to each window separately */
} else {
cont_child();
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,16 @@ void cmd_focus_sibling(I3_CMD, const char *direction_str) {
}
Con *next = get_tree_next_sibling(current->con, direction);
if (next) {
con_activate(next);
if (next->type == CT_WORKSPACE) {
/* On the workspace level, we need to make sure that the
* workspace change happens properly. However, workspace_show
* descends focus so we also have to put focus on the workspace
* itself to maintain consistency. See #3997. */
workspace_show(next);
con_focus(next);
} else {
con_activate(next);
}
}
}

Expand Down Expand Up @@ -1517,7 +1526,7 @@ void cmd_move_direction(I3_CMD, const char *direction_str, long move_px) {
break;
}

floating_reposition(current->con->parent, newrect);
cmd_output->needs_tree_render = floating_reposition(current->con->parent, newrect);
} else {
tree_move(current->con, direction);
cmd_output->needs_tree_render = true;
Expand Down
7 changes: 2 additions & 5 deletions src/floating.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,16 +745,13 @@ bool floating_reposition(Con *con, Rect newrect) {

con->rect = newrect;

bool reassigned = floating_maybe_reassign_ws(con);
floating_maybe_reassign_ws(con);

/* If this is a scratchpad window, don't auto center it from now on. */
if (con->scratchpad_state == SCRATCHPAD_FRESH)
con->scratchpad_state = SCRATCHPAD_CHANGED;

/* Workspace change will already result in a tree_render. */
if (!reassigned) {
tree_render();
}
tree_render();
return true;
}

Expand Down
13 changes: 13 additions & 0 deletions src/load_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ static int json_end_map(void *ctx) {
con_attach(json_node, json_node->parent, true);
LOG("Creating window\n");
x_con_init(json_node);

/* Fix erroneous JSON input regarding floating containers to avoid
* crashing, see #3901. */
const int old_floating_mode = json_node->floating;
if (old_floating_mode >= FLOATING_AUTO_ON && json_node->parent->type != CT_FLOATING_CON) {
LOG("Fixing floating node without CT_FLOATING_CON parent\n");

/* Force floating_enable to work */
json_node->floating = FLOATING_AUTO_OFF;
floating_enable(json_node, false);
json_node->floating = old_floating_mode;
}

json_node = json_node->parent;
incomplete--;
DLOG("incomplete = %d\n", incomplete);
Expand Down
2 changes: 1 addition & 1 deletion src/scratchpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool scratchpad_show(Con *con) {
floating->scratchpad_state != SCRATCHPAD_NONE) {
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_move_to_workspace(floating, focused_ws, true, false, false);
con_activate(con_descend_focused(walk_con));
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/workspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ void workspace_move_to_output(Con *ws, Output *output) {
workspace_show(ws);
}

ewmh_update_desktop_properties();

if (!previously_visible_ws) {
return;
}
Expand Down
26 changes: 26 additions & 0 deletions testcases/t/185-scratchpad.t
Original file line number Diff line number Diff line change
Expand Up @@ -548,5 +548,31 @@ is ($x->input_focus, $second->id, 'moving scratchpad window does not show it');
cmd '[id=' . $first->id . '] move position center';
is ($x->input_focus, $second->id, 'centering scratchpad window does not show it');

###################################################################################
# Verify that a scratchpad container with child containers that was open in
# another workspace is moved to the current workspace (with all its children)
# after a scratchpad show.
################################################################################

kill_all_windows;
open_window;
open_window;
# This is to dodge the edge case were the whole workspace is moved
# window-by-window into the scratchpad.
cmd 'layout tabbed';
cmd 'focus parent';
cmd 'move to scratchpad';
$ws = fresh_workspace;
cmd 'scratchpad show';
# Case 1: a parent node in the scratchpad does not lose children
# Note on the layout: there should be a floating tabbed container, which is
# represented as follows:
# [workspace object] -> [floating_nodes] -> [tabbed node container] -> [the 2 children we expect]
is(scalar @{get_ws($ws)->{floating_nodes}->[0]->{nodes}->[0]->{nodes}}, 2, 'both windows moved from scratchpad to this workspace');

# Case 2: a parent node in the scratchpad from another workspace does not lose children
$ws = fresh_workspace;
cmd 'scratchpad show';
is(scalar @{get_ws($ws)->{floating_nodes}->[0]->{nodes}->[0]->{nodes}}, 2, 'both windows moved from scratchpad focused on other workspace to this workspace');

done_testing;
46 changes: 45 additions & 1 deletion testcases/t/215-layout-restore-crash.t
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ subtest 'issue 2755' => sub {
EOT
$fh->flush;
$reply = cmd "append_layout $filename";
ok(!$reply->[0]->{success}, 'IPC reply indicated success');
ok(!$reply->[0]->{success}, 'IPC reply did not indicate success');

does_i3_live;

Expand Down Expand Up @@ -276,5 +276,49 @@ does_i3_live;

close($fh);

################################################################################
# Issue with floating key being set, without proper parent
# See #3901
################################################################################
subtest 'issue 3901' => sub {
kill_all_windows;
$ws = fresh_workspace;
is(scalar @{get_ws($ws)->{floating_nodes}}, 0, 'No floating nodes yet');

($fh, $filename) = tempfile(UNLINK => 1);
print $fh <<'EOT';
// vim:ts=4:sw=4:et
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_on", // crashes: user_on, auto_on, no crash: user_off, auto_off
"geometry": {
"height": 400,
"width": 300,
"x": 820,
"y": 350
},
"name": "Click me to crash",
"percent": 0.5, // still crashes if this field is absent
"swallows": [
{
"class": "^this doesn't matter as long as it doesn't match a new window$"
}
],
"type": "con"
}
EOT
$fh->flush;
$reply = cmd "append_layout $filename";
ok($reply->[0]->{success}, 'IPC reply indicated success');

cmd '[floating] focus';
is(scalar @{get_ws($ws)->{floating_nodes}}, 1, 'one floating node on this ws');

does_i3_live;

close($fh);
};

done_testing;
12 changes: 12 additions & 0 deletions testcases/t/307-focus-next-prev.t
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ cmp_tree(
cmd 'focus parent, focus next sibling';
});

# See #3997
cmd 'workspace 2';
open_window;
cmd 'workspace 1';
open_window;
cmd 'focus parent, focus parent, focus next sibling, focus prev sibling';
does_i3_live;
is(focused_ws, '1', 'Back and forth between workspaces');

cmd 'focus parent, focus parent, focus next sibling';
is(focused_ws, '2', "Workspace 2 focused with 'focus next sibling'");

done_testing;
Loading

0 comments on commit f1ff320

Please sign in to comment.