From da018c184283fb2f358f1f45cf295a2ddda2985b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 12 Nov 2016 11:44:18 +0000 Subject: [PATCH] Re-enable selection in MultiTreeView on a drag-end event In 201f4a5e517ae5d84fbbde95113ecdf9c7e7bb62 we made grab_broken re-enable selection because GTK 3.18 and later no longer send a fake button release event. The sending of grab broken is an implementation detail of DnD on X based systems however, and at least some GTK backends do not generate this, wayland being one example. So we now use drag-end instead which is always sent to the source when a DnD operation completes. --- gramps/gui/clipboard.py | 4 ++-- gramps/gui/widgets/multitreeview.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py index 85f8ddc1f..7a4c21a07 100644 --- a/gramps/gui/clipboard.py +++ b/gramps/gui/clipboard.py @@ -1479,7 +1479,7 @@ class MultiTreeView(Gtk.TreeView): Gtk.TreeView.__init__(self) self.connect('button_press_event', self.on_button_press) self.connect('button_release_event', self.on_button_release) - self.connect('grab_broken_event', self.on_grab_broken) + self.connect('drag-end', self.on_drag_end) self.connect('key_press_event', self.key_press_event) self.defer_select = False @@ -1581,7 +1581,7 @@ class MultiTreeView(Gtk.TreeView): self.defer_select=False - def on_grab_broken(self, widget, event): + def on_drag_end(self, widget, event): # re-enable selection self.get_selection().set_select_function(lambda *ignore: True, None) self.defer_select=False diff --git a/gramps/gui/widgets/multitreeview.py b/gramps/gui/widgets/multitreeview.py index a8843da06..45b36b90e 100644 --- a/gramps/gui/widgets/multitreeview.py +++ b/gramps/gui/widgets/multitreeview.py @@ -40,7 +40,7 @@ class MultiTreeView(Gtk.TreeView): Gtk.TreeView.__init__(self) self.connect('button_press_event', self.on_button_press) self.connect('button_release_event', self.on_button_release) - self.connect('grab_broken_event', self.on_grab_broken) + self.connect('drag-end', self.on_drag_end) self.connect('key_press_event', self.key_press_event) self.defer_select = False @@ -83,7 +83,7 @@ class MultiTreeView(Gtk.TreeView): self.defer_select=False - def on_grab_broken(self, widget, event): + def on_drag_end(self, widget, event): # re-enable selection self.get_selection().set_select_function(lambda *ignore: True, None) self.defer_select=False