[meld/deprecation-cleanup: 31/48] filediff: Rework the keymask-focus handling to be purely textview-local
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/deprecation-cleanup: 31/48] filediff: Rework the keymask-focus handling to be purely textview-local
- Date: Sun, 2 Dec 2018 02:44:44 +0000 (UTC)
commit d32d268a1b11a79117287c44da0808a2f7106c9b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 1 09:38:10 2018 +1000
filediff: Rework the keymask-focus handling to be purely textview-local
The bug that this code was addressing goes like this:
* Hold down Shift to trigger delete mode
* Switch window focus to another application
* File comparison actions are stuck in delete mode even after
refocusing, until Shift is pressed again.
The solution that we had addressed this directly by hooking in to the
window focus change. This worked (except for e.g., switching the focus
widget within Meld itself...) but was complete overkill. The new fix
here takes the significantly saner approach of just always resetting
the keymask when you unfocus a text view.
meld/filediff.py | 4 +---
meld/meldwindow.py | 10 ----------
2 files changed, 1 insertion(+), 13 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 0a61f2a2..56872e78 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -323,9 +323,6 @@ class FileDiff(MeldDoc, Component):
self.findbar.start_find_previous(self.focus_pane)
self.keymask &= ~mod_key
- def on_focus_change(self):
- self.keymask = 0
-
def on_text_filters_changed(self, app):
relevant_change = self.create_text_filters()
if relevant_change:
@@ -789,6 +786,7 @@ class FileDiff(MeldDoc, Component):
self.update_text_actions_sensitivity()
def on_textview_focus_out_event(self, view, event):
+ self.keymask = 0
self._set_merge_action_sensitivity()
self._set_external_action_sensitivity()
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 6c5bc72c..a34b1e30 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -214,8 +214,6 @@ class MeldWindow(Gtk.ApplicationWindow):
self.ui.ensure_update()
self.diff_handler = None
self.undo_handlers = tuple()
- self.connect('focus_in_event', self.on_focus_change)
- self.connect('focus_out_event', self.on_focus_change)
# Set tooltip on map because the recentmenu is lazily created
rmenu = self.ui.get_widget('/Menubar/FileMenu/Recent').get_submenu()
@@ -241,14 +239,6 @@ class MeldWindow(Gtk.ApplicationWindow):
for imagemenuitem in recentmenu.get_children():
imagemenuitem.set_tooltip_text(imagemenuitem.get_label())
- def on_focus_change(self, widget, event, callback_data=None):
- for idx in range(self.notebook.get_n_pages()):
- w = self.notebook.get_nth_page(idx)
- if hasattr(w.pyobject, 'on_focus_change'):
- w.pyobject.on_focus_change()
- # Let the rest of the stack know about this event
- return False
-
def on_widget_drag_data_received(
self, wid, context, x, y, selection_data, info, time):
uris = selection_data.get_uris()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]