Commit 3837eda7 authored by Vincent Legoll's avatar Vincent Legoll

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
parent fec3db7e
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment