[kupfer] ui: Workaround conflict between repeated key swallowing and ibus



commit cec68546ab3639463e8fe55e8f449910ed47e365
Author: David Schneider <a example com>
Date:   Sat Mar 19 14:30:46 2011 +0100

    ui: Workaround conflict between repeated key swallowing and ibus
    
    Quote: """
    Some more debugging and it turns out that for whatever reason, ibus
    generates an extra keypress event for each letter pressed. The second
    event is caught by the "held key" detection feature of Kupfer (for
    launching default actions) and is getting swallowed.
    
    ...
    
    Since the time between the two events appears to be on the order of 1
    to 5 ms, attached is a patch that puts a minimum threshold on the
    repeat time.
    I have it set to 20ms, which is very safe for making sure ibus
    keypresses get through, although it will break things for people who
    have their repeat rate set to 50 Hz.
    The ideal patch would compare the delay to the current X11 repeat rate
    setting, but this gets things working.
    """
    
    Launchpad-bug: https://bugs.launchpad.net/kupfer/+bug/601816

 kupfer/ui/browser.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index 8a8fe2c..70c360e 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -889,6 +889,7 @@ class Interface (gobject.GObject):
 		self._slow_input_interval = 2
 		self._key_press_time = None
 		self._key_press_interval = 0.8
+		self._key_press_repeat_threshold = 0.02
 		self._key_pressed = None
 		self._reset_to_toplevel = False
 		self._reset_when_back = False
@@ -1050,7 +1051,8 @@ class Interface (gobject.GObject):
 
 		# activate on repeated key
 		if ((not text_mode) and self._key_pressed == keyv and
-				keyv not in self.keys_sensible):
+				keyv not in self.keys_sensible and
+				curtime - self._key_press_time > self._key_press_repeat_threshold):
 			if curtime - self._key_press_time > self._key_press_interval:
 				self._activate(None, None)
 				self._key_pressed = None



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