在mutter窗口管理器中获取x按钮事件

时间:2015-03-05 13:43:19

标签: mouseevent x11 xlib

我试图处理来自XEvent的按钮事件。我的窗口管理器是mutter。我在我的窗口上添加了一个按钮,但每当我点击该按钮时,我都会收到PropertyNotify信号,而不是ButtonPress

我尝试使用XIGrabButton()抓取按钮事件,但阻止了我在mutter上运行的UI。我尝试使用XI_ButtonPress屏蔽事件XI_ButtonReleaseXISetMask()然后我尝试抓住按钮事件,但它无效。

我错过了什么?

1 个答案:

答案 0 :(得分:1)

你不能(至少直接,没有坐在客户端和服务器之间)。来自x11协议规范:

Multiple clients can select input on the same window; their event-masks are
disjoint. When an event is generated, it will be reported to all interested
clients. However, only one client at a time can select for SubstructureRedirect
, only one client at a time can select for ResizeRedirect, and only one client
at a time can select for ButtonPress. An attempt to violate these restrictions
results in an Access error.