compute keycode and insert keycode only once. Fixes #5636

This commit is contained in:
Yann Leboulanger 2010-03-12 20:57:35 +01:00
parent 4351ed9248
commit 86acbd398c
1 changed files with 5 additions and 4 deletions

View File

@ -94,6 +94,9 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
A base class containing a banner, ConversationTextview, MessageTextView
"""
keymap = gtk.gdk.keymap_get_default()
keycode_c = keymap.get_entries_for_keyval(gtk.keysyms.c)[0][0]
keycode_ins = keymap.get_entries_for_keyval(gtk.keysyms.Insert)[0][0]
def make_href(self, match):
url_color = gajim.config.get('urlmsgcolor')
url = match.group()
@ -557,10 +560,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
# translate any layout to latin_layout
keymap = gtk.gdk.keymap_get_default()
keycode = keymap.get_entries_for_keyval(event.keyval)[0][0]
keycode_c = keymap.get_entries_for_keyval(gtk.keysyms.c)[0][0]
keycode_ins = keymap.get_entries_for_keyval(gtk.keysyms.Insert)[0][0]
if (event.state & gtk.gdk.CONTROL_MASK and keycode in (keycode_c,
keycode_ins)) or (event.state & gtk.gdk.SHIFT_MASK and \
if (event.state & gtk.gdk.CONTROL_MASK and keycode in (self.keycode_c,
self.keycode_ins)) or (event.state & gtk.gdk.SHIFT_MASK and \
event.keyval in (gtk.keysyms.Page_Down, gtk.keysyms.Page_Up)):
return False
self.parent_win.notebook.emit('key_press_event', event)