fix: hide cursor natively, keep OSD on top, pin codec extension contract (#3)
This commit is contained in:
@@ -286,27 +286,41 @@ func TestOSDEventMaskNeverSelectsDeviceInput(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStackReassertTargetOnlyAboveLiveTrackedVideo(t *testing.T) {
|
||||
// Window managers promote fullscreened video to the top of their
|
||||
// stacking order after the video-appear restack, burying the OSD
|
||||
// overlay; the overlay's refresh must re-assert its place above the
|
||||
// tracked video window — and only the OSD overlay may do so.
|
||||
func TestStackReassertKeepsTheOSDOnTop(t *testing.T) {
|
||||
// While video is live the overlay must sit above the tracked video
|
||||
// window; while video is absent the overlay must rise to the top,
|
||||
// because the fallback canvas raises itself to the top when video ends
|
||||
// and would otherwise bury the overlay's text. Only the OSD overlay
|
||||
// re-asserts; the canvas and video windows are never moved by this.
|
||||
windows := map[xproto.Window]struct{}{0x20: {}}
|
||||
|
||||
if target, ok := stackReassertTarget(RoleAbove, true, 0x20, windows); !ok || target != 0x20 {
|
||||
t.Fatalf("target=%v ok=%v want the tracked video window", target, ok)
|
||||
if sibling, mode, ok := stackReassert(RoleAbove, true, 0x20, windows); !ok || sibling != 0x20 || mode != xproto.StackModeAbove {
|
||||
t.Fatalf("sibling=%v mode=%v ok=%v want above the tracked video window", sibling, mode, ok)
|
||||
}
|
||||
if _, ok := stackReassertTarget(RoleBelow, true, 0x20, windows); ok {
|
||||
if sibling, mode, ok := stackReassert(RoleAbove, false, 0, nil); !ok || sibling != 0 || mode != xproto.StackModeAbove {
|
||||
t.Fatalf("sibling=%v mode=%v ok=%v want a top raise while video is absent", sibling, mode, ok)
|
||||
}
|
||||
if _, _, ok := stackReassert(RoleBelow, true, 0x20, windows); ok {
|
||||
t.Fatal("the fallback canvas must never re-assert stacking")
|
||||
}
|
||||
if _, ok := stackReassertTarget(RoleAbove, false, 0x20, windows); ok {
|
||||
t.Fatal("no re-assert while video is absent")
|
||||
}
|
||||
if _, ok := stackReassertTarget(RoleAbove, true, 0x30, windows); ok {
|
||||
if _, _, ok := stackReassert(RoleAbove, true, 0x30, windows); ok {
|
||||
t.Fatal("a stale top video window must not be restacked against")
|
||||
}
|
||||
if _, ok := stackReassertTarget(RoleAbove, true, 0, windows); ok {
|
||||
t.Fatal("no tracked video window means nothing to re-assert")
|
||||
if _, _, ok := stackReassert(RoleAbove, true, 0, windows); ok {
|
||||
t.Fatal("no tracked video window means no video-relative restack")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateWindowValuesOrderMatchesTheValueMask(t *testing.T) {
|
||||
// The CreateWindow values must follow the mask bit order (back pixel,
|
||||
// event mask, cursor) so the server reads each value correctly; the
|
||||
// blank cursor hides the pointer over the layer from its first frame.
|
||||
mask, values := createWindowValues(0x100, 0x200, 0xc0de)
|
||||
if mask != xproto.CwBackPixel|xproto.CwEventMask|xproto.CwCursor {
|
||||
t.Fatalf("mask=%b want back pixel, event mask and cursor bits", mask)
|
||||
}
|
||||
if len(values) != 3 || values[0] != 0x100 || values[1] != 0x200 || values[2] != 0xc0de {
|
||||
t.Fatalf("values=%v want [backPixel eventMask cursor]", values)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user