如何在 Linux 上将光标锁定在窗口内部?
我正在尝试为 Linux 制作一款游戏,其中涉及大量快速动作和鼠标光标的快速移动。如果用户想在窗口模式下玩,我很想将光标锁定在窗口内部,以避免在激烈的战斗中意外更改程序(显然,如果用户更改程序或按退出键,这会自行取消)暂停菜单。)
在 Windows 上,可以使用 ClipCursor()。我在 Linux 上找不到类似的东西。有吗?
我计划在纯 X 代码中执行此操作,但显然如果有人知道在任何 Linux 窗口库中执行此操作的方法,那么我只需阅读源代码并找出如何在 X 中复制它即可。
I'm trying to put together a game for Linux which involves a lot of fast action and flinging around of the mouse cursor. If the user wants to play in windowed mode, I'd quite like to lock the cursor to the inside of the window to avoid accidentally changing programs in the heat of battle (obviously this will cancel itself if the user changes programs or hits escape for the pause menu.)
On Windows, this can be accomplished easily with ClipCursor(). I can't find an equivalent on Linux. Is there one?
I plan to do this in pure X code, but obviously if anyone knows of a way to do this in any Linux windowing library then I can just read the source code and figure out how to duplicate it in X.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)