The axis limit API accidentially ended up as private, upstream is aware of it and looks into making it publically available in GTK+ 3.10.
GTK+3 porting: GdkDeviceAxis
题
Currently i have this gtk2 code:
GList *input_devices = gdk_devices_list();
while(input_devices)
{
GdkDevice *device = (GdkDevice*)input_devices->data;
for(int i = 0; i < gdk_device_get_n_axes(device); i++)
{
GdkDeviceAxis* axis = &device->axes[i];
printf("[%f .. %f]\n", axis->min, axis->max);
}
input_devices = g_list_next(input_devices);
}
I'm trying to port that to gtk3, and i do not understand how to get axis minimal and maximal values.
Is it even possible with current GDK3 API?
解决方案
其他提示
AFAIK, there is no GDK 3, GDK has been mostly replaced by cairo. There's a GTK 2 to GTK 3 porting guide, but input devices seem not covered. So you're asking a good question...
The min and max values don't seem to be exposed in the GDK 3 API. However, looking at the source code, it seems that the X and Y tilt axes can range from -1.0 to 1.0, and pressure and wheel axes can range from 0.0 to 1.0. Presumably, X and Y coordinate axes are screen-dependent.
不隶属于 StackOverflow