def test_fullscreen_on_top(xmanager):
    """Test fullscreen, focused windows are on top."""
    conn = xcbq.Connection(xmanager.display)

    def _wnd(name):
        return xmanager.c.window[{w["name"]: w["id"] for w in xmanager.c.windows()}[name]]

    def _clients():
        root = conn.default_screen.root.wid
        q = conn.conn.core.QueryTree(root).reply()
        stack = list(q.children)
        wins = [(w["name"], stack.index(w["id"])) for w in xmanager.c.windows()]
        wins.sort(key=lambda x: x[1])
        return [x[0] for x in wins]

    xmanager.test_window("one", floating=True)
    xmanager.test_window("two")

    # window "one" is kept_above, "two" is norm
    assert _clients() == ["two", "one"]

    # A fullscreen, focused window should display above windows that are "kept above"
    _wnd("two").enable_fullscreen()
    _wnd("two").focus()
    assert _clients() == ["one", "two"]

    # Focusing the other window should cause the fullscreen window to drop from the highest layer
    _wnd("one").focus()
    assert _clients() == ["two", "one"]

    # Disabling fullscreen will put the window below the "kept above" window, even if it has focus
    _wnd("two").focus()
    _wnd("two").toggle_fullscreen()
    assert _clients() == ["two", "one"]
Test fullscreen, focused windows are on top.
test/backend/x11/test_window.py