Merge pull request #905 from JordanL2/master

Tooltips no longer completely break if a custom module updates too frequently
This commit is contained in:
Alex 2020-10-31 14:04:41 +01:00 committed by GitHub
commit 5600783151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,11 +131,15 @@ auto waybar::modules::Custom::update() -> void {
label_.set_markup(str); label_.set_markup(str);
if (tooltipEnabled()) { if (tooltipEnabled()) {
if (text_ == tooltip_) { if (text_ == tooltip_) {
if (label_.get_tooltip_markup() != str) {
label_.set_tooltip_markup(str); label_.set_tooltip_markup(str);
}
} else { } else {
if (label_.get_tooltip_markup() != tooltip_) {
label_.set_tooltip_markup(tooltip_); label_.set_tooltip_markup(tooltip_);
} }
} }
}
auto classes = label_.get_style_context()->list_classes(); auto classes = label_.get_style_context()->list_classes();
for (auto const& c : classes) { for (auto const& c : classes) {
label_.get_style_context()->remove_class(c); label_.get_style_context()->remove_class(c);