如何防止X Window接收用户输入? [英] How to prevent an X Window from receiving user input?

查看:99
本文介绍了如何防止X Window接收用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Linux桌面上创建一些窗口,以简化布局.我需要避免进入这些窗口的用户输入(并且我想避免窗口获得焦点应该足以实现此目的).

我认为我可以通过设置WM_HINTS属性来使用xprop命令执行此操作,但是我还没有找到有关如何执行此操作的具体文档.

顺便说一句,对于mplayer窗口,我可以通过使用选项-input nodefault-bindings:conf=/dev/null来做到这一点.我只需要一个通用的解决方案,就可以在任何应用程序的窗口上以较低的级别执行该应用程序.

谢谢!

解决方案

一个窗口通过设置事件掩码中的KeyPressKeyRelease位来指示是否要接收键盘输入.如果您不希望窗口接收键盘输入,只需不要在CreateWindow()的事件掩码中设置这些事件.请参见 http://www.x.org/有关更多信息,请发布/X11R7.7/doc/xproto/x11protocol.html#requests:ChangeWindowAttributes .

此外,还应将窗口的输入焦点提示设置为"NoFocus",如ICCCM的4.1.7节所述: 解决方案

A window indicates whether it wants to receive keyboard input by setting the KeyPress and KeyRelease bits in its event mask. If you do not want your window to receive keyboard input, simply do not set those event in CreateWindow()'s event mask. See http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:ChangeWindowAttributes for more information.

Additionally, you should also set the input focus hints for your window to "NoFocus", as described in section 4.1.7 of ICCCM: http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

If you want to fiddle with other applications' windows, you should be able to change their attributes and hints, although this may result in undesirable behavior and/or side effects.

这篇关于如何防止X Window接收用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆