Skip to content

Commit

Permalink
tests: add a repro for #1091
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Feb 18, 2024
1 parent 23e4c68 commit b2033bf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/configs/pull1091.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unredir-if-possible = true;
4 changes: 4 additions & 0 deletions tests/testcases/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def set_window_size_async(conn, wid, width, height):
value_list = [width, height]
return conn.core.ConfigureWindowChecked(wid, value_mask, value_list)

def set_window_bypass_compositor(conn, wid, value = 1):
prop_name = to_atom(conn, "_NET_WM_BYPASS_COMPOSITOR")
conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, prop_name, xproto.Atom.CARDINAL, 32, 1, [value]).check()

def find_picom_window(conn):
prop_name = to_atom(conn, "WM_NAME")
setup = conn.get_setup()
Expand Down
35 changes: 35 additions & 0 deletions tests/testcases/pull1091.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3

import xcffib.xproto as xproto
import xcffib
from common import *

conn = xcffib.connect()
setup = conn.get_setup()
root = setup.roots[0].root
visual = setup.roots[0].root_visual
depth = setup.roots[0].root_depth

# assertion failure mentioned in 1091 happens when a root change happens right after we
# redirected the screen, before we have even rendered a single frame
wid = conn.generate_id()
print("Window id is ", hex(wid))

# Create a window
conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()

# Map the window
print("mapping")
conn.core.MapWindowChecked(wid).check()

time.sleep(0.5)

set_window_bypass_compositor(conn, wid)

time.sleep(0.5)

set_window_bypass_compositor(conn, wid, 0)
reply, mode, output = prepare_root_configure(conn)
trigger_root_configure(conn, reply, mode, output)

time.sleep(2)

0 comments on commit b2033bf

Please sign in to comment.