Fix GTK 4 foreground matching and menu labels
This commit is contained in:
1 parent
d0c977281d
commit
49eeae89f4
8 files changed
+254
-9
No files matched your search
@@ -36,6 +36,36 @@ func TestForegroundWindowCorrelation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestForegroundUnpositionedGTK4Correlation(t *testing.T) {
|
||||
// GTK 4 on X11 (seen on i3) reports its frame at 0,0 with the client's size.
|
||||
client := xorg.Foreground{Known: true, Window: 35651592, PID: 215379,
|
||||
X: 700, Y: 449, Width: 520, Height: 322, OuterX: 698, OuterY: 427, OuterWidth: 524, OuterHeight: 346,
|
||||
FrameX: 698, FrameY: 427, FrameWidth: 524, FrameHeight: 346}
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
client xorg.Foreground
|
||||
pid int
|
||||
bounds Rectangle
|
||||
want bool
|
||||
}{
|
||||
{"gtk4 frame at origin", client, 215379, Rectangle{0, 0, 520, 322}, true},
|
||||
{"other process", client, 215380, Rectangle{0, 0, 520, 322}, false},
|
||||
{"unknown accessible process", client, 0, Rectangle{0, 0, 520, 322}, false},
|
||||
{"unknown X11 process", xorg.Foreground{Known: true, Window: 35651592,
|
||||
X: 700, Y: 449, Width: 520, Height: 322}, 215379, Rectangle{0, 0, 520, 322}, false},
|
||||
{"same process different size", client, 215379, Rectangle{0, 0, 400, 300}, false},
|
||||
{"same process scaled size", client, 215379, Rectangle{0, 0, 260, 161}, false},
|
||||
{"same process outer size at origin", client, 215379, Rectangle{0, 0, 524, 346}, false},
|
||||
{"same size elsewhere", client, 215379, Rectangle{10, 0, 520, 322}, false},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := foregroundWindowMatches(test.client, test.pid, test.bounds); got != test.want {
|
||||
t.Fatalf("match = %v, want %v", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestForegroundWindowCorrelationSteamBigPictureScale(t *testing.T) {
|
||||
client := xorg.Foreground{Known: true, Window: 83886130, PID: 111, X: 0, Y: 0, Width: 1920, Height: 1080,
|
||||
OuterX: 0, OuterY: 0, OuterWidth: 1920, OuterHeight: 1080}
|
||||
|
||||
Reference in new issue
Block a user