Compare commits
	
		
			No commits in common. "d166d88388f23e4f366983ba1bddf3835a744f02" and "e1cf524c576cf7d54354e27520a456425c2e3d1a" have entirely different histories.
		
	
	
		
			d166d88388
			...
			e1cf524c57
		
	
		
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@ -3,7 +3,7 @@ module git.tebibyte.media/tomo/backend
 | 
			
		||||
go 1.20
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
	git.tebibyte.media/tomo/tomo v0.45.0
 | 
			
		||||
	git.tebibyte.media/tomo/tomo v0.43.0
 | 
			
		||||
	git.tebibyte.media/tomo/typeset v0.7.1
 | 
			
		||||
	git.tebibyte.media/tomo/xgbkb v1.0.1
 | 
			
		||||
	github.com/jezek/xgb v1.1.1
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
 | 
			
		||||
git.tebibyte.media/tomo/tomo v0.45.0 h1:fQH0WIPidW275hOq9dE6R7p064xG1RGx2QU68Avlr84=
 | 
			
		||||
git.tebibyte.media/tomo/tomo v0.45.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
 | 
			
		||||
git.tebibyte.media/tomo/tomo v0.43.0 h1:V0HT+7PluCQIeCrOzYT4s11MXStXPNVJnLZ5AnaOzCM=
 | 
			
		||||
git.tebibyte.media/tomo/tomo v0.43.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
 | 
			
		||||
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
 | 
			
		||||
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
 | 
			
		||||
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
 | 
			
		||||
 | 
			
		||||
@ -27,12 +27,15 @@ 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
 | 
			
		||||
@ -192,6 +195,11 @@ 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()
 | 
			
		||||
@ -227,6 +235,11 @@ 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()
 | 
			
		||||
@ -425,6 +438,11 @@ 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) {
 | 
			
		||||
@ -582,6 +600,15 @@ 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 }
 | 
			
		||||
@ -608,8 +635,7 @@ func (this *box) invalidateMinimum () {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *box) recursiveReApply () {
 | 
			
		||||
	hierarchy := this.getHierarchy()
 | 
			
		||||
	if hierarchy == nil { return }
 | 
			
		||||
	if this.getHierarchy() == nil { return }
 | 
			
		||||
	
 | 
			
		||||
	// re-apply styling, icons *if needed*
 | 
			
		||||
 | 
			
		||||
@ -621,7 +647,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 = hierarchy.newStyleApplicator()
 | 
			
		||||
		this.styleApplicator = this.getHierarchy().newStyleApplicator()
 | 
			
		||||
		this.invalidateStyle()
 | 
			
		||||
		this.on.styleChange.Broadcast()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user