xrandr: Allow not to purge cloned monitors

This commit is contained in:
patrick96 2019-06-24 17:57:54 +02:00 committed by Patrick Ziegler
parent b5e7078d93
commit cc36350849
2 changed files with 7 additions and 2 deletions

View File

@ -51,7 +51,7 @@ namespace randr_util {
monitor_t make_monitor(xcb_randr_output_t randr, string name, unsigned short int w, unsigned short int h, short int x, short int y, monitor_t make_monitor(xcb_randr_output_t randr, string name, unsigned short int w, unsigned short int h, short int x, short int y,
bool primary); bool primary);
vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only = false); vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only = false, bool purge_clones = true);
monitor_t match_monitor(vector<monitor_t> monitors, const string& name, bool exact_match); monitor_t match_monitor(vector<monitor_t> monitors, const string& name, bool exact_match);
void get_backlight_range(connection& conn, const monitor_t& mon, backlight_values& dst); void get_backlight_range(connection& conn, const monitor_t& mon, backlight_values& dst);

View File

@ -80,7 +80,7 @@ namespace randr_util {
/** /**
* Create a list of all available randr outputs * Create a list of all available randr outputs
*/ */
vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only) { vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only, bool purge_clones) {
vector<monitor_t> monitors; vector<monitor_t> monitors;
#if WITH_XRANDR_MONITORS #if WITH_XRANDR_MONITORS
@ -148,6 +148,11 @@ namespace randr_util {
} }
// Test if there are any clones in the set // Test if there are any clones in the set
if (!purge_clones) {
continue;
}
for (auto& monitor : monitors) { for (auto& monitor : monitors) {
if ((*m) == monitor || monitor->w == 0) { if ((*m) == monitor || monitor->w == 0) {
continue; continue;