如何在Linux下使用C程序在X窗口中设置鼠标的光标位置?
谢谢 :)
(例如WIN中的setcursorpos())
编辑:
我已经试过了这段代码,但是不起作用:
#include <curses.h>
main(){
move(100, 100);
refresh();
}
最佳答案
12.4-Moving the Pointer
示例:
Display *dpy;
Window root_window;
dpy = XOpenDisplay(0);
root_window = XRootWindow(dpy, 0);
XSelectInput(dpy, root_window, KeyReleaseMask);
XWarpPointer(dpy, None, root_window, 0, 0, 0, 0, 100, 100);
XFlush(dpy); // Flushes the output buffer, therefore updates the cursor's position. Thanks to Achernar.
关于c - 如何在Linux上的C中设置鼠标光标的位置?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2433447/