[caribou] Make key repeat work



commit d523a6c363d7dd771cbc0a73a21f001b185cf3fc
Author: Eitan Isaacson <eitan monotonous org>
Date:   Wed Mar 24 11:38:09 2010 -0700

    Make key repeat work

 src/caribou/keyboard.py |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/caribou/keyboard.py b/src/caribou/keyboard.py
index e4999c8..835d6f5 100644
--- a/src/caribou/keyboard.py
+++ b/src/caribou/keyboard.py
@@ -118,7 +118,10 @@ class CaribouKeyboard(gtk.Frame):
                                 button = gtk.Button(key)
                                 button.set_use_underline(False)
                                 char = ord(key.decode('utf-8'))
-                                button.connect("clicked", self._send_unicode, char)
+                                button.connect("pressed", self._press_cb,
+                                               char)
+                                button.connect("released", self._release_cb,
+                                               char)
                         elif isinstance(key, tuple):
                             button = gtk.Button(key[0])
                             button.set_use_underline(False)
@@ -130,7 +133,10 @@ class CaribouKeyboard(gtk.Frame):
                                 self.switch_layer_buttons.append(button)
                             else:
                                 # regular key
-                                button.connect("clicked", self._send_keysym, key[1])
+                                button.connect("pressed",
+                                               self._keysym_press_cb, key[1])
+                                button.connect("released",
+                                               self._keysym_release_cb, key[1])
                         else:
                             pass # TODO: throw error here
 
@@ -141,12 +147,16 @@ class CaribouKeyboard(gtk.Frame):
         def _open_prefs(self, widget):
             KeyboardPreferences()
 
-        def _send_unicode(self, widget, char):
+        def _press_cb(self, widget, char):
             self.vk.press_unicode(char)
+
+        def _release_cb(self, widget, char):
             self.vk.release_unicode(char)
 
-        def _send_keysym(self, widget, char):
+        def _keysym_press_cb(self, widget, char):
             self.vk.press_keysym(char)
+
+        def _keysym_release_cb(self, widget, char):
             self.vk.release_keysym(char)
 
     def __init__(self):



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