how to set cursor position in gtk -Linux, MonoDevelop

房东的猫 提交于 2019-12-07 03:09:58

问题


Okay, so I thought I would get into Linux development. However, I found that you cant hardly manipulate the mouse and keyboard. My question is does GTK not support that sort of thing, or am I missing something?

In windows its easy:

Point Pos = new Point(20,20);
    Cursor.Position = Pos;

How would I do that in Linux? I'm using MonoDevelop. Thanks!


回答1:


Since you mention using MonoDevelop on Linux, I assume you are using Gtk#. Using Gtk#, you need to use Gdk.Display.WarpPointer. Untested, but probably something like the following would work:

Gdk.Display.Default.WarpPointer(Gdk.Display.DefaultScreen, 20, 20);


来源:https://stackoverflow.com/questions/16727215/how-to-set-cursor-position-in-gtk-linux-monodevelop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!