#1062 closed enhancement (fixed)
better keyboard layout detection on win32
Reported by: | Antoine Martin | Owned by: | Antoine Martin |
---|---|---|---|
Priority: | critical | Milestone: | 2.0 |
Component: | platforms | Version: | trunk |
Keywords: | win32 | Cc: |
Description
Sounds like we need GetKeyboardLayoutList and GetLocaleInfo, like Get short windows language name or C++/Win32 Finding all keyboard input languages?.
Found some example code in python kiwi:
import ctypes def GetLocaleInfo(value): s = ctypes.create_string_buffer("\000" * 255) ctypes.windll.kernel32.GetLocaleInfoA(0, value, s, 255) return str(s.value)
But that doesn't return a value for the layout list items...
It is all a bit confusing: why are the HKL and KLID of the keyboard different?
Here's another method which could be useful for locales:
def get_locale_language(): #apparently this can be different from the system locale try: langid = windll.kernel32.GetUserDefaultUILanguage() #@UndefinedVariable import locale lang = locale.windows_locale[langid] log("default ui language=%s", lang) return lang except Exception as e: log("failed to query current language: %s", e) return None
Change History (7)
comment:1 Changed 5 years ago by
Status: | new → assigned |
---|
comment:5 Changed 4 years ago by
Priority: | major → critical |
---|
Seems to be a problem with the 64-bit builds (#1413)
comment:6 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 Changed 6 weeks ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1062
Note: See
TracTickets for help on using
tickets.
Found this useful example: NVDA's languageHandler.py.
And eventually figured out that this gives me what I want:
(bar any issues with HKL / KLID... as per above)
Which gave me on my test system: