fix(client): unsubscribe after receiving xdg_output.done event

Ignore any further xdg_output events. Name and description are constant
for the lifetime of wl_output in xdg-output-unstable-v1 version 2 and we
don't need other properties.

Fixes #990.
This commit is contained in:
Aleksei Bavshin 2021-01-20 19:36:16 -08:00
parent ab0f2c13af
commit 7fa1c11833
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
1 changed files with 3 additions and 3 deletions

View File

@ -123,14 +123,14 @@ void waybar::Client::handleOutputDone(void *data, struct zxdg_output_v1 * /*xdg_
spdlog::debug("Output detection done: {} ({})", output.name, output.identifier);
auto configs = client->getOutputConfigs(output);
if (configs.empty()) {
output.xdg_output.reset();
} else {
if (!configs.empty()) {
wl_display_roundtrip(client->wl_display);
for (const auto &config : configs) {
client->bars.emplace_back(std::make_unique<Bar>(&output, config));
}
}
// unsubscribe
output.xdg_output.reset();
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}