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
This commit is contained in:
patrick96 2019-06-24 17:59:24 +02:00 committed by Patrick Ziegler
parent 2edd8275ff
commit 52000c194a
3 changed files with 4 additions and 4 deletions

View File

@ -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); 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_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); 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()) { if (monitors.empty()) {
throw application_error("No monitors found"); 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 still not found (and not strict matching), get first connected monitor
if (monitor_name.empty() && !m_opts.monitor_strict) { 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()) { if (!connected_monitors.empty()) {
monitor_name = connected_monitors[0]->name; monitor_name = connected_monitors[0]->name;
m_log.warn("No monitor specified, using \"%s\"", monitor_name); m_log.warn("No monitor specified, using \"%s\"", monitor_name);

View File

@ -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) { if (screen->width_in_pixels != m_size.w || screen->height_in_pixels != m_size.h) {
changed = true; changed = true;
} else { } 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++) { for (size_t n = 0; n < monitors.size(); n++) {
if (n < m_monitors.size() && monitors[n]->output != m_monitors[n]->output) { if (n < m_monitors.size() && monitors[n]->output != m_monitors[n]->output) {
changed = true; changed = true;

View File

@ -20,7 +20,7 @@ namespace modules {
: static_module<xbacklight_module>(bar, move(name_)), m_connection(connection::make()) { : static_module<xbacklight_module>(bar, move(name_)), m_connection(connection::make()) {
auto output = m_conf.get(name(), "output", m_bar.monitor->name); 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); m_output = randr_util::match_monitor(monitors, output, bar.monitor_exact);