哪个 XWindow 属性可以阻止窗口获得焦点,同时允许它接收鼠标事件?
我正在用 python 编写一个屏幕键盘,但很混乱。我已经获得了 ClutterStage 的 XWindow 对象,但找不到任何阻止窗口窃取焦点的属性。基本上,它需要接受鼠标事件(单击、运动等),同时不从它尝试输入的窗口窃取键盘焦点。有什么想法吗? :)
I am writing an Onscreen Keyboard in python, with clutter. I've gotten the ClutterStage's XWindow object, but I can't find any properties which prevent the window from stealing focus. Basically, it needs to accept mouse events (click, motion, etc), while not stealing keyboard focus from the window it is trying to type in. Any ideas? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您希望将 WM_HINTS 属性中的输入提示设置为 false,而不添加 WM_TAKE_FOCUS 属性。这将确保窗口管理器永远不会将键盘焦点转移到您的窗口,但不会阻止其他事件。请参阅 ICCCM 第 4.1.7 节。
http://tronche.com/gui/x/icccm /sec-4.html#s-4.1.7
You want to set the input hint in your WM_HINTS property to false and not add the WM_TAKE_FOCUS property. This will ensure the window manager never transfers keyboard focus to your window but does not block other events. See section 4.1.7 of the ICCCM.
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7
根据输入传递在 X11 上的工作方式,这种情况不会发生:X11 窗口必须具有焦点才能接收输入事件 - 换句话说:事件仅传递到获得焦点的窗口。
例如,GTK+ 中的输入法和辅助功能支持依赖于工具包通过特定的 API(分别为 IM 和 ATK)向另一个进程发送数据和从另一个进程接收数据。 GNOME 中的所有虚拟键盘都使用任一方法来处理输入事件。
在纯 X11 上,您可以使用 XTest 扩展 API 将事件从虚拟键盘发送到调用它的应用程序。
by the way input delivery works on X11, this cannot happen: an X11 window has to have focus in order to receive input events - in other words: events are delivered only to the focused window.
the input method and accessibility support in GTK+, for instance, relies on the toolkit sending and receiving data to and from another process, through a specific API (IM and ATK, respectively). all virtual keyboard in GNOME use either methods to handle input events.
on pure X11 you could use the XTest extension API to send events from the virtual keyboard to the application that invoked it.