如何使用xcbpython在根窗口上为X11窗口管理设置SubstructureRedirect事件掩码

2024-05-17 09:03:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我的代码没有给出任何异常,但我似乎没有接收到像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测试这个。在

我做错什么了吗?如果是的话,我该怎么解决呢?在


Tags: 代码importgetasconnectsetup事件root
1条回答
网友
1楼 · 发布于 2024-05-17 09:03:20

编辑: 问题在于参数数目不正确: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

相关问题 更多 >