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().
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 isgtk_widget_get_window()
.至于在Linux上工作,GTK +被设计为跨平台的,因此,除非另有特别说明,否则一切都应在Linux上工作。