在ubuntu/linux中使用Xlib或xinput控制多个指针 [英] Controlling multiple pointers with Xlib or xinput in ubuntu/linux
问题描述
我正在创建一个在多个xsession中使用多个游标(指针)的系统.我的计算机中有多个视频卡,用于控制不同的显示器.我希望每个屏幕上都有一个不同的光标并控制每个屏幕.每个监视器都是一个不同的会话.
I'm creating a system that uses multiple cursors (pointers) in multiple xsessions. My computer has multiple video cards in it for controlling different monitors. I want to have a different cursor on each screen and control each. Each monitor is a different session.
我开始使用以下命令在C语言中使用xlib库来控制单个光标:
I started using the xlib library in C to control the single cursor I have using the following command:
XWarpPointer(display,None,window,0,0,0,0,x,y);
这非常适合一个光标.然后,我在终端中使用xinput创建了第二个游标:
This works perfectly for one cursor. Then I created a second cursor using xinput in the terminal:
>>xinput create-master second
,然后在屏幕上有两个光标.我可以使用reattach命令用单独的鼠标来控制它们:
and then I have two cursors on screen. I can go and control each with a separate mouse by using the reattach command:
>>xinput reattach MOUSEID POINTERID
最后一步是使用xlib分别控制每个游标.当我使用xWarpPointer命令时,它只是在原始光标周围移动,而我找不到一种方法来指定要控制的光标.我也一直无法找到一种设置默认指针的方法.您可以在终端中使用"xinput list"查看所有指针的列表.有人知道我怎么能
The last step is to control each cursor separately using xlib. When I use the xWarpPointer command it just moves the original cursor around and I can't find a way to designate which cursor to control. I have also been unable to find a way to set the default pointer. You can see a list of all the pointers using "xinput list" in terminal. Does anyone know how I can
感谢您的帮助!
推荐答案
您需要使用XInput2扩展中的 XIWarpPointer
请求,它以deviceid作为参数
You need to use XIWarpPointer
request from XInput2 extension, it takes deviceid as parameter
Bool XIWarpPointer(
Display* display,
int deviceid,
Window src_win,
Window dst_win,
double src_x,
double src_y,
unsigned int src_width,
unsigned int src_height,
double dst_x,
double dst_y
);
这篇关于在ubuntu/linux中使用Xlib或xinput控制多个指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!