From d166d88388f23e4f366983ba1bddf3835a744f02 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 11 Aug 2024 22:29:08 -0400 Subject: [PATCH] Remove AttrIcon from Box implementation --- internal/system/box.go | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/internal/system/box.go b/internal/system/box.go index f2c7ebc..807b84b 100644 --- a/internal/system/box.go +++ b/internal/system/box.go @@ -27,15 +27,12 @@ type box struct { focusQueued *bool attrColor attrHierarchy[tomo.AttrColor] - attrIcon attrHierarchy[tomo.AttrIcon] attrTexture attrHierarchy[tomo.AttrTexture] attrTextureMode attrHierarchy[tomo.AttrTextureMode] attrBorder attrHierarchy[tomo.AttrBorder] attrMinimumSize attrHierarchy[tomo.AttrMinimumSize] attrPadding attrHierarchy[tomo.AttrPadding] - icon canvas.Texture - dndData data.Data dndAccept []data.Mime focusable bool @@ -195,11 +192,6 @@ func (this *box) setAttr (attr tomo.Attr, user bool) { this.invalidateDraw() } - case tomo.AttrIcon: - if this.attrIcon.Set(attr, user) { - this.handleIconChange() - } - case tomo.AttrTexture: if this.attrTexture.Set(attr, user) { this.invalidateDraw() @@ -235,11 +227,6 @@ func (this *box) unsetAttr (kind tomo.AttrKind, user bool) { this.invalidateDraw() } - case tomo.AttrKindIcon: - if this.attrIcon.Unset(user) { - this.handleIconChange() - } - case tomo.AttrKindTexture: if this.attrTexture.Unset(user) { this.invalidateDraw() @@ -438,11 +425,6 @@ func (this *box) Draw (can canvas.Canvas) { if textureMode == tomo.TextureModeCenter && texture != nil { this.centeredTexture(can, texture) } - - // centered icon - if this.icon != nil { - this.centeredTexture(can, this.icon) - } } func (this *box) centeredTexture (can canvas.Canvas, texture canvas.Texture) { @@ -600,15 +582,6 @@ func (this *box) handleBorderChange (previousBorderSum tomo.Inset, different boo } } -func (this *box) handleIconChange () { - this.icon = nil - hierarchy := this.getHierarchy() - if hierarchy == nil { return } - icon := this.attrIcon.Value() - if icon.Icon == tomo.IconUnknown { return } - this.icon = hierarchy.getIconSet().Icon(icon.Icon, icon.Size) -} - func (this *box) invalidateStyle () { hierarchy := this.getHierarchy() if hierarchy == nil { return } @@ -635,7 +608,8 @@ func (this *box) invalidateMinimum () { } func (this *box) recursiveReApply () { - if this.getHierarchy() == nil { return } + hierarchy := this.getHierarchy() + if hierarchy == nil { return } // re-apply styling, icons *if needed* @@ -647,7 +621,7 @@ func (this *box) recursiveReApply () { // information about the boxes they're linked to (like all rules // with a matching role). this.lastStyleNonce = hierarchyStyleNonce - this.styleApplicator = this.getHierarchy().newStyleApplicator() + this.styleApplicator = hierarchy.newStyleApplicator() this.invalidateStyle() this.on.styleChange.Broadcast() }