[英]How to set SubstructureRedirect event mask on the root window using xcb python for a X11 window manager
我有這個代碼沒有給出任何異常,但我似乎沒有接收像MapRequests或ConfigureNotifys這樣的事件:
import xcb
import xcb.xproto as xproto
conn = xcb.connect()
root = conn.get_setup().roots[0].root
eventmask = [xproto.EventMask.SubstructureRedirect, xproto.EventMask.SubstructureNotify]
conn.core.ChangeWindowAttributesChecked(self.root, xproto.CW.EventMask, eventmask)
while True:
e = conn.wait_for_event()
print e
我在Xephyr測試這個。
難道我做錯了什么? 如果是這樣,我該如何解決?
編輯:問題是參數數量不正確: xproto.CW.EventMask
表示你有一個值,你傳遞的是[xproto.EventMask.SubstructureRedirect, xproto.EventMask.SubstructureNotify]
,它應該是[xproto.EventMask.SubstructureRedirect|xproto.EventMask.SubstructureNotify]
import xcb
import xcb.xproto as xproto
conn = xcb.connect()
root = conn.get_setup().roots[0].root
conn.core.ChangeWindowAttributesChecked(self.root, xproto.CW.EventMask, [xproto.EventMask.SubstructureRedirect|xproto.EventMask.SubstructureNotify])
while True:
e = conn.wait_for_event()
print e
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.