From 52000c194a91f7304e9c9ecc9cf01c77d03be03a Mon Sep 17 00:00:00 2001 From: patrick96 Date: Mon, 24 Jun 2019 17:59:24 +0200 Subject: [PATCH] fix(xrandr): Fetch cloned monitors where possible Removing monitors is not really necessary when selecting the monitor where to render the bar or choosing the backlight. Since both monitors occupy the same coordinates rendering can be done on both and it's better to give people felxibility for the backlight. Fixes #1191 --- src/components/bar.cpp | 4 ++-- src/components/screen.cpp | 2 +- src/modules/xbacklight.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/bar.cpp b/src/components/bar.cpp index b3577cc3..efa6af98 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -76,7 +76,7 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const auto monitor_name_fallback = m_conf.get(bs, "monitor-fallback", ""s); m_opts.monitor_strict = m_conf.get(bs, "monitor-strict", m_opts.monitor_strict); m_opts.monitor_exact = m_conf.get(bs, "monitor-exact", m_opts.monitor_exact); - auto monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, m_opts.monitor_strict); + auto monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, m_opts.monitor_strict, false); if (monitors.empty()) { throw application_error("No monitors found"); @@ -94,7 +94,7 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const // if still not found (and not strict matching), get first connected monitor if (monitor_name.empty() && !m_opts.monitor_strict) { - auto connected_monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, true); + auto connected_monitors = randr_util::get_monitors(m_connection, m_connection.screen()->root, true, false); if (!connected_monitors.empty()) { monitor_name = connected_monitors[0]->name; m_log.warn("No monitor specified, using \"%s\"", monitor_name); diff --git a/src/components/screen.cpp b/src/components/screen.cpp index a943ec98..a206b539 100644 --- a/src/components/screen.cpp +++ b/src/components/screen.cpp @@ -101,7 +101,7 @@ void screen::handle(const evt::randr_screen_change_notify& evt) { if (screen->width_in_pixels != m_size.w || screen->height_in_pixels != m_size.h) { changed = true; } else { - auto monitors = randr_util::get_monitors(m_connection, m_root, true); + auto monitors = randr_util::get_monitors(m_connection, m_root, true, false); for (size_t n = 0; n < monitors.size(); n++) { if (n < m_monitors.size() && monitors[n]->output != m_monitors[n]->output) { changed = true; diff --git a/src/modules/xbacklight.cpp b/src/modules/xbacklight.cpp index e9baf5d3..99b388c1 100644 --- a/src/modules/xbacklight.cpp +++ b/src/modules/xbacklight.cpp @@ -20,7 +20,7 @@ namespace modules { : static_module(bar, move(name_)), m_connection(connection::make()) { auto output = m_conf.get(name(), "output", m_bar.monitor->name); - auto monitors = randr_util::get_monitors(m_connection, m_connection.root(), bar.monitor_strict); + auto monitors = randr_util::get_monitors(m_connection, m_connection.root(), bar.monitor_strict, false); m_output = randr_util::match_monitor(monitors, output, bar.monitor_exact);