Compare commits
17 Commits
v0.2.0
...
caa261665f
| Author | SHA1 | Date | |
|---|---|---|---|
| caa261665f | |||
| e21b57a915 | |||
| 727a801243 | |||
| 76701d4383 | |||
| 6619987b5a | |||
| 02de78c997 | |||
| 95b1d033a9 | |||
| 1951b6e408 | |||
| c7f09c7894 | |||
| 80f60b42de | |||
| 995e6fd624 | |||
| 26b69d3e21 | |||
| 52a0136e60 | |||
| 5657f85c83 | |||
| a9ac9f6600 | |||
| 6eff6887e7 | |||
| adf0ef3a89 |
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.35.0
|
||||
git.tebibyte.media/tomo/tomo v0.38.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.35.0 h1:1XvcUcWg1rBZXov3KfuX6VfiuBQ2mcJHIslHMLn07no=
|
||||
git.tebibyte.media/tomo/tomo v0.35.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
git.tebibyte.media/tomo/tomo v0.38.0 h1:K5TP67RxnszudeNfmGZiU5cFTRjFueXiI3NCsgw+05U=
|
||||
git.tebibyte.media/tomo/tomo v0.38.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=
|
||||
|
||||
@@ -20,6 +20,9 @@ type box struct {
|
||||
outer anyBox
|
||||
|
||||
role tomo.Role
|
||||
styleCookie event.Cookie
|
||||
lastStyleNonce int
|
||||
lastIconsNonce int
|
||||
|
||||
bounds image.Rectangle
|
||||
minSize image.Point
|
||||
@@ -57,6 +60,8 @@ type box struct {
|
||||
scroll event.Broadcaster[func (float64, float64)]
|
||||
keyDown event.Broadcaster[func (input.Key, bool)]
|
||||
keyUp event.Broadcaster[func (input.Key, bool)]
|
||||
styleChange event.FuncBroadcaster
|
||||
iconsChange event.FuncBroadcaster
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +128,15 @@ func (this *box) borderSum () tomo.Inset {
|
||||
return sum
|
||||
}
|
||||
|
||||
func (this *box) borderAndPaddingSum () tomo.Inset {
|
||||
sum := this.borderSum()
|
||||
sum[0] += this.padding[0]
|
||||
sum[1] += this.padding[1]
|
||||
sum[2] += this.padding[2]
|
||||
sum[3] += this.padding[3]
|
||||
return sum
|
||||
}
|
||||
|
||||
func (this *box) SetBounds (bounds image.Rectangle) {
|
||||
if this.bounds == bounds { return }
|
||||
this.bounds = bounds
|
||||
@@ -282,6 +296,12 @@ func (this *box) OnKeyDown (callback func(key input.Key, numberPad bool)) event.
|
||||
func (this *box) OnKeyUp (callback func(key input.Key, numberPad bool)) event.Cookie {
|
||||
return this.on.keyUp.Connect(callback)
|
||||
}
|
||||
func (this *box) OnStyleChange (callback func()) event.Cookie {
|
||||
return this.on.styleChange.Connect(callback)
|
||||
}
|
||||
func (this *box) OnIconsChange (callback func()) event.Cookie {
|
||||
return this.on.iconsChange.Connect(callback)
|
||||
}
|
||||
func (this *box) handleFocusEnter () {
|
||||
this.on.focusEnter.Broadcast()
|
||||
}
|
||||
@@ -451,7 +471,7 @@ func (this *box) doLayout () {
|
||||
// laycnt ++
|
||||
|
||||
this.innerClippingBounds = this.borderSum().Apply(this.bounds)
|
||||
this.loseCanvas()
|
||||
this.outer.recursiveLoseCanvas()
|
||||
}
|
||||
|
||||
func (this *box) setParent (parent parent) {
|
||||
@@ -459,6 +479,7 @@ func (this *box) setParent (parent parent) {
|
||||
this.SetFocused(false)
|
||||
}
|
||||
this.parent = parent
|
||||
this.outer.recursiveReApply()
|
||||
}
|
||||
|
||||
func (this *box) getParent () parent {
|
||||
@@ -481,7 +502,7 @@ func (this *box) recursiveRedo () {
|
||||
this.doDraw()
|
||||
}
|
||||
|
||||
func (this *box) loseCanvas () {
|
||||
func (this *box) recursiveLoseCanvas () {
|
||||
this.canvas.InvalidateTo(nil)
|
||||
}
|
||||
|
||||
@@ -506,6 +527,36 @@ func (this *box) invalidateMinimum () {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *box) recursiveReApply () {
|
||||
if this.getHierarchy() == nil { return }
|
||||
|
||||
// re-apply styling, icons *if needed*
|
||||
|
||||
// style
|
||||
hierarchyStyleNonce := this.getStyleNonce()
|
||||
if this.lastStyleNonce != hierarchyStyleNonce {
|
||||
// remove old style
|
||||
this.lastStyleNonce = hierarchyStyleNonce
|
||||
if this.styleCookie != nil {
|
||||
this.styleCookie.Close()
|
||||
this.styleCookie = nil
|
||||
}
|
||||
|
||||
// apply new one
|
||||
if style := this.getStyle(); style != nil {
|
||||
this.styleCookie = style.Apply(this.outer)
|
||||
}
|
||||
this.on.styleChange.Broadcast()
|
||||
}
|
||||
|
||||
// icons
|
||||
hierarchyIconsNonce := this.getIconsNonce()
|
||||
if this.lastIconsNonce != hierarchyIconsNonce {
|
||||
this.lastIconsNonce = hierarchyIconsNonce
|
||||
this.on.iconsChange.Broadcast()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *box) canBeFocused () bool {
|
||||
return this.focusable
|
||||
}
|
||||
@@ -539,7 +590,23 @@ func (this *box) getWindow () tomo.Window {
|
||||
return hierarchy.getWindow()
|
||||
}
|
||||
|
||||
func (this *box) getStyle () tomo.Style {
|
||||
hierarchy := this.getHierarchy()
|
||||
if hierarchy == nil { return nil }
|
||||
return hierarchy.getStyle()
|
||||
}
|
||||
|
||||
func (this *box) getHierarchy () *Hierarchy {
|
||||
if this.parent == nil { return nil }
|
||||
return this.parent.getHierarchy()
|
||||
}
|
||||
|
||||
func (this *box) getStyleNonce () int {
|
||||
// should panic if not in the tree
|
||||
return this.getHierarchy().getStyleNonce()
|
||||
}
|
||||
|
||||
func (this *box) getIconsNonce () int {
|
||||
// should panic if not in the tree
|
||||
return this.getHierarchy().getIconsNonce()
|
||||
}
|
||||
|
||||
@@ -73,6 +73,24 @@ func (this *containerBox) ScrollTo (point image.Point) {
|
||||
this.invalidateLayout()
|
||||
}
|
||||
|
||||
func (this *containerBox) RecommendedHeight (width int) int {
|
||||
if this.layout == nil || this.vOverflow {
|
||||
return this.MinimumSize().Y
|
||||
} else {
|
||||
return this.layout.RecommendedHeight(this.layoutHints(), this.children, width) +
|
||||
this.borderAndPaddingSum().Vertical()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *containerBox) RecommendedWidth (height int) int {
|
||||
if this.layout == nil || this.hOverflow {
|
||||
return this.MinimumSize().X
|
||||
} else {
|
||||
return this.layout.RecommendedWidth(this.layoutHints(), this.children, height) +
|
||||
this.borderAndPaddingSum().Horizontal()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *containerBox) OnContentBoundsChange (callback func()) event.Cookie {
|
||||
return this.on.contentBoundsChange.Connect(callback)
|
||||
}
|
||||
@@ -335,6 +353,20 @@ func (this *containerBox) recursiveRedo () {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *containerBox) recursiveLoseCanvas () {
|
||||
this.box.recursiveLoseCanvas()
|
||||
for _, child := range this.children {
|
||||
child.(anyBox).recursiveLoseCanvas()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *containerBox) recursiveReApply () {
|
||||
this.box.recursiveReApply()
|
||||
for _, child := range this.children {
|
||||
child.(anyBox).recursiveReApply()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *containerBox) boxUnder (point image.Point, category eventCategory) anyBox {
|
||||
if !point.In(this.bounds) { return nil }
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ func (this *System) NewHierarchy (link WindowLink) *Hierarchy {
|
||||
needLayout: make(util.Set[anyBox]),
|
||||
needDraw: make(util.Set[anyBox]),
|
||||
}
|
||||
this.hierarchies.Add(hierarchy)
|
||||
return hierarchy
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ func (this *Hierarchy) Empty () bool {
|
||||
// draw to. The Hierarchy will use the canvas.Canvas's bounds to lay itself out.
|
||||
func (this *Hierarchy) SetCanvas (can canvas.Canvas) {
|
||||
this.canvas = can
|
||||
if this.root != nil { this.root.loseCanvas() }
|
||||
if this.root != nil { this.root.recursiveLoseCanvas() }
|
||||
this.needRedo = true
|
||||
}
|
||||
|
||||
@@ -135,6 +136,20 @@ func (this *Hierarchy) AfterEvent () {
|
||||
}
|
||||
}
|
||||
|
||||
// Close closes the Hierarchy. This should be called when the Window that
|
||||
// contains it has been closed.
|
||||
func (this *Hierarchy) Close () {
|
||||
this.system.removeHierarchy(this)
|
||||
}
|
||||
|
||||
func (this *Hierarchy) setStyle () {
|
||||
if this.root != nil { this.root.recursiveReApply() }
|
||||
}
|
||||
|
||||
func (this *Hierarchy) setIcons () {
|
||||
if this.root != nil { this.root.recursiveReApply() }
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getHierarchy () *Hierarchy {
|
||||
return this
|
||||
}
|
||||
@@ -143,6 +158,18 @@ func (this *Hierarchy) getWindow () tomo.Window {
|
||||
return this.link.GetWindow()
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getStyle () tomo.Style {
|
||||
return this.system.style
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getStyleNonce () int {
|
||||
return this.system.styleNonce
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getIconsNonce () int {
|
||||
return this.system.iconsNonce
|
||||
}
|
||||
|
||||
func (this *Hierarchy) getCanvas () canvas.Canvas {
|
||||
return this.canvas
|
||||
}
|
||||
|
||||
@@ -57,7 +57,11 @@ type anyBox interface {
|
||||
recursiveRedo ()
|
||||
// loseCanvas causes this anyBox and its children (if applicable) to
|
||||
// lose their canvases and re-cut them as needed.
|
||||
loseCanvas ()
|
||||
recursiveLoseCanvas ()
|
||||
// recursiveReAppply causes this anyBox and its children (if applicable)
|
||||
// to check whether they have an outdated style or icon set, and if so,
|
||||
// update it and trigger the appropriate event broadcasters.
|
||||
recursiveReApply ()
|
||||
|
||||
// contentMinimum returns the minimum dimensions of this box's content
|
||||
contentMinimum () image.Point
|
||||
|
||||
@@ -2,12 +2,20 @@ package system
|
||||
|
||||
import "io"
|
||||
import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
import "git.tebibyte.media/tomo/backend/internal/util"
|
||||
|
||||
// System is coupled to a tomo.Backend implementation, and manages Hierarchies
|
||||
// and Boxes.
|
||||
type System struct {
|
||||
link BackendLink
|
||||
|
||||
style tomo.Style
|
||||
styleNonce int
|
||||
iconsNonce int
|
||||
|
||||
hierarchies util.Set[*Hierarchy]
|
||||
}
|
||||
|
||||
// BackendLink allows the System to call up into the tomo.Backend implementation
|
||||
@@ -31,5 +39,28 @@ type SurfaceLink interface {
|
||||
func New (link BackendLink) *System {
|
||||
return &System {
|
||||
link: link,
|
||||
hierarchies: make(util.Set[*Hierarchy]),
|
||||
}
|
||||
}
|
||||
|
||||
// SetStyle sets the tomo.Style that is applied to objects, and notifies them
|
||||
// that the style has changed.
|
||||
func (this *System) SetStyle (style tomo.Style) {
|
||||
this.style = style
|
||||
this.styleNonce ++
|
||||
for hierarchy := range this.hierarchies {
|
||||
hierarchy.setStyle()
|
||||
}
|
||||
}
|
||||
|
||||
// SetIcons notifies objects that the icons have changed.
|
||||
func (this *System) SetIcons (icons tomo.Icons) {
|
||||
this.iconsNonce ++
|
||||
for hierarchy := range this.hierarchies {
|
||||
hierarchy.setIcons()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *System) removeHierarchy (hierarchy *Hierarchy) {
|
||||
delete(this.hierarchies, hierarchy)
|
||||
}
|
||||
|
||||
@@ -65,6 +65,15 @@ func (this *textBox) ScrollTo (point image.Point) {
|
||||
this.invalidateLayout()
|
||||
}
|
||||
|
||||
func (this *textBox) RecommendedHeight (width int) int {
|
||||
return this.drawer.ReccomendedHeightFor(width) + this.borderAndPaddingSum().Vertical()
|
||||
}
|
||||
|
||||
func (this *textBox) RecommendedWidth (height int) int {
|
||||
// TODO maybe not the best idea?
|
||||
return this.MinimumSize().X
|
||||
}
|
||||
|
||||
func (this *textBox) OnContentBoundsChange (callback func()) event.Cookie {
|
||||
return this.on.contentBoundsChange.Connect(callback)
|
||||
}
|
||||
|
||||
@@ -126,6 +126,14 @@ func (this *Backend) NewCanvas (bounds image.Rectangle) canvas.CanvasCloser {
|
||||
return xcanvas.NewCanvas(this.x, bounds)
|
||||
}
|
||||
|
||||
func (this *Backend) SetStyle (style tomo.Style) {
|
||||
this.system.SetStyle(style)
|
||||
}
|
||||
|
||||
func (this *Backend) SetIcons (icons tomo.Icons) {
|
||||
this.system.SetIcons(icons)
|
||||
}
|
||||
|
||||
func (this *Backend) assert () {
|
||||
if this == nil { panic("x: nil backend") }
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ type scrollSum struct {
|
||||
}
|
||||
|
||||
// TODO: this needs to be configurable, we need a config api
|
||||
const scrollDistance = 16
|
||||
const scrollDistance = 32
|
||||
|
||||
func (sum *scrollSum) add (button xproto.Button, window *window, state uint16) {
|
||||
if xgbkb.StateToModifiers(state).Shift {
|
||||
|
||||
109
x/window.go
109
x/window.go
@@ -18,7 +18,6 @@ import "github.com/jezek/xgbutil/keybind"
|
||||
import "github.com/jezek/xgbutil/mousebind"
|
||||
import "github.com/jezek/xgbutil/xgraphics"
|
||||
|
||||
type mainWindow struct { *window }
|
||||
type window struct {
|
||||
backend *Backend
|
||||
hierarchy *system.Hierarchy
|
||||
@@ -28,10 +27,13 @@ type window struct {
|
||||
|
||||
title string
|
||||
|
||||
leader *window
|
||||
modalParent *window
|
||||
hasModal bool
|
||||
shy bool
|
||||
visible bool
|
||||
resizeX bool
|
||||
resizeY bool
|
||||
|
||||
metrics struct {
|
||||
bounds image.Rectangle
|
||||
@@ -63,28 +65,24 @@ func (this *windowLink) NotifyMinimumSizeChange () {
|
||||
func (this *Backend) NewWindow (
|
||||
bounds image.Rectangle,
|
||||
) (
|
||||
output tomo.MainWindow,
|
||||
output tomo.Window,
|
||||
err error,
|
||||
) {
|
||||
this.assert()
|
||||
window, err := this.newWindow(bounds, false)
|
||||
|
||||
output = mainWindow { window: window }
|
||||
return output, err
|
||||
return this.newWindow(bounds, false)
|
||||
}
|
||||
|
||||
func (this *Backend) NewPlainWindow (
|
||||
bounds image.Rectangle,
|
||||
) (
|
||||
output tomo.MainWindow,
|
||||
output tomo.Window,
|
||||
err error,
|
||||
) {
|
||||
this.assert()
|
||||
window, err := this.newWindow(bounds, false)
|
||||
window.setType("dock")
|
||||
|
||||
output = mainWindow { window: window }
|
||||
return output, err
|
||||
return window, err
|
||||
}
|
||||
|
||||
func (this *Backend) newWindow (
|
||||
@@ -100,6 +98,9 @@ func (this *Backend) newWindow (
|
||||
window := &window { backend: this }
|
||||
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 }
|
||||
@@ -178,12 +179,16 @@ func (this *window) SetTitle (title string) {
|
||||
icccm.WmIconNameSet (this.backend.x, this.xWindow.Id, title)
|
||||
}
|
||||
|
||||
func (this *window) SetIcon (sizes ...image.Image) {
|
||||
func (this *window) SetIcon (sizes ...canvas.Texture) {
|
||||
wmIcons := []ewmh.WmIcon { }
|
||||
|
||||
for _, icon := range sizes {
|
||||
width := icon.Bounds().Max.X
|
||||
height := icon.Bounds().Max.Y
|
||||
icon, ok := icon.(*xcanvas.Texture)
|
||||
if !ok { continue }
|
||||
|
||||
bounds := icon.Bounds()
|
||||
width := bounds.Dx()
|
||||
height := bounds.Dy()
|
||||
wmIcon := ewmh.WmIcon {
|
||||
Width: uint(width),
|
||||
Height: uint(height),
|
||||
@@ -193,18 +198,14 @@ func (this *window) SetIcon (sizes ...image.Image) {
|
||||
// manually convert image data beacuse of course we have to do
|
||||
// this
|
||||
index := 0
|
||||
for y := 0; y < height; y ++ {
|
||||
for x := 0; x < width; x ++ {
|
||||
r, g, b, a := icon.At(x, y).RGBA()
|
||||
r >>= 8
|
||||
g >>= 8
|
||||
b >>= 8
|
||||
a >>= 8
|
||||
for y := bounds.Min.Y; y < bounds.Max.Y; y ++ {
|
||||
for x := bounds.Min.X; x < bounds.Max.X; x ++ {
|
||||
pixel := icon.BGRAAt(x, y)
|
||||
wmIcon.Data[index] =
|
||||
(uint(a) << 24) |
|
||||
(uint(r) << 16) |
|
||||
(uint(g) << 8) |
|
||||
(uint(b) << 0)
|
||||
(uint(pixel.A) << 24) |
|
||||
(uint(pixel.R) << 16) |
|
||||
(uint(pixel.G) << 8) |
|
||||
(uint(pixel.B) << 0)
|
||||
index ++
|
||||
}}
|
||||
|
||||
@@ -217,6 +218,20 @@ func (this *window) SetIcon (sizes ...image.Image) {
|
||||
wmIcons)
|
||||
}
|
||||
|
||||
func (this *window) SetResizable (x, y bool) {
|
||||
if this.resizeX == x && this.resizeY == y { return }
|
||||
this.resizeX = x
|
||||
this.resizeY = y
|
||||
this.doMinimumSize()
|
||||
}
|
||||
|
||||
func (this *window) SetBounds (bounds image.Rectangle) {
|
||||
this.xWindow.WMMoveResize (
|
||||
bounds.Min.X, bounds.Min.Y,
|
||||
bounds.Min.X + bounds.Dx(),
|
||||
bounds.Min.Y + bounds.Dy())
|
||||
}
|
||||
|
||||
func (this *window) NewMenu (bounds image.Rectangle) (tomo.Window, error) {
|
||||
menu, err := this.backend.newWindow (
|
||||
bounds.Add(this.metrics.bounds.Min), true)
|
||||
@@ -247,19 +262,24 @@ func (this *window) NewModal (bounds image.Rectangle) (tomo.Window, error) {
|
||||
return modal, err
|
||||
}
|
||||
|
||||
func (this mainWindow) NewChild (bounds image.Rectangle) (tomo.Window, error) {
|
||||
func (this *window) NewChild (bounds image.Rectangle) (tomo.Window, error) {
|
||||
leader := this.leader
|
||||
|
||||
child, err := this.backend.newWindow (
|
||||
bounds.Add(this.metrics.bounds.Min), false)
|
||||
child.leader = leader
|
||||
if err != nil { return nil, err }
|
||||
child.setClientLeader(this.window)
|
||||
this.setClientLeader(this.window)
|
||||
|
||||
child.setClientLeader(leader)
|
||||
leader.setClientLeader(leader)
|
||||
|
||||
icccm.WmTransientForSet (
|
||||
this.backend.x,
|
||||
this.xWindow.Id,
|
||||
this.xWindow.Id)
|
||||
this.setType("UTILITY")
|
||||
// this.inheritProperties(this.window)
|
||||
return this, err
|
||||
child.xWindow.Id,
|
||||
leader.xWindow.Id)
|
||||
child.setType("UTILITY")
|
||||
// child.inheritProperties(leader.window)
|
||||
return child, err
|
||||
}
|
||||
|
||||
func (this *window) Widget () (tomo.Window, error) {
|
||||
@@ -306,6 +326,7 @@ func (this *window) Close () {
|
||||
this.SetRoot(nil)
|
||||
delete(this.backend.windows, this.xWindow.Id)
|
||||
this.xWindow.Destroy()
|
||||
this.hierarchy.Close()
|
||||
}
|
||||
|
||||
func (this *window) OnClose (callback func ()) event.Cookie {
|
||||
@@ -404,14 +425,30 @@ func (this *window) doMinimumSize () {
|
||||
|
||||
if size.X < 8 { size.X = 8 }
|
||||
if size.Y < 8 { size.Y = 8 }
|
||||
icccm.WmNormalHintsSet (
|
||||
this.backend.x,
|
||||
this.xWindow.Id,
|
||||
&icccm.NormalHints {
|
||||
|
||||
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,
|
||||
&hints)
|
||||
newWidth := this.metrics.bounds.Dx()
|
||||
newHeight := this.metrics.bounds.Dy()
|
||||
if newWidth < size.X { newWidth = size.X }
|
||||
|
||||
Reference in New Issue
Block a user