X backend positions modals, panels, and menus correctly in reparenting window managers

This commit is contained in:
Sasha Koshka 2023-04-27 18:49:35 -04:00
parent 990e60eea4
commit e5d6e03975

View File

@ -43,10 +43,15 @@ func (window *window) handleExpose (
window.pushRegion(region) window.pushRegion(region)
} }
func (window *window) updateBounds (x, y int16, width, height uint16) { func (window *window) updateBounds () {
window.metrics.bounds = // FIXME: some window managers parent windows more than once, we might
image.Rect(0, 0, int(width), int(height)). // need to sum up all their positions.
Add(image.Pt(int(x), int(y))) decorGeometry, _ := window.xWindow.DecorGeometry()
windowGeometry, _ := window.xWindow.Geometry()
window.metrics.bounds = tomo.Bounds (
windowGeometry.X() + decorGeometry.X(),
windowGeometry.Y() + decorGeometry.Y(),
windowGeometry.Width(), windowGeometry.Height())
} }
func (window *window) handleConfigureNotify ( func (window *window) handleConfigureNotify (
@ -62,15 +67,10 @@ func (window *window) handleConfigureNotify (
sizeChanged := sizeChanged :=
window.metrics.bounds.Dx() != newWidth || window.metrics.bounds.Dx() != newWidth ||
window.metrics.bounds.Dy() != newHeight window.metrics.bounds.Dy() != newHeight
window.updateBounds ( window.updateBounds()
configureEvent.X, configureEvent.Y,
configureEvent.Width, configureEvent.Height)
if sizeChanged { if sizeChanged {
configureEvent = window.compressConfigureNotify(configureEvent) configureEvent = window.compressConfigureNotify(configureEvent)
window.updateBounds (
configureEvent.X, configureEvent.Y,
configureEvent.Width, configureEvent.Height)
window.reallocateCanvas() window.reallocateCanvas()
window.resizeChildToFit() window.resizeChildToFit()