Version: Gtkmm v3.22 (installed via vcpkg)
I've plugged in a multi-touch device that uses the standard Windows driver "HID-compliant touch screen".
I've verified that the native Windows WM_TOUCH is capable of multi-touch digitizing with this touchscreen here: https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
I created a basic gtkmm application and I've called set_support_multidevice()
on the parent_window()
before running the application.
However, when I connected the signal_touch_event()
of a Gtk::Button to a method, there is never any touch events recieved - only pointer-based events that can also be sent via the mouse.
Then to verify which devices were connected I wrote the following code:
// Get the device manager from the Gdk::Display object
Glib::RefPtr<Gdk::DeviceManager> dev_manager = parent_display->get_device_manager();
// Get device list from the device manager for type "floating"
std::vector<Glib::RefPtr<Gdk::Device>> devices =
dev_manager->list_devices(Gdk::DEVICE_TYPE_FLOATING);
for (int i = 0; i < devices.size(); i++) {
std::cout << "Device found: " << devices[i]->property_name() << std::endl;
}
// Get devices for type "master"
devices = dev_manager->list_devices(Gdk::DEVICE_TYPE_MASTER);
for (int i = 0; i < devices.size(); i++) {
std::cout << "Device found: " << devices[i]->property_name() << std::endl;
}
// Get devices for type "slave"
devices = dev_manager->list_devices(Gdk::DEVICE_TYPE_SLAVE);
for (int i = 0; i < devices.size(); i++) {
std::cout << "Device found: " << devices[i]->property_name() << std::endl;
}
// At this point we should have printed all devices associated with the Gdk::DeviceManager that's
// attached to the current display
It prints out all devices found by the device manager for the parent display. What I got was the following:
Device found: Virtual Core Keyboard
Device found: Virtual Core Pointer
Device found: System Aggregated Keyboard
Device found: System Aggregated Pointer
What do I have to do to get the device manager to recognize a slave device that is capable of multi-touch?
My multi-touch device is being treated as the system aggregated pointer and I can't handle typical touch events - only "mouse-like" events.
If you can isolate the device, you may be able to use gdk_device_set_mode() and set the device to master, which will allow it to handle all types of event. You might also want to use gdk_device_get_mode() to confirm if gdk is treating the device differently.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.