• LRN's avatar
    W32: Prefer the deadkey combinations that the OS uses · 5e6c1928
    LRN authored
    Pick the W32 API for possible deadkey+<something> combinations
    and prefer these to other sources of deadkey combos.
    Specifically, if W32 API supports at least one combo for a particular
    deadkey, only use that data and do not attempt to do other, unsupported
    combinations, even if they make sense otherwise.
    This is needed to, for example, correctly support US-International
    keyboard layout, which produces a combined character for <' + a>
    combo, but not for <' + s>, for example.
    This is achieved by stashing all the deadkeys that we find in
    an array, then doing extra loop through all virtual key codes and
    trying to combine them with each of these deadkeys. Any combinations
    that produce a single character are cached for later use.
    In GTK Simple IM context, call a new GDK W32 function to do a lookup
    on that cached combination table early on, among the "special cases"
    (which are now partially obsolete).
    A limitation of this code is that combinations with more than
    one deadkey are not supported, except for combinations that consist
    entirely of 2 known deadkeys. The upshot is that lookups should
    be relatively fast, as deadkey array stays small and the combination
    tree stays shallow.
    Note that the use of ToUnicodeEx() seems suboptimal, as it should
    be possible to just load a keyboard library (KBD*.DLL) manually
    and obtain and use its key table directly. However, that is much more
    complicated and would result in a significant rewrite of gdkkeys-win32.
    The code from this commit, though hacky, is a direct addition to
    existing code and should cover vast majority of the use-cases.
gtkimcontextsimple.c 40.6 KB