使用GTK3 C ++获取指针坐标

我正在寻找GTK +中的函数,该函数可以告诉我光标(x,y)的坐标,也可以在Linux操作系统上使用。

任何答案都将不胜感激。

评论
  • 洋子舒
    洋子舒 回复

    A quick check of the documentation turned up gdk_window_get_device_position(), which should work even outside mouse events. (I have not tried it myself.) The caveat here is that this is for GDK windows, not what most people think of as windows (i.e. GTK+ windows). One path from a GTK+ widget to a GDK window is gtk_widget_get_window().

    至于在Linux上工作,GTK +被设计为跨平台的,因此,除非另有特别说明,否则一切都应在Linux上工作。