Compare commits

...

3 Commits

Author SHA1 Message Date
0d93d73c32 Backend returns CanvasCloser 2024-06-03 20:43:05 -04:00
006921d690 Store Role in Box 2024-06-03 20:42:54 -04:00
f2bcc217a4 Update Tomo API 2024-06-03 20:42:08 -04:00
5 changed files with 16 additions and 8 deletions

5
go.mod
View File

@ -3,11 +3,8 @@ module git.tebibyte.media/tomo/backend
go 1.20
require (
git.tebibyte.media/tomo/tomo v0.34.0
git.tebibyte.media/tomo/tomo v0.35.0
git.tebibyte.media/tomo/typeset v0.7.1
)
require (
git.tebibyte.media/tomo/xgbkb v1.0.1
github.com/jezek/xgb v1.1.1
github.com/jezek/xgbutil v0.0.0-20231116234834-47f30c120111

4
go.sum
View File

@ -1,6 +1,6 @@
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
git.tebibyte.media/tomo/tomo v0.34.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
git.tebibyte.media/tomo/tomo v0.35.0 h1:1XvcUcWg1rBZXov3KfuX6VfiuBQ2mcJHIslHMLn07no=
git.tebibyte.media/tomo/tomo v0.35.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
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=

View File

@ -19,6 +19,8 @@ type box struct {
parent parent
outer anyBox
role tomo.Role
bounds image.Rectangle
minSize image.Point
userMinSize image.Point
@ -106,6 +108,10 @@ func (this *box) MinimumSize () image.Point {
return this.minSize
}
func (this *box) Role () tomo.Role {
return this.role
}
func (this *box) borderSum () tomo.Inset {
sum := tomo.Inset { }
for _, border := range this.border {
@ -182,6 +188,10 @@ func (this *box) SetPadding (padding tomo.Inset) {
this.invalidateMinimum()
}
func (this *box) SetRole (role tomo.Role) {
this.role = role
}
func (this *box) SetDNDData (dat data.Data) {
this.dndData = dat
}

View File

@ -126,7 +126,7 @@ func (this *Backend) NewTexture (source image.Image) canvas.TextureCloser {
return xcanvas.NewTextureFrom(source)
}
func (this *Backend) NewCanvas (bounds image.Rectangle) canvas.Canvas {
func (this *Backend) NewCanvas (bounds image.Rectangle) canvas.CanvasCloser {
return xcanvas.NewCanvas(this.x, bounds)
}

View File

@ -49,9 +49,10 @@ func (this *Canvas) Push (window xproto.Window) {
}
// Close frees this canvas from the X server.
func (this *Canvas) Close () {
func (this *Canvas) Close () error {
this.assert()
this.Image.Destroy()
return nil
}
func (this *Canvas) assert () {