| 1 |
|
| 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 |
|
| 16 |
wid1 = conn.generate_id() |
| 17 |
print("Window 1: ", hex(wid1)) |
| 18 |
wid2 = conn.generate_id() |
| 19 |
print("Window 2: ", hex(wid2)) |
| 20 |
|
| 21 |
|
| 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 |
|
| 26 |
set_window_name(conn, wid1, "Test window 1") |
| 27 |
set_window_name(conn, wid2, "Test window 2") |
| 28 |
|
| 29 |
|
| 30 |
print("Mapping 1") |
| 31 |
conn.core.MapWindowChecked(wid1).check() |
| 32 |
print("Mapping 2") |
| 33 |
conn.core.MapWindowChecked(wid2).check() |
| 34 |
time.sleep(0.5) |
| 35 |
|
| 36 |
x.SetInputFocusChecked(0, wid1, xproto.Time.CurrentTime).check() |
| 37 |
time.sleep(0.5) |
| 38 |
|
| 39 |
|
| 40 |
print("Destroy 1 while fading out") |
| 41 |
conn.core.DestroyWindowChecked(wid1).check() |
| 42 |
x.SetInputFocusChecked(0, wid2, xproto.Time.CurrentTime).check() |
| 43 |
time.sleep(1) |
| 44 |
conn.core.DestroyWindowChecked(wid2).check() |