是否可以通过编程方式将光标位置设置在当前分辨率之外?
操作系统:Ubuntu 14 窗口管理器:Compiz 分辨率:1920 * 1080
XWarpPointer(display, None, None, 0, 0, 0, 0, 0, 1090);
上面的代码只能将光标移动到底部边缘。
最佳答案
XWarpPointer
至少有一个记录在案的限制(这可能会影响您的程序):
Note that you cannot use
XWarpPointer()
to move the pointer outside the confine_to window of an active pointer grab. An attempt to do so will only move the pointer as far as the closest edge of the confine_to window.
想要将指针 移出屏幕的可能原因是为了隐藏它。 X 应用程序可以使用 XDefineCursor
定义一个光标 (用于显示指针),并隐藏那个。当然,这是针对给定窗口的。
xterm
这样做,例如,因为 patch #230 (“在用户键入时隐藏鼠标指针”)。
以下是一些使用或讨论该技术的链接:
- LinuxMouse.cpp , 源代码
- Platform_Linux.cpp , 源代码
- How to hide the mouse pointer? , 关于 comp.windows.x 的讨论
- The Cursor , 一组幻灯片
- Basic Graphics Programming With The Xlib Library - Part II
关于linux - X系统下设置光标位置超出分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32386598/