Debian Codegraph @

tests/testcases/clear_shadow_unredirected.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 import xcffib.xproto as xproto
4 import xcffib
5 import time
6 from common import set_window_name
7
8 conn = xcffib.connect()
9 setup = conn.get_setup()
10 root = setup.roots[0].root
11 visual = setup.roots[0].root_visual
12 depth = setup.roots[0].root_depth
13
14 name = "_NET_WM_STATE"
15 name_atom = conn.core.InternAtom(False, len(name), name).reply().atom
16 atom = "ATOM"
17 atom_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
18 fs = "_NET_WM_STATE_FULLSCREEN"
19 fs_atom = conn.core.InternAtom(False, len(fs), fs).reply().atom
20
21 # making sure disabling shadow while screen is unredirected doesn't cause assertion failure
22 wid = conn.generate_id()
23 print("Window id is ", hex(wid))
24
25 # Create a window
26 conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
27
28 # Set Window name so it does get a shadow
29 set_window_name(conn, wid, "YesShadow")
30
31 # Map the window
32 print("mapping")
33 conn.core.MapWindowChecked(wid).check()
34
35 time.sleep(0.5)
36
37 # Set fullscreen property, causing screen to be unredirected
38 conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, name_atom, atom_atom, 32, 1, [fs_atom]).check()
39
40 time.sleep(0.5)
41
42 # Set the Window name so it loses its shadow
43 print("set new name")
44 set_window_name(conn, wid, "NoShadow")
45
46 # Unmap the window
47 conn.core.UnmapWindowChecked(wid).check()
48
49 time.sleep(0.5)
50
51 # Destroy the window
52 conn.core.DestroyWindowChecked(wid).check()