Gnome双击触摸屏

时间:2016-01-23 09:59:22

标签: gtk gnome touchscreen gdk xinput

我无法双击Surface Pro 3(Fedora;内核4.28; Gnome 3.18,Gtk3)。两个快速连续点击不会在Gtk +中转换为2button事件。请参阅下面的小型Python程序,该程序适用于普通鼠标或触摸板。

我已经检查过点击时间不是问题,而不是程序中可以看到的点击距离。这个问题可能来自哪里? GDK_TOUCH_MASK

为了澄清,收到按钮事件,但从未转换为2button事件

#!/usr/bin/python
import gi
gi.require_version('Gtk', '3.0')    
from gi.repository import Gtk, Gdk, GLib

class MyWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Double Click Test")
        self.button = Gtk.Button.new_with_label("Double-click test\n\n")
        self.button.connect("button-press-event", self.test_button_clicked)
        self.button.connect("button-release-event", self.test_button_released)
        settings = Gtk.Settings.get_default()
        Gtk.Settings.set_property(settings,'gtk-double-click-distance',1000)
        print Gtk.Settings.get_property(settings,'gtk-double-click-distance')
        Gtk.Settings.set_property(settings,'gtk-double-click-time',1000)
        print Gtk.Settings.get_property(settings,'gtk-double-click-time')
        self.add(self.button)

    def test_button_clicked(self, widget, event):
      if event.type == Gdk.EventType._2BUTTON_PRESS:
        widget.set_label(("Success!"))
        GLib.timeout_add(1000, self.reset_test_button, widget)
      return True

    def test_button_released(self, widget, event):
      return True

    def reset_test_button(self, widget):
        widget.set_label(("Double-click test"))
        return False

win = MyWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

0 个答案:

没有答案