Implement the window::fullscreen_mode event
The fullscreen_mode event is a window with the "change" property set to "fullscreen_mode". This event should be emitted whenever a window enters or exits fullscreen mode. This event can be used to turn off dpms off when a window is fullscreen or display the fullscreen container name in the status line for instance.
This commit is contained in:
parent
2f42fe61d9
commit
8146638320
10
docs/ipc
10
docs/ipc
@ -634,7 +634,7 @@ mode (2)::
|
||||
window (3)::
|
||||
Sent when a client's window is successfully reparented (that is when i3
|
||||
has finished fitting it into a container), when a window received input
|
||||
focus or when a window title has been updated.
|
||||
focus or when certain properties of the window have changed.
|
||||
barconfig_update (4)::
|
||||
Sent when the hidden_state or mode field in the barconfig of any bar
|
||||
instance was updated and when the config is reloaded.
|
||||
@ -714,8 +714,12 @@ mode is simply named default.
|
||||
=== window event
|
||||
|
||||
This event consists of a single serialized map containing a property
|
||||
+change (string)+ which indicates the type of the change ("focus", "new",
|
||||
"title").
|
||||
+change (string)+ which indicates the type of the change
|
||||
|
||||
* +new+ - the window has become managed by i3
|
||||
* +focus+ - the window has received input focus
|
||||
* +title+ - the window's title has changed
|
||||
* +fullscreen_mode+ - the window has entered or exited fullscreen mode
|
||||
|
||||
Additionally a +container (object)+ field will be present, which consists
|
||||
of the window's parent container. Be aware that for the "new" event, the
|
||||
|
@ -609,6 +609,9 @@ void con_toggle_fullscreen(Con *con, int fullscreen_mode) {
|
||||
|
||||
DLOG("mode now: %d\n", con->fullscreen_mode);
|
||||
|
||||
/* Send an ipc window "fullscreen_mode" event */
|
||||
ipc_send_window_event("fullscreen_mode", con);
|
||||
|
||||
/* update _NET_WM_STATE if this container has a window */
|
||||
/* TODO: when a window is assigned to a container which is already
|
||||
* fullscreened, this state needs to be pushed to the client, too */
|
||||
|
59
testcases/t/225-ipc-window-fullscreen.t
Normal file
59
testcases/t/225-ipc-window-fullscreen.t
Normal file
@ -0,0 +1,59 @@
|
||||
#!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)
|
||||
#
|
||||
# Tests that the ipc window::fullscreen_mode event works properly
|
||||
#
|
||||
# Bug still in: 4.7.2-135-g7deb23c
|
||||
use i3test;
|
||||
|
||||
my $i3 = i3(get_socket_path());
|
||||
$i3->connect()->recv;
|
||||
|
||||
my $cv;
|
||||
my $t;
|
||||
|
||||
sub reset_test {
|
||||
$cv = AE::cv;
|
||||
$t = AE::timer(0.5, 0, sub { $cv->send(0); });
|
||||
}
|
||||
|
||||
reset_test;
|
||||
|
||||
$i3->subscribe({
|
||||
window => sub {
|
||||
my ($e) = @_;
|
||||
if ($e->{change} eq 'fullscreen_mode') {
|
||||
$cv->send($e->{container});
|
||||
}
|
||||
},
|
||||
})->recv;
|
||||
|
||||
my $window = open_window;
|
||||
|
||||
cmd 'fullscreen';
|
||||
my $con = $cv->recv;
|
||||
|
||||
ok($con, 'got fullscreen window event (on)');
|
||||
is($con->{fullscreen_mode}, 1, 'window is fullscreen');
|
||||
|
||||
reset_test;
|
||||
cmd 'fullscreen';
|
||||
$con = $cv->recv;
|
||||
|
||||
ok($con, 'got fullscreen window event (off)');
|
||||
is($con->{fullscreen_mode}, 0, 'window is not fullscreen');
|
||||
|
||||
done_testing;
|
Loading…
Reference in New Issue
Block a user