perf(label): skip redundant markup updates
This commit is contained in:
@@ -139,6 +139,26 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
|
||||
|
||||
auto ALabel::update() -> void { AModule::update(); }
|
||||
|
||||
bool ALabel::setLabelMarkup(const Glib::ustring& markup) {
|
||||
if (last_label_markup_ == markup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label_.set_markup(markup);
|
||||
last_label_markup_ = markup;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ALabel::setTooltipMarkup(const Glib::ustring& markup) {
|
||||
if (last_tooltip_markup_ == markup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
label_.set_tooltip_markup(markup);
|
||||
last_tooltip_markup_ = markup;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ALabel::getIcon(uint16_t percentage, const std::string& alt, uint16_t max) {
|
||||
auto format_icons = config_["format-icons"];
|
||||
if (format_icons.isObject()) {
|
||||
|
||||
Reference in New Issue
Block a user