Implement RandR 1.5 support (#2580)

This comes with the intentionally undocumented --disable-randr15 command
line flag and disable-randr15 configuration directive. We will add
documentation before the release if and only if it turns out that users
actually need to use this flag in their setups. Ideally, nobody would
need to use the flag and everything would just keep working, but it’s
better to be safe than sorry.

fixes #1799
This commit is contained in:
Michael Stapelberg
2016-11-28 18:20:46 +01:00
committed by GitHub
parent f2ffd8d864
commit 633a9f7b14
12 changed files with 259 additions and 53 deletions

View File

@ -294,7 +294,6 @@ static void read_server_x11_packet_cb(EV_P_ ev_io *w, int revents) {
if (sequence == connstate->getmonitors) {
printf("RRGetMonitors reply!\n");
xcb_randr_get_monitors_reply_t *reply = packet;
if (injected_reply != NULL) {
printf("injecting reply\n");
((generic_x11_reply_t *)injected_reply)->sequence = sequence;

View File

@ -467,6 +467,8 @@ my $expected_all_tokens = "ERROR: CONFIG: Expected one of these tokens: <end>, '
force_focus_wrapping
force_xinerama
force-xinerama
disable_randr15
disable-randr15
workspace_auto_back_and_forth
fake_outputs
fake-outputs

View File

@ -66,7 +66,42 @@ close($outfh);
my $pid = launch_with_config($config, inject_randr15 => $outname);
cmd 'nop';
my $tree = i3->get_tree->recv;
my @outputs = map { $_->{name} } @{$tree->{nodes}};
is_deeply(\@outputs, [ '__i3', 'DP3' ], 'outputs are __i3 and DP3');
my ($dp3) = grep { $_->{name} eq 'DP3' } @{$tree->{nodes}};
is_deeply($dp3->{rect}, {
width => 3840,
height => 2160,
x => 0,
y => 0,
}, 'Output DP3 at 3840x2160+0+0');
exit_gracefully($pid);
################################################################################
# Verify that adding monitors with RandR 1.5 results in i3 outputs.
################################################################################
# When inject_randr15 is defined but false, fake-xinerama will be turned off,
# but inject_randr15 will not actually be used.
my $pid = launch_with_config($config, inject_randr15 => '');
$tree = i3->get_tree->recv;
@outputs = map { $_->{name} } @{$tree->{nodes}};
is_deeply(\@outputs, [ '__i3', 'default' ], 'outputs are __i3 and default');
SKIP: {
skip 'xrandr --setmonitor failed (xrandr too old?)', 1 unless
system(q|xrandr --setmonitor up2414q 3840/527x2160/296+1280+0 none|) == 0;
sync_with_i3;
$tree = i3->get_tree->recv;
@outputs = map { $_->{name} } @{$tree->{nodes}};
is_deeply(\@outputs, [ '__i3', 'default', 'up2414q' ], 'outputs are __i3, default and up2414q');
}
exit_gracefully($pid);