From: johannes karoff Date: Mon, 26 Sep 2016 16:45:58 +0000 (+0200) Subject: do not match docks in config and command criteria (#2340) X-Git-Tag: 4.13~32 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1437271e6568ab627536d85babd7a9f9f2fe7ae3;p=i3%2Fi3 do not match docks in config and command criteria (#2340) --- diff --git a/src/ipc.c b/src/ipc.c index a6c45ed1..bf529b17 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -480,7 +480,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { if (match->restart_mode) continue; y(map_open); - if (match->dock != -1) { + if (match->dock != M_DONTCHECK) { ystr("dock"); y(integer, match->dock); ystr("insert_where"); diff --git a/src/load_layout.c b/src/load_layout.c index 863770b7..a3b44756 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -48,6 +48,7 @@ static int json_start_map(void *ctx) { LOG("creating new swallow\n"); current_swallow = smalloc(sizeof(Match)); match_init(current_swallow); + current_swallow->dock = M_DONTCHECK; TAILQ_INSERT_TAIL(&(json_node->swallow_head), current_swallow, matches); swallow_is_empty = true; } else { diff --git a/src/match.c b/src/match.c index d072b85f..ba87eb23 100644 --- a/src/match.c +++ b/src/match.c @@ -27,7 +27,6 @@ */ void match_init(Match *match) { memset(match, 0, sizeof(Match)); - match->dock = M_DONTCHECK; match->urgent = U_DONTCHECK; /* we use this as the placeholder value for "not set". */ match->window_type = UINT32_MAX; @@ -53,7 +52,7 @@ bool match_is_empty(Match *match) { match->id == XCB_NONE && match->window_type == UINT32_MAX && match->con_id == NULL && - match->dock == -1 && + match->dock == M_NODOCK && match->floating == M_ANY); } diff --git a/src/restore_layout.c b/src/restore_layout.c index 7e1b78ae..da018b9e 100644 --- a/src/restore_layout.c +++ b/src/restore_layout.c @@ -240,6 +240,7 @@ static void open_placeholder_window(Con *con) { /* create temporary id swallow to match the placeholder */ Match *temp_id = smalloc(sizeof(Match)); match_init(temp_id); + temp_id->dock = M_DONTCHECK; temp_id->id = placeholder; TAILQ_INSERT_HEAD(&(con->swallow_head), temp_id, matches); } diff --git a/testcases/t/264-dock-criteria.t b/testcases/t/264-dock-criteria.t new file mode 100644 index 00000000..cbbdeb0f --- /dev/null +++ b/testcases/t/264-dock-criteria.t @@ -0,0 +1,71 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://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) +# +# Verifies that command or config criteria does not match dock clients +# Bug still in: 4.12-38-ge690e3d +use i3test i3_autostart => 0; + +my $config = < $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), + wm_class => "x" +}); + +is(get_dock_clients, 1, "created one docked client"); +is_num_children($ws, 0, 'no container on the current workspace'); + +cmd '[class="^x$"] move workspace current'; + +does_i3_live +is(get_dock_clients, 1, "one docked client after move"); +is_num_children($ws, 0, 'no container on the current workspace'); + +cmd '[class="^x$"] fullscreen'; + +does_i3_live +is(get_dock_clients, 1, "one docked client after fullscreen"); +is_num_children($ws, 0, 'no container on the current workspace'); + +cmd '[class="^x$"] kill'; + +does_i3_live +is(get_dock_clients, 1, "one docked client after kill"); +is_num_children($ws, 0, 'no container on the current workspace'); + + +## config criteria should not match dock windows +open_window({ + window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), + wm_class => "dock" +}); + +does_i3_live +is(get_dock_clients, 2, "created second docked client"); +is_num_children($ws, 0, 'no container on the current workspace'); + + +exit_gracefully($pid); +done_testing;