Commit 0a9f0ed9 authored by Philipp Hörist's avatar Philipp Hörist

ChatBaseControl: Fix regression with non-english keyboard layouts

parent 98f07508
Pipeline #6520 passed with stages
in 4 minutes and 42 seconds
......@@ -79,6 +79,12 @@
if app.is_installed('GSPELL'):
from gi.repository import Gspell # pylint: disable=ungrouped-imports
# This is needed so copying text from the conversation textview
# works with different language layouts. Pressing the key c on a russian
# layout yields another keyval than with the english layout.
# So we match hardware keycodes instead of keyvals.
# Multiple hardware keycodes can trigger a keyval like Gdk.KEY_c.
KEYCODES_KEY_C = get_hardware_key_codes(Gdk.KEY_c)
if sys.platform == 'darwin':
COPY_MODIFIER = Gdk.ModifierType.META_MASK
......@@ -94,12 +100,6 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
A base class containing a banner, ConversationTextview, MessageInputTextView
"""
# This is needed so copying text from the conversation textview
# works with different language layouts. Pressing the key c on a russian
# layout yields another keyval than with the english layout.
# So we match hardware keycodes instead of keyvals.
# Multiple hardware keycodes can trigger a keyval like Gdk.KEY_c.
keycodes_c = get_hardware_key_codes(Gdk.KEY_c)
_type = None # type: ControlType
def __init__(self, parent_win, widget_name, contact, acct,
......@@ -272,7 +272,7 @@ def _on_conv_textview_key_press_event(self, textview, event):
if event.get_state() & COPY_MODIFIER:
# Don’t reroute the event if it is META + c and the
# textview has a selection
if event.keyval == Gdk.KEY_c:
if event.hardware_keycode in KEYCODES_KEY_C:
if textview.get_buffer().props.has_selection:
return Gdk.EVENT_PROPAGATE
......
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