Bugfix: set WM_STATE to WITHDRAWN when an app unmaps their window(s) (+test)
Fixes: #362
This commit is contained in:
parent
62e977102b
commit
836a3ad615
@ -139,8 +139,11 @@ bool tree_close(Con *con, bool kill_window, bool dont_kill_parent) {
|
|||||||
} else {
|
} else {
|
||||||
/* un-parent the window */
|
/* un-parent the window */
|
||||||
xcb_reparent_window(conn, con->window->id, root, 0, 0);
|
xcb_reparent_window(conn, con->window->id, root, 0, 0);
|
||||||
/* TODO: client_unmap to set state to withdrawn */
|
/* We are no longer handling this window, thus set WM_STATE to
|
||||||
|
* WM_STATE_WITHDRAWN (see ICCCM 4.1.3.1) */
|
||||||
|
long data[] = { XCB_ICCCM_WM_STATE_WITHDRAWN, XCB_NONE };
|
||||||
|
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, con->window->id,
|
||||||
|
A_WM_STATE, A_WM_STATE, 32, 2, data);
|
||||||
}
|
}
|
||||||
FREE(con->window->class_class);
|
FREE(con->window->class_class);
|
||||||
FREE(con->window->class_instance);
|
FREE(con->window->class_instance);
|
||||||
|
41
testcases/t/63-wm-state.t
Normal file
41
testcases/t/63-wm-state.t
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!perl
|
||||||
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
#
|
||||||
|
# Tests if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when
|
||||||
|
# unmapped.
|
||||||
|
#
|
||||||
|
use X11::XCB qw(:all);
|
||||||
|
use i3test;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use_ok('X11::XCB::Window');
|
||||||
|
use_ok('X11::XCB::Event::Generic');
|
||||||
|
use_ok('X11::XCB::Event::MapNotify');
|
||||||
|
use_ok('X11::XCB::Event::ClientMessage');
|
||||||
|
}
|
||||||
|
|
||||||
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
|
my $window = $x->root->create_child(
|
||||||
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
rect => [ 0, 0, 30, 30 ],
|
||||||
|
background_color => '#00ff00',
|
||||||
|
event_mask => [ 'structure_notify' ],
|
||||||
|
);
|
||||||
|
|
||||||
|
$window->name('Window 1');
|
||||||
|
$window->map;
|
||||||
|
|
||||||
|
diag('window mapped');
|
||||||
|
|
||||||
|
sleep 0.5;
|
||||||
|
|
||||||
|
is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal');
|
||||||
|
|
||||||
|
$window->unmap;
|
||||||
|
|
||||||
|
sleep 0.5;
|
||||||
|
|
||||||
|
is($window->state, ICCCM_WM_STATE_WITHDRAWN, 'WM_STATE withdrawn');
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
x
Reference in New Issue
Block a user