From 201f4a5e517ae5d84fbbde95113ecdf9c7e7bb62 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 20 Oct 2015 00:13:55 +0100 Subject: [PATCH] Re-enable selection in MultiTreeView on a grab_broken event As of GTK 3.18.0 a fake button release event is no longer sent when a DnD completes: https://bugzilla.gnome.org/show_bug.cgi?id=749737 As a result we keep selection disabled which then means that the next drag from the clipboard fails to select the dragged object and we wind up trying to drop the old selection instead. --- gramps/gui/clipboard.py | 6 ++++++ gramps/gui/widgets/multitreeview.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py index 9b16bcb90..c0f83d4ab 100644 --- a/gramps/gui/clipboard.py +++ b/gramps/gui/clipboard.py @@ -1477,6 +1477,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('key_press_event', self.key_press_event) self.defer_select = False @@ -1578,6 +1579,11 @@ class MultiTreeView(Gtk.TreeView): self.defer_select=False + def on_grab_broken(self, widget, event): + # re-enable selection + self.get_selection().set_select_function(lambda *ignore: True, None) + self.defer_select=False + def edit_obj(self, objclass, handle): from .editors import (EditPerson, EditEvent, EditFamily, EditSource, EditPlace, EditRepository, EditNote, EditMedia, diff --git a/gramps/gui/widgets/multitreeview.py b/gramps/gui/widgets/multitreeview.py index d3cc8edca..a8843da06 100644 --- a/gramps/gui/widgets/multitreeview.py +++ b/gramps/gui/widgets/multitreeview.py @@ -40,6 +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('key_press_event', self.key_press_event) self.defer_select = False @@ -82,3 +83,7 @@ class MultiTreeView(Gtk.TreeView): self.defer_select=False + def on_grab_broken(self, widget, event): + # re-enable selection + self.get_selection().set_select_function(lambda *ignore: True, None) + self.defer_select=False