Thanks. Either I am doing something wrong (probably) or it isn’t working or both.
Using the example I linked to above as a starting point, I rewrote the signal handlers for the Drag Gesture as
static void drag_begin (GtkGestureDrag *gesture, double x, double y,
GtkWidget *area) {
std::cout << "drag_begin\n";
}
static void drag_update (GtkGestureDrag *gesture, double x, double y,
GtkWidget *area) {
std::cout << "drag_update\n";
GdkDevice* device = gtk_gesture_get_device(GTK_GESTURE(gesture));
std::cout << " device = " << device << "\n";
// Source should distuingish between mouse and pen
std::cout << " device_source = " << gdk_device_get_source(device) << "\n";
GdkEventSequence* sequence = gtk_gesture_get_last_updated_sequence (GTK_GESTURE(gesture));
GdkEvent* event = gtk_gesture_get_last_event(GTK_GESTURE(gesture), sequence);
std::cout << " emulated = " << gdk_event_get_pointer_emulated(event) << "\n";
}
static void drag_end (GtkGestureDrag *gesture, double x, double y,
GtkWidget *area) {
std::cout << "drag_end\n";
}
And those for the Stylus Gesture as:
static void stylus_down(GtkGestureStylus* gesture, double x, double y, GtkWidget* area) {
std::cout << "stylus_down\n";
}
static void stylus_motion(GtkGestureStylus* gesture, double x, double y, GtkWidget* area) {
std::cout << "stylus_motion\n";
GdkDevice* device = gtk_gesture_get_device(GTK_GESTURE(gesture));
std::cout << " device = " << device << "\n";
std::cout << " device_source = " << gdk_device_get_source(device) << "\n";
GdkEventSequence* sequence = gtk_gesture_get_last_updated_sequence (GTK_GESTURE(gesture));
GdkEvent* event = gtk_gesture_get_last_event(GTK_GESTURE(gesture), sequence);
std::cout << " emulated = " << gdk_event_get_pointer_emulated(event) << "\n";
}
static void stylus_up(GtkGestureStylus* gesture, double x, double y, GtkWidget* area) {
std::cout << "stylus_up\n";
}
For a mouse and touchpad this gives me the following output:
drag_begin
drag_update
device = 0x55811fbb1a00
device_source = 0
emulated = 0
...
drag_end
For a drawing tablet:
drag_begin
stylus_down
drag_update
device = 0x55811fbb1a00
device_source = 0
emulated = 0
stylus_motion
device = 0x55811fbb1a00
device_source = 0
emulated = 0
...
drag_end
stylus_up
What I don’t understand is that the address of the device is exactly the same for each device (mouse, touchpad, pen). And perhaps because of that the source and pointer_emulated are also exactly the same. Am I calling these functions the wrong way? Do I misunderstand what these functions are supposed to do?