Made centering the buffer in the window optional

It causes jitter while resizing in floating wms
This commit is contained in:
2022-11-16 11:31:35 -05:00
parent 81a0c60943
commit 0ee58d22f6
2 changed files with 28 additions and 7 deletions

View File

@@ -39,13 +39,18 @@ func (backend *Backend) handleConfigureNotify (
width, height := backend.calculateBufferSize()
backend.application.SetSize(width, height)
// position buffer in the center of the screen
frameWidth := width * backend.metrics.cellWidth
frameHeight := height * backend.metrics.cellHeight
backend.metrics.paddingX =
(backend.metrics.windowWidth - frameWidth) / 2
backend.metrics.paddingY =
(backend.metrics.windowHeight - frameHeight) / 2
if backend.config.Center() {
// position buffer in the center of the screen
frameWidth := width * backend.metrics.cellWidth
frameHeight := height * backend.metrics.cellHeight
backend.metrics.paddingX =
(backend.metrics.windowWidth - frameWidth) / 2
backend.metrics.paddingY =
(backend.metrics.windowHeight - frameHeight) / 2
} else {
backend.metrics.paddingX = backend.metrics.padding
backend.metrics.paddingY = backend.metrics.padding
}
backend.windowBoundsClean = false
}