Compare commits

..

No commits in common. "ab6bdeaba34341f69fc1d61da326447839722ec5" and "b18f747f0ca40aa41615b017194492932a2e917b" have entirely different histories.

4 changed files with 23 additions and 35 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module git.tebibyte.media/tomo/backend
go 1.20 go 1.20
require ( require (
git.tebibyte.media/tomo/tomo v0.46.0 git.tebibyte.media/tomo/tomo v0.45.0
git.tebibyte.media/tomo/typeset v0.7.1 git.tebibyte.media/tomo/typeset v0.7.1
git.tebibyte.media/tomo/xgbkb v1.0.1 git.tebibyte.media/tomo/xgbkb v1.0.1
github.com/jezek/xgb v1.1.1 github.com/jezek/xgb v1.1.1

4
go.sum
View File

@ -1,6 +1,6 @@
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q= git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
git.tebibyte.media/tomo/tomo v0.46.0 h1:OC18hlnE2PaZmQ5IQx3weMI4ePbZc4kbQDfWP191Bn0= git.tebibyte.media/tomo/tomo v0.45.0 h1:fQH0WIPidW275hOq9dE6R7p064xG1RGx2QU68Avlr84=
git.tebibyte.media/tomo/tomo v0.46.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs= git.tebibyte.media/tomo/tomo v0.45.0/go.mod h1:WrtilgKB1y8O2Yu7X4mYcRiqOlPR8NuUnoA/ynkQWrs=
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8= 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/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE= git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=

View File

@ -146,14 +146,11 @@ func (window *window) updateBounds () {
decorGeometry, _ := window.xWindow.DecorGeometry() decorGeometry, _ := window.xWindow.DecorGeometry()
windowGeometry, _ := window.xWindow.Geometry() windowGeometry, _ := window.xWindow.Geometry()
origin := image.Pt( origin := image.Pt(
decorGeometry.X(), windowGeometry.X() + decorGeometry.X(),
decorGeometry.Y()) windowGeometry.Y() + decorGeometry.Y())
innerOrigin := origin.Add(image.Pt ( window.metrics.bounds = image.Rectangle {
windowGeometry.X(), Min: origin,
windowGeometry.Y())) Max: origin.Add(image.Pt(windowGeometry.Width(), windowGeometry.Height())),
window.metrics.innerBounds = image.Rectangle {
Min: innerOrigin,
Max: innerOrigin.Add(image.Pt(windowGeometry.Width(), windowGeometry.Height())),
} }
} }
@ -164,9 +161,9 @@ func (window *window) handleConfigureNotify (
configureEvent := *event.ConfigureNotifyEvent configureEvent := *event.ConfigureNotifyEvent
configureEvent = window.compressConfigureNotify(configureEvent) configureEvent = window.compressConfigureNotify(configureEvent)
oldBounds := window.metrics.innerBounds oldBounds := window.metrics.bounds
window.updateBounds() window.updateBounds()
newBounds := window.metrics.innerBounds newBounds := window.metrics.bounds
sizeChanged := sizeChanged :=
oldBounds.Dx() != newBounds.Dx() || oldBounds.Dx() != newBounds.Dx() ||

View File

@ -37,8 +37,7 @@ type window struct {
resizeY bool resizeY bool
metrics struct { metrics struct {
bounds image.Rectangle // bounds, including frame bounds image.Rectangle
innerBounds image.Rectangle // bounds of the drawable area
} }
onClose event.FuncBroadcaster onClose event.FuncBroadcaster
@ -157,7 +156,7 @@ func (this *Backend) newWindow (
// xevent.SelectionRequestFun(window.handleSelectionRequest). // xevent.SelectionRequestFun(window.handleSelectionRequest).
// Connect(this.x, window.xWindow.Id) // Connect(this.x, window.xWindow.Id)
window.metrics.innerBounds = bounds window.metrics.bounds = bounds
window.doMinimumSize() window.doMinimumSize()
this.windows[window.xWindow.Id] = window this.windows[window.xWindow.Id] = window
@ -166,14 +165,6 @@ func (this *Backend) newWindow (
return return
} }
func (this *window) Bounds () image.Rectangle {
return this.metrics.bounds.Sub(this.metrics.innerBounds.Min)
}
func (this *window) InnerBounds () image.Rectangle {
return this.metrics.innerBounds.Sub(this.metrics.innerBounds.Min)
}
func (this *window) SetRoot (root tomo.Object) { func (this *window) SetRoot (root tomo.Object) {
if root == nil { if root == nil {
this.hierarchy.SetRoot(nil) this.hierarchy.SetRoot(nil)
@ -251,7 +242,7 @@ func (this *window) NewChild (bounds image.Rectangle) (tomo.Window, error) {
leader := this.leader leader := this.leader
child, err := this.backend.newWindow ( child, err := this.backend.newWindow (
bounds.Add(this.metrics.innerBounds.Min), false) bounds.Add(this.metrics.bounds.Min), false)
child.leader = leader child.leader = leader
if err != nil { return nil, err } if err != nil { return nil, err }
@ -269,7 +260,7 @@ func (this *window) NewChild (bounds image.Rectangle) (tomo.Window, error) {
func (this *window) NewMenu (bounds image.Rectangle) (tomo.Window, error) { func (this *window) NewMenu (bounds image.Rectangle) (tomo.Window, error) {
menu, err := this.backend.newWindow ( menu, err := this.backend.newWindow (
bounds.Add(this.metrics.innerBounds.Min), true) bounds.Add(this.metrics.bounds.Min), true)
menu.shy = true menu.shy = true
icccm.WmTransientForSet ( icccm.WmTransientForSet (
this.backend.x, this.backend.x,
@ -282,7 +273,7 @@ func (this *window) NewMenu (bounds image.Rectangle) (tomo.Window, error) {
func (this *window) NewModal (bounds image.Rectangle) (tomo.Window, error) { func (this *window) NewModal (bounds image.Rectangle) (tomo.Window, error) {
modal, err := this.backend.newWindow ( modal, err := this.backend.newWindow (
bounds.Add(this.metrics.innerBounds.Min), false) bounds.Add(this.metrics.bounds.Min), false)
icccm.WmTransientForSet ( icccm.WmTransientForSet (
this.backend.x, this.backend.x,
modal.xWindow.Id, modal.xWindow.Id,
@ -391,8 +382,8 @@ func (this *window) reallocateCanvas () {
previousHeight = this.xCanvas.Bounds().Dy() previousHeight = this.xCanvas.Bounds().Dy()
} }
newWidth := this.metrics.innerBounds.Dx() newWidth := this.metrics.bounds.Dx()
newHeight := this.metrics.innerBounds.Dy() newHeight := this.metrics.bounds.Dy()
larger := newWidth > previousWidth || newHeight > previousHeight larger := newWidth > previousWidth || newHeight > previousHeight
smaller := newWidth < previousWidth / 2 || newHeight < previousHeight / 2 smaller := newWidth < previousWidth / 2 || newHeight < previousHeight / 2
@ -412,7 +403,7 @@ func (this *window) reallocateCanvas () {
} }
this.hierarchy.SetCanvas(this.xCanvas.SubCanvas ( this.hierarchy.SetCanvas(this.xCanvas.SubCanvas (
this.metrics.innerBounds.Sub(this.metrics.innerBounds.Min))) this.metrics.bounds.Sub(this.metrics.bounds.Min)))
} }
func (this *window) pushAll () { func (this *window) pushAll () {
@ -467,12 +458,12 @@ func (this *window) doMinimumSize () {
this.backend.x, this.backend.x,
this.xWindow.Id, this.xWindow.Id,
&hints) &hints)
newWidth := this.metrics.innerBounds.Dx() newWidth := this.metrics.bounds.Dx()
newHeight := this.metrics.innerBounds.Dy() newHeight := this.metrics.bounds.Dy()
if newWidth < size.X { newWidth = size.X } if newWidth < size.X { newWidth = size.X }
if newHeight < size.Y { newHeight = size.Y } if newHeight < size.Y { newHeight = size.Y }
if newWidth != this.metrics.innerBounds.Dx() || if newWidth != this.metrics.bounds.Dx() ||
newHeight != this.metrics.innerBounds.Dy() { newHeight != this.metrics.bounds.Dy() {
this.xWindow.Resize(newWidth, newHeight) this.xWindow.Resize(newWidth, newHeight)
} }
} }