在C ++中移动鼠标指针在Linux上失败 [英] Moving the mouse pointer in C++ fails on Linux

查看:174
本文介绍了在C ++中移动鼠标指针在Linux上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码隐藏和显示鼠标光标:

I'm using the following code to hide and show the mouse cursor:

XDefineCursor( m_display, m_window, show ? None : m_hiddenCursor );  
XFlush( m_display );

这很好。但是,当我运行这个:

That works fine. However, when I run this:

XWarpPointer( m_display, None, m_window, 0, 0, 0, 0, x, y );
XFlush( m_display );

鼠标根本不移动。只是没有发生。 SetMousePos,我用于Windows,工作正常。

The mouse doesn't move at all. Simply nothing happens. SetMousePos, which I'm using for Windows, works fine.

推荐答案

这是一段时间,但XWarpPointer 相对使用传递的偏移量移动光标?看起来像传递的偏移量是(0,0),意味着光标不会移动。我想你要使用的例程是XMovePointer。

It's been a while, but doesn't XWarpPointer make a relative move of the cursor using the passed offsets? It looks like the passed offsets are (0,0) meaning that the cursor wouldn't move. I think the routine you want to use is XMovePointer.

分享和享受。

这篇关于在C ++中移动鼠标指针在Linux上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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