Fix GTK 4 foreground matching and menu labels

This commit is contained in:
Chase Cichorz authored and Angus Kola committed 2026-11-07 13:40:23 -05:00
1 parent d0c977281d
commit 49eeae89f4
8 files changed
+254 -9

No files matched your search

+11 -1
View File
@@ -49,7 +49,17 @@ func foregroundWindowMatches(client xorg.Foreground, pid int, bounds Rectangle)
frame := Rectangle{X: int32(client.FrameX), Y: int32(client.FrameY), Width: int32(client.FrameWidth), Height: int32(client.FrameHeight)}
return bounds == inner || bounds == outer ||
frame.Valid() && bounds == frame ||
scaledWindowMatches(bounds, inner) || scaledWindowMatches(bounds, outer) || scaledWindowMatches(bounds, frame)
scaledWindowMatches(bounds, inner) || scaledWindowMatches(bounds, outer) || scaledWindowMatches(bounds, frame) ||
unpositionedWindowMatches(client, pid, bounds, inner)
}
// Some GTK 4 X11 frames report screen extents with a 0,0 origin wherever
// the window really is. Accept such a frame only when both sides name the
// same process and the size equals the X11 client
// exactly; a dialog or sibling of a different size still cannot claim it.
func unpositionedWindowMatches(client xorg.Foreground, pid int, bounds, inner Rectangle) bool {
return client.PID > 0 && pid == client.PID && bounds.X == 0 && bounds.Y == 0 &&
bounds.Width == inner.Width && bounds.Height == inner.Height
}
// Some Chromium windows report AT-SPI extents in logical pixels while X11