fix(xrandr): Ignore harmless extension errors
Closes jaagr/lemonbuddy#106
This commit is contained in:
parent
65b921ecd9
commit
5323167b1e
@ -38,20 +38,20 @@ namespace randr_util {
|
|||||||
auto outputs = conn.get_screen_resources(root).outputs();
|
auto outputs = conn.get_screen_resources(root).outputs();
|
||||||
|
|
||||||
for (auto it = outputs.begin(); it != outputs.end(); it++) {
|
for (auto it = outputs.begin(); it != outputs.end(); it++) {
|
||||||
|
try {
|
||||||
auto info = conn.get_output_info(*it);
|
auto info = conn.get_output_info(*it);
|
||||||
|
|
||||||
if (info->connection != XCB_RANDR_CONNECTION_CONNECTED)
|
if (info->connection != XCB_RANDR_CONNECTION_CONNECTED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto crtc = conn.get_crtc_info(info->crtc);
|
auto crtc = conn.get_crtc_info(info->crtc);
|
||||||
string name{info.name().begin(), info.name().end()};
|
string name{info.name().begin(), info.name().end()};
|
||||||
|
|
||||||
monitors.emplace_back(make_monitor(name, crtc->width, crtc->height, crtc->x, crtc->y));
|
monitors.emplace_back(make_monitor(name, crtc->width, crtc->height, crtc->x, crtc->y));
|
||||||
|
} catch (const xpp::randr::error::bad_crtc&) {
|
||||||
|
} catch (const xpp::randr::error::bad_output&) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// use the same sort algo as lemonbar, to match the defaults
|
// use the same sort algo as lemonbar, to match the defaults
|
||||||
sort(monitors.begin(), monitors.end(),
|
sort(monitors.begin(), monitors.end(), [](monitor_t& m1, monitor_t& m2) -> bool {
|
||||||
[](monitor_t& m1, monitor_t& m2) -> bool {
|
|
||||||
if (m1->x < m2->x || m1->y + m1->h <= m2->y)
|
if (m1->x < m2->x || m1->y + m1->h <= m2->y)
|
||||||
return 1;
|
return 1;
|
||||||
if (m1->x > m2->x || m1->y + m1->h > m2->y)
|
if (m1->x > m2->x || m1->y + m1->h > m2->y)
|
||||||
|
Loading…
Reference in New Issue
Block a user