From 482a383afa237a22351a908fa0fbb1e54432a015 Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Thu, 8 Jun 2017 11:55:29 +0100 Subject: [PATCH] Don't ignore valid monitors Rather than assume monitors are valid based on their width, just let the usual RandR detection handle that. This addresses the problem of lemonbar "missing" certain monitors. There's still more work to do here, but this is a stop-gap measure for now. --- lemonbar.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/lemonbar.c b/lemonbar.c index 6d4cd6a..7478a47 100644 --- a/lemonbar.c +++ b/lemonbar.c @@ -1126,12 +1126,6 @@ get_randr_monitors (void) else free(name); } - // if this output is not in the list, skip it - if (j == num_outputs) { - mons[i].width = 0; - free(oi_reply); - continue; - } } else { // There's no need to handle rotated screens here (see #69) @@ -1150,36 +1144,12 @@ get_randr_monitors (void) if (num_outputs) free(output_names); - // Check for clones and inactive outputs - for (i = 0; i < num; i++) { - if (mons[i].width == 0) - continue; - - for (j = 0; j < num; j++) { - // Does I contain J ? - - if (i != j && mons[j].width && !mons[j].name) { - if (mons[j].x >= mons[i].x && mons[j].x + mons[j].width <= mons[i].x + mons[i].width && - mons[j].y >= mons[i].y && mons[j].y + mons[j].height <= mons[i].y + mons[i].height) { - mons[j].width = 0; - valid--; - } - } - } - } - - if (valid < 1) { + if (valid == 0) { fprintf(stderr, "No usable RandR output found\n"); return; } - monitor_t m[valid]; - - for (i = j = 0; i < num && j < valid; i++) - if (mons[i].width != 0) - m[j++] = mons[i]; - - monitor_create_chain(m, valid); + monitor_create_chain(mons, valid); } #ifdef WITH_XINERAMA