From 015422fe75a200568a2fefeedb202c6d9dba23a8 Mon Sep 17 00:00:00 2001 From: Geobert Quach Date: Mon, 22 Jul 2024 20:53:52 +0100 Subject: [PATCH] fix: angle mod failure (#174) * fix: angle mod failure * chore: remove debug print leftover --- kalamine/generators/klc.py | 7 +++++-- kalamine/layout.py | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kalamine/generators/klc.py b/kalamine/generators/klc.py index bbc9375..60ff718 100644 --- a/kalamine/generators/klc.py +++ b/kalamine/generators/klc.py @@ -47,7 +47,10 @@ def _get_langid(locale: str) -> str: def klc_virtual_key(layout: "KeyboardLayout", symbols: list, scan_code: str) -> str: - if scan_code == "56": + oem_102_scan_code = "56" + if layout.angle_mod: + oem_102_scan_code = "30" + if scan_code == oem_102_scan_code: # manage the ISO key (between shift and Z on ISO keyboards). # We're assuming that its scancode is always 56 # https://www.win.tue.nl/~aeb/linux/kbd/scancodes.html @@ -79,7 +82,7 @@ def klc_virtual_key(layout: "KeyboardLayout", symbols: list, scan_code: str) -> elif base == " ": return "SPACE" else: - MAX_OEM = 8 + MAX_OEM = 9 # We affect abitrary OEM VK and it will not match the one # in distributed layout. It can cause issue if a application # is awaiting a particular OEM_ for a hotkey diff --git a/kalamine/layout.py b/kalamine/layout.py index bae0295..c7cfc11 100644 --- a/kalamine/layout.py +++ b/kalamine/layout.py @@ -146,6 +146,7 @@ def __init__( self.has_altgr = False self.has_1dk = False self.qwerty_shortcuts = qwerty_shortcuts + self.angle_mod = angle_mod # metadata: self.meta for k in layout_data: @@ -174,6 +175,7 @@ def __init__( click.echo( "Warning: geometry does not support angle-mod; ignoring the --angle-mod argument" ) + self.angle_mod = False if "full" in layout_data: full = text_to_lines(layout_data["full"])