Merge pull request #5172 from khaneliman/fix/label-markup-cache-pua-collation
fix(label): compare markup cache by raw bytes, not collation
This commit is contained in:
+5
-2
@@ -87,8 +87,11 @@ class ALabel : public AModule {
|
|||||||
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
|
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<Glib::ustring> last_label_markup_;
|
// Raw UTF-8 bytes, not Glib::ustring: ustring::operator== collates with
|
||||||
std::optional<Glib::ustring> last_tooltip_markup_;
|
// g_utf8_collate(), which gives private-use codepoints (nerd-font icons)
|
||||||
|
// no collation weight, so two different icons compare equal.
|
||||||
|
std::optional<std::string> last_label_markup_;
|
||||||
|
std::optional<std::string> last_tooltip_markup_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace waybar
|
} // namespace waybar
|
||||||
|
|||||||
+4
-4
@@ -147,22 +147,22 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
|
|||||||
auto ALabel::update() -> void { AModule::update(); }
|
auto ALabel::update() -> void { AModule::update(); }
|
||||||
|
|
||||||
bool ALabel::setLabelMarkup(const Glib::ustring& markup) {
|
bool ALabel::setLabelMarkup(const Glib::ustring& markup) {
|
||||||
if (last_label_markup_ == markup) {
|
if (last_label_markup_ == markup.raw()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
label_.set_markup(markup);
|
label_.set_markup(markup);
|
||||||
last_label_markup_ = markup;
|
last_label_markup_ = markup.raw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ALabel::setTooltipMarkup(const Glib::ustring& markup) {
|
bool ALabel::setTooltipMarkup(const Glib::ustring& markup) {
|
||||||
if (last_tooltip_markup_ == markup) {
|
if (last_tooltip_markup_ == markup.raw()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
label_.set_tooltip_markup(markup);
|
label_.set_tooltip_markup(markup);
|
||||||
last_tooltip_markup_ = markup;
|
last_tooltip_markup_ = markup.raw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user