Added simpler method of detecting window bounds change on draw
This commit is contained in:
parent
cab280a371
commit
81a0c60943
@ -11,21 +11,16 @@ func (backend *Backend) Draw () {
|
|||||||
backend.lock.Lock()
|
backend.lock.Lock()
|
||||||
defer backend.lock.Unlock()
|
defer backend.lock.Unlock()
|
||||||
|
|
||||||
boundsChanged :=
|
if backend.windowBoundsClean {
|
||||||
backend.memory.windowWidth != backend.metrics.windowWidth ||
|
backend.canvas.XPaintRects (
|
||||||
backend.memory.windowHeight != backend.metrics.windowHeight
|
backend.window.Id,
|
||||||
backend.memory.windowWidth = backend.metrics.windowWidth
|
backend.drawCells(false)...)
|
||||||
backend.memory.windowHeight = backend.metrics.windowHeight
|
} else {
|
||||||
|
|
||||||
if boundsChanged {
|
|
||||||
backend.reallocateCanvas()
|
backend.reallocateCanvas()
|
||||||
backend.drawCells(true)
|
backend.drawCells(true)
|
||||||
backend.canvas.XDraw()
|
backend.canvas.XDraw()
|
||||||
backend.canvas.XPaint(backend.window.Id)
|
backend.canvas.XPaint(backend.window.Id)
|
||||||
} else {
|
backend.windowBoundsClean = true
|
||||||
backend.canvas.XPaintRects (
|
|
||||||
backend.window.Id,
|
|
||||||
backend.drawCells(false)...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ func (backend *Backend) handleConfigureNotify (
|
|||||||
(backend.metrics.windowWidth - frameWidth) / 2
|
(backend.metrics.windowWidth - frameWidth) / 2
|
||||||
backend.metrics.paddingY =
|
backend.metrics.paddingY =
|
||||||
(backend.metrics.windowHeight - frameHeight) / 2
|
(backend.metrics.windowHeight - frameHeight) / 2
|
||||||
|
|
||||||
|
backend.windowBoundsClean = false
|
||||||
}
|
}
|
||||||
|
|
||||||
backend.lock.Unlock()
|
backend.lock.Unlock()
|
||||||
|
@ -43,10 +43,7 @@ type Backend struct {
|
|||||||
descent int
|
descent int
|
||||||
}
|
}
|
||||||
|
|
||||||
memory struct {
|
windowBoundsClean bool
|
||||||
windowWidth int
|
|
||||||
windowHeight int
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (backend *Backend) SetTitle (title string) (err error) {
|
func (backend *Backend) SetTitle (title string) (err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user