Terrible discovery (panels don't work properly)

This commit is contained in:
2023-03-24 17:38:21 -04:00
parent bdc1109bcf
commit 3aa8495873
3 changed files with 67 additions and 10 deletions

View File

@@ -227,15 +227,33 @@ func (window *window) NewModal (width, height int) (elements.Window, error) {
func (window mainWindow) NewPanel (width, height int) (elements.Window, error) {
panel, err := window.backend.newWindow(width, height)
hints, _ := icccm.WmHintsGet(window.backend.connection, panel.xWindow.Id)
hints.WindowGroup = window.xWindow.Id
icccm.WmHintsSet (
window.backend.connection,
panel.xWindow.Id,
hints)
if err != nil { return nil, err }
panel.setClientLeader(window.window)
panel.setType("UTILITY")
return panel, err
}
func (window *window) setType (ty string) error {
return ewmh.WmWindowTypeSet (
window.backend.connection,
window.xWindow.Id,
[]string { "_NET_WM_WINDOW_TYPE_" + ty })
}
func (window *window) setClientLeader (leader *window) error {
// FIXME: doe not fucking work
hints, _ := icccm.WmHintsGet(window.backend.connection, window.xWindow.Id)
if hints == nil {
hints = &icccm.Hints { }
}
hints.Flags |= icccm.HintWindowGroup
hints.WindowGroup = leader.xWindow.Id
return icccm.WmHintsSet (
window.backend.connection,
window.xWindow.Id,
hints)
}
func (window *window) Show () {
if window.child == nil {
window.xCanvas.For (func (x, y int) xgraphics.BGRA {