Debian Codegraph @

tests/testcases/issue465.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 # issue 465 is triggered when focusing a new window with a shadow-exclude rule for unfocused windows.
16 wid1 = conn.generate_id()
17 print("Window 1: ", hex(wid1))
18 wid2 = conn.generate_id()
19 print("Window 2: ", hex(wid2))
20
21 # Create a window
22 conn.core.CreateWindowChecked(depth, wid1, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
23 conn.core.CreateWindowChecked(depth, wid2, root, 0, 0, 100, 100, 0, xproto.WindowClass.InputOutput, visual, 0, []).check()
24
25 # Set Window name
26 set_window_name(conn, wid1, "Test window 1")
27 set_window_name(conn, wid2, "Test window 2")
28
29 print("mapping 1")
30 conn.core.MapWindowChecked(wid1).check()
31 print("mapping 2")
32 conn.core.MapWindowChecked(wid2).check()
33 time.sleep(0.5)
34
35 x.SetInputFocusChecked(0, wid1, xproto.Time.CurrentTime).check()
36 time.sleep(0.5)
37
38 # Destroy the windows
39 conn.core.DestroyWindowChecked(wid1).check()
40 time.sleep(1)