我有这个代码没有给出任何异常,但我似乎没有接收像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测试这个。
我做错了吗?如果是这样,我该如何解决?
答案 0 :(得分:3)
编辑:
问题在于参数数量不正确: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