Debian Codegraph @

tests/testcases/issue239_2.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 import xcffib.xproto as xproto
4 import xcffib
5 import time
6
7 conn = xcffib.connect()
8 setup = conn.get_setup()
9 root = setup.roots[0].root
10 visual = setup.roots[0].root_visual
11 depth = setup.roots[0].root_depth
12
13 # issue 239 is caused by a window gaining a shadow during its fade-out transition
14 wid = conn.generate_id()
15 print("Window ids are ", hex(wid))
16
17 # Create a window
18 mask = xproto.CW.BackPixel
19 value = [ setup.roots[0].white_pixel ]
20 conn.core.CreateWindowChecked(depth, wid, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, mask, value).check()
21
22 name = "_NET_WM_STATE"
23 name_atom = conn.core.InternAtom(False, len(name), name).reply().atom
24 atom = "ATOM"
25 atom_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
26 fs = "_NET_WM_STATE_FULLSCREEN"
27 fs_atom = conn.core.InternAtom(False, len(fs), fs).reply().atom
28
29
30 # Map the window, causing screen to be redirected
31 conn.core.MapWindowChecked(wid).check()
32
33 time.sleep(0.5)
34
35 # Set fullscreen property, causing screen to be unredirected
36 conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, name_atom, atom_atom, 32, 1, [fs_atom]).check()
37
38 time.sleep(0.5)
39
40 # Clear fullscreen property, causing screen to be redirected
41 conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid, name_atom, atom_atom, 32, 0, []).check()
42
43 # Do a round trip to X server so the compositor has a chance to start the rerun of _draw_callback
44 conn.core.GetInputFocus().reply()
45
46 # Unmap the window, triggers the bug
47 conn.core.UnmapWindowChecked(wid).check()
48
49 time.sleep(0.5)
50
51 # Destroy the window
52 conn.core.DestroyWindowChecked(wid).check()