Window is resizable by default (lol)

This commit is contained in:
Sasha Koshka 2024-06-12 00:29:07 -04:00
parent 95b1d033a9
commit 02de78c997

View File

@ -99,6 +99,8 @@ func (this *Backend) newWindow (
link := &windowLink { window: window }
window.hierarchy = this.system.NewHierarchy(link)
window.leader = window
window.resizeX = true
window.resizeY = true
window.xWindow, err = xwindow.Generate(this.x)
if err != nil { return }
@ -424,14 +426,30 @@ func (this *window) doMinimumSize () {
if size.X < 8 { size.X = 8 }
if size.Y < 8 { size.Y = 8 }
hints := icccm.NormalHints {
Flags: icccm.SizeHintPMinSize,
MinWidth: uint(size.X),
MinHeight: uint(size.Y),
// now you can tell your friends that the max size of a Tomo
// window under X when one of the dimensions is constrained is
// 99999999999
MaxWidth: uint(99999999999),
MaxHeight: uint(99999999999),
}
if !this.resizeX {
hints.Flags |= icccm.SizeHintPMaxSize
hints.MaxWidth = uint(size.X)
}
if !this.resizeY {
hints.Flags |= icccm.SizeHintPMaxSize
hints.MaxHeight = uint(size.Y)
}
icccm.WmNormalHintsSet (
this.backend.x,
this.xWindow.Id,
&icccm.NormalHints {
Flags: icccm.SizeHintPMinSize,
MinWidth: uint(size.X),
MinHeight: uint(size.Y),
})
&hints)
newWidth := this.metrics.bounds.Dx()
newHeight := this.metrics.bounds.Dy()
if newWidth < size.X { newWidth = size.X }