[meld] Fix for bug 579643 – modifier keys not reset when focus change



commit 3837eda793b72491368b57741342af5b8796b5c1
Author: Vincent Legoll <vincent legoll gmail com>
Date:   Fri May 1 13:53:26 2009 +0200

    Fix for bug 579643 â?? modifier keys not reset when focus change
    
    If you alt tab with a modifier key pressed at the same time
    this modifier key stays as pressed even if released when meld
    had not the focus.
    
    Steps to reproduce:
    - open file diff
    - press shift (see the linkmap buttons change)
    - keeping shift, press alt-tab
    - release shift
    - refocus meld
    - see the linkmap buttons still in shift mode
    
    This has also been reported to debian:
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=470781
    meld: Scroll modifier 'sticks' when window loses focus
---
 filediff.py |    4 ++++
 meldapp.py  |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/filediff.py b/filediff.py
index ac5063c..f2e5839 100644
--- a/filediff.py
+++ b/filediff.py
@@ -130,6 +130,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         gnomeglade.connect_signal_handlers(self)
         self.findbar = self.findbar.get_data("pyobject")
 
+    def on_focus_change(self):
+        self.keymask = 0
+        self._update_linkmap_buttons()
+
     def on_container_switch_in_event(self, ui):
         melddoc.MeldDoc.on_container_switch_in_event(self, ui)
         if self.textview_focussed:
diff --git a/meldapp.py b/meldapp.py
index 55c63f0..5bd9e1f 100644
--- a/meldapp.py
+++ b/meldapp.py
@@ -579,6 +579,16 @@ class MeldApp(gnomeglade.Component):
         self.widget.set_default_size(self.prefs.window_size_x, self.prefs.window_size_y)
         self.ui.ensure_update()
         self.widget.show()
+        self.widget.connect('focus_in_event', self.on_focus_change)
+        self.widget.connect('focus_out_event', self.on_focus_change)
+
+    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.get_data("pyobject"), 'on_focus_change'):
+                w.get_data("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):
         if len(selection_data.get_uris()) != 0:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]