The initial Slint problem was larger than thought. Hopefully a more universal fix.
This commit is contained in:
1 parent
d0fdce7285
commit
1c12bc6636
10 files changed
+294
-6
No files matched your search
@@ -46,8 +46,10 @@ func foregroundWindowMatches(client xorg.Foreground, pid int, bounds Rectangle)
|
||||
}
|
||||
inner := Rectangle{X: int32(client.X), Y: int32(client.Y), Width: int32(client.Width), Height: int32(client.Height)}
|
||||
outer := Rectangle{X: int32(client.OuterX), Y: int32(client.OuterY), Width: int32(client.OuterWidth), Height: int32(client.OuterHeight)}
|
||||
frame := Rectangle{X: int32(client.FrameX), Y: int32(client.FrameY), Width: int32(client.FrameWidth), Height: int32(client.FrameHeight)}
|
||||
return bounds == inner || bounds == outer ||
|
||||
scaledWindowMatches(bounds, inner) || scaledWindowMatches(bounds, outer)
|
||||
frame.Valid() && bounds == frame ||
|
||||
scaledWindowMatches(bounds, inner) || scaledWindowMatches(bounds, outer) || scaledWindowMatches(bounds, frame)
|
||||
}
|
||||
|
||||
// Some Chromium windows report AT-SPI extents in logical pixels while X11
|
||||
|
||||
@@ -44,6 +44,33 @@ func TestForegroundWindowCorrelationSteamBigPictureScale(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestForegroundReparentedFrameCorrelation(t *testing.T) {
|
||||
client := xorg.Foreground{Known: true, Window: 45, PID: 123,
|
||||
X: 2, Y: 18, Width: 1912, Height: 974, OuterX: 2, OuterY: 18, OuterWidth: 1912, OuterHeight: 974,
|
||||
FrameX: 0, FrameY: 0, FrameWidth: 1916, FrameHeight: 994}
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
pid int
|
||||
bounds Rectangle
|
||||
want bool
|
||||
}{
|
||||
{"actual WM frame", 123, Rectangle{0, 0, 1916, 994}, true},
|
||||
{"client still accepted", 123, Rectangle{2, 18, 1912, 974}, true},
|
||||
{"other process same frame size", 124, Rectangle{0, 0, 1916, 994}, false},
|
||||
{"same process other frame", 123, Rectangle{1920, 0, 1916, 994}, false},
|
||||
{"same process smaller dialog", 123, Rectangle{20, 30, 400, 300}, false},
|
||||
{"scaled frame same origin", 123, Rectangle{0, 0, 958, 497}, true},
|
||||
{"scaled frame wrong origin", 123, Rectangle{1, 0, 958, 497}, false},
|
||||
{"scaled frame wrong aspect", 123, Rectangle{0, 0, 958, 400}, false},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := foregroundWindowMatches(client, test.pid, test.bounds); got != test.want {
|
||||
t.Fatalf("match = %v, want %v", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreferencesForegroundIdentity(t *testing.T) {
|
||||
// Slint/i3 reports GTK's frame and the X11 client with different borders.
|
||||
client := xorg.Foreground{Known: true, Window: 45, PID: 123,
|
||||
|
||||
Reference in new issue
Block a user