簡體   English   中英

gtkmm 多點觸控設備無法識別 (Windows)

[英]gtkmm multi-touch device not recognized (Windows)

版本:Gtkmm v3.22(通過 vcpkg 安裝)

我已插入使用標准 Windows 驅動程序“符合 HID 的觸摸屏”的多點觸控設備。

我已經在這里驗證了本機 Windows WM_TOUCH 能夠使用此觸摸屏進行多點觸控數字化: https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch -消息

我創建了一個基本的 gtkmm 應用程序,並在運行應用程序之前在set_support_multidevice()上調用了parent_window()

但是,當我將 Gtk::Button 的signal_touch_event()連接到一個方法時,從來沒有收到任何觸摸事件 - 只有基於指針的事件也可以通過鼠標發送。

然后為了驗證連接了哪些設備,我編寫了以下代碼:

    // 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

它打印出設備管理器為父顯示器找到的所有設備。 我得到的是以下內容:

Device found: Virtual Core Keyboard
Device found: Virtual Core Pointer
Device found: System Aggregated Keyboard
Device found: System Aggregated Pointer

我必須做什么才能讓設備管理器識別能夠進行多點觸控的從設備?

我的多點觸控設備被視為系統聚合指針,我無法處理典型的觸控事件——只有“鼠標類”事件。

如果您可以隔離設備,則可以使用gdk_device_set_mode()並將設備設置為主設備,這將允許它處理所有類型的事件。 您可能還想使用 gdk_device_get_mode() 來確認 gdk 是否以不同的方式對待設備。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM