如何在Linux/X11下隐藏鼠标指针? [英] How do you hide the mouse pointer under Linux/X11?

查看:804
本文介绍了如何在Linux/X11下隐藏鼠标指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将鼠标指针隐藏在X11下?我想使用内置库来执行此操作,而不要使用SDL(SDL_ShowCursor(0))或glut(glutSetCursor(GLUT_CURSOR_NONE))之类的东西.另外,无论指针处于什么位置,都应该隐藏鼠标指针,而不仅仅是在其自己的窗口中.

How do I hide the mouse pointer under X11? I would like to use the built in libraries in order to do this and not something like SDL (SDL_ShowCursor(0)) or glut (glutSetCursor(GLUT_CURSOR_NONE)). Also, the mouse pointer should be hidden no matter the pointer location, not just in its own window.

推荐答案

您可以创建并设置一个不可见的光标主题.此技巧由 maemo 使用,因为在触摸屏设备上放置光标是毫无意义的.

You can create and set an invisible cursor theme. This trick is used by maemo, because it's rather pointless to have a cursor on a touchscreen device.

不幸的是,在X11应用程序和工具包中,在运行时更改全局光标主题的能力并不统一.您可以更改服务器资源Xcursor.theme,没有人会注意到(通常仅在启动时才查询).您可以通知 xsettings ,这似乎只会影响Gtk +程序; KDE通过根窗口上的属性使用某种通讯方式.等

Sadly, the ability to change the global cursor theme at runtime is not uniform across X11 applications and toolkits. You can change the server resource Xcursor.theme, and nobody will notice (generally it's only queried at startup); you can inform xsettings which only seems to affect Gtk+ programs; KDE uses some sort of communication through properties on the root window; etc.

至少为您自己的应用程序更改光标就像 XDefineCursor ,如果您在根窗口上执行此操作,则某些应用程序可能紧随其后.

At least changing the cursor for your own application is as easy as XDefineCursor, and if you do that on the root window, some applications might follow along.

这篇关于如何在Linux/X11下隐藏鼠标指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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