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.
This commit is contained in:
Thomas Adam 2017-06-08 11:55:29 +01:00
parent 7ba5028697
commit 482a383afa

View File

@ -1126,12 +1126,6 @@ get_randr_monitors (void)
else else
free(name); 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 { else {
// There's no need to handle rotated screens here (see #69) // There's no need to handle rotated screens here (see #69)
@ -1150,36 +1144,12 @@ get_randr_monitors (void)
if (num_outputs) if (num_outputs)
free(output_names); free(output_names);
// Check for clones and inactive outputs if (valid == 0) {
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) {
fprintf(stderr, "No usable RandR output found\n"); fprintf(stderr, "No usable RandR output found\n");
return; return;
} }
monitor_t m[valid]; monitor_create_chain(mons, valid);
for (i = j = 0; i < num && j < valid; i++)
if (mons[i].width != 0)
m[j++] = mons[i];
monitor_create_chain(m, valid);
} }
#ifdef WITH_XINERAMA #ifdef WITH_XINERAMA