fix(ui): restore bar clicks on text by defaulting Label to non-hit-testable

This commit is contained in:
Ly-sec
2026-05-03 16:14:25 +02:00
parent 36a8fa5227
commit 4b963bea2c
3 changed files with 6 additions and 4 deletions
-1
View File
@@ -300,7 +300,6 @@ void TaskbarWidget::buildTaskButtons(Renderer& renderer) {
auto* badgePtr = static_cast<Box*>(badgeHit->addChild(std::move(badge)));
auto badgeText = std::make_unique<Label>();
badgeText->setHitTestVisible(false);
badgeText->setText(ws.label);
badgeText->setBold(true);
badgeText->setFontSize(badgeFontSize);
@@ -213,9 +213,6 @@ void WorkspacesWidget::rebuild(Renderer& renderer) {
if (showLabel) {
auto text = std::make_unique<Label>();
// Label is an InputArea; without this, clicks on glyphs hit the label and
// never reach the workspace slot's onClick on the parent InputArea.
text->setHitTestVisible(false);
text->setText(labels[i]);
text->setFontSize(labelFontSize);
text->setBold(true);
+6
View File
@@ -22,6 +22,10 @@ Label::Label() : InputArea() {
m_textNode->setFontSize(Style::fontSizeBody);
applyPalette();
m_paletteConn = paletteChanged().connect([this] { applyPalette(); });
// Label is an InputArea; pointer hits on glyphs would otherwise stop here and
// never reach a parent InputArea (e.g. bar clock/media). Hover-only marquee
// opts back in via syncHoverInteraction().
setHitTestVisible(false);
}
bool Label::setText(std::string_view text) {
@@ -148,8 +152,10 @@ void Label::syncHoverInteraction() {
if (!m_autoScroll || !m_autoScrollHoverOnly) {
setOnEnter(nullptr);
setOnLeave(nullptr);
setHitTestVisible(false);
return;
}
setHitTestVisible(true);
setOnEnter([this](const PointerData&) { restartScrollIfNeeded(); });
setOnLeave([this]() { restartScrollIfNeeded(); });
}