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()
|
||||
defer backend.lock.Unlock()
|
||||
|
||||
boundsChanged :=
|
||||
backend.memory.windowWidth != backend.metrics.windowWidth ||
|
||||
backend.memory.windowHeight != backend.metrics.windowHeight
|
||||
backend.memory.windowWidth = backend.metrics.windowWidth
|
||||
backend.memory.windowHeight = backend.metrics.windowHeight
|
||||
|
||||
if boundsChanged {
|
||||
if backend.windowBoundsClean {
|
||||
backend.canvas.XPaintRects (
|
||||
backend.window.Id,
|
||||
backend.drawCells(false)...)
|
||||
} else {
|
||||
backend.reallocateCanvas()
|
||||
backend.drawCells(true)
|
||||
backend.canvas.XDraw()
|
||||
backend.canvas.XPaint(backend.window.Id)
|
||||
} else {
|
||||
backend.canvas.XPaintRects (
|
||||
backend.window.Id,
|
||||
backend.drawCells(false)...)
|
||||
backend.windowBoundsClean = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,8 @@ func (backend *Backend) handleConfigureNotify (
|
||||
(backend.metrics.windowWidth - frameWidth) / 2
|
||||
backend.metrics.paddingY =
|
||||
(backend.metrics.windowHeight - frameHeight) / 2
|
||||
|
||||
backend.windowBoundsClean = false
|
||||
}
|
||||
|
||||
backend.lock.Unlock()
|
||||
|
@ -43,10 +43,7 @@ type Backend struct {
|
||||
descent int
|
||||
}
|
||||
|
||||
memory struct {
|
||||
windowWidth int
|
||||
windowHeight int
|
||||
}
|
||||
windowBoundsClean bool
|
||||
}
|
||||
|
||||
func (backend *Backend) SetTitle (title string) (err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user