3

I can't get double clicking to work on a Surface Pro 3 (Fedora; Kernel 4.28; Gnome 3.18, Gtk3). Two fast consecutive taps are not converted to a 2button event in Gtk+. See the small Python program below, which works fine for a normal mouse or touch pad.

I've checked that it is not a problem with the tap time and not the tap distance as you can see in the program. Where could this problem originate from? GDK_TOUCH_MASK?

To clarify, button events are received, but never converted to 2button event

#!/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()
gpoo
  • 8,408
  • 3
  • 38
  • 53
cass
  • 309
  • 1
  • 5
  • 14

0 Answers0