Debian Codegraph @

tests/testcases/issue314_2.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 x = xproto.xprotoExtension(conn)
14
15 opacity_80 = [int(0xffffffff * 0.8), ]
16 opacity_single = [int(0xffffffff * 0.002), ]
17
18 # issue 314 is caused by changing a windows target opacity during its fade-in/-out transition
19 wid1 = conn.generate_id()
20 print("Window 1: ", hex(wid1))
21
22 atom = "_NET_WM_WINDOW_OPACITY"
23 opacity_atom = conn.core.InternAtom(False, len(atom), atom).reply().atom
24
25 # Create windows
26 conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
27
28 # Set Window names
29 set_window_name(conn, wid1, "Test window 1")
30
31 # Check updating opacity while MAPPING windows
32 print("Mapping window")
33 conn.core.MapWindowChecked(wid1).check()
34 time.sleep(0.5)
35
36 print("Update opacity while fading in")
37 conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_80).check()
38 time.sleep(0.2)
39 conn.core.ChangePropertyChecked(xproto.PropMode.Replace, wid1, opacity_atom, xproto.Atom.CARDINAL, 32, 1, opacity_single).check()
40 time.sleep(1)
41
42 conn.core.DeletePropertyChecked(wid1, opacity_atom).check()
43 time.sleep(0.5)
44
45 # Destroy the windows
46 conn.core.DestroyWindowChecked(wid1).check()