diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-02-21 17:27:38 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:25 +0200 |
commit | b8b885daf7b6b368c8ad7a31dfc89b44f993d21b (patch) | |
tree | ab9be48ea0d94d3a4194e4f8aceaa5f75eae96a4 /nx-X11 | |
parent | 79a5330db17102dd62506b6d748244acb2074369 (diff) | |
download | nx-libs-b8b885daf7b6b368c8ad7a31dfc89b44f993d21b.tar.gz nx-libs-b8b885daf7b6b368c8ad7a31dfc89b44f993d21b.tar.bz2 nx-libs-b8b885daf7b6b368c8ad7a31dfc89b44f993d21b.zip |
Match braille patterns with compose tree
Braille patterns should also be usable in Compose. This combines the
implementation of braille chords and compose tree: only emit the braille
pattern if it can not be found in the compose tree, if any.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/lib/X11/imLcFlt.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/nx-X11/lib/X11/imLcFlt.c b/nx-X11/lib/X11/imLcFlt.c index e812fdd0d..e4ab3815c 100644 --- a/nx-X11/lib/X11/imLcFlt.c +++ b/nx-X11/lib/X11/imLcFlt.c @@ -45,6 +45,7 @@ _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) static char buf[256]; DefTree *b = ic->private.local.base.tree; DTIndex t; + Bool braille = False; if(ev->xkey.keycode == 0) return (False); @@ -58,6 +59,7 @@ _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) if(ev->type == KeyPress) { ic->private.local.brl_pressed |= 1<<(keysym-XK_braille_dot_1); + return(True); } else { if(!ic->private.local.brl_committing || ev->xkey.time - ic->private.local.brl_release_start > 300) { @@ -65,23 +67,20 @@ _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) ic->private.local.brl_release_start = ev->xkey.time; } ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1)); - if(!ic->private.local.brl_pressed) { - if(ic->private.local.brl_committing) { - ic->private.local.brl_committed = - ic->private.local.brl_committing; - ic->private.local.composed = 0; - ev->type = KeyPress; - ev->xkey.keycode = 0; - _XPutBackEvent(d, ev); - } + if(!ic->private.local.brl_pressed && ic->private.local.brl_committing) { + /* Commited a braille pattern, let it go through compose tree */ + keysym = XK_braille_blank | ic->private.local.brl_committing; + ev->type = KeyPress; + braille = True; + } else { + return(True); } } - return(True); } if( (ev->type != KeyPress) || (((Xim)ic->core.im)->private.local.top == 0 ) ) - return(False); + goto emit_braille; for(t = ic->private.local.context; t; t = b[t].next) { if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) && @@ -105,11 +104,22 @@ _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) } } else { /* Unmatched */ if(ic->private.local.context == ((Xim)ic->core.im)->private.local.top) { - return(False); + goto emit_braille; } /* Error (Sequence Unmatch occured) */ /* initialize internal state for next key sequence */ ic->private.local.context = ((Xim)ic->core.im)->private.local.top; return(True); } + +emit_braille: + if(braille) { + /* Braille pattern is not in compose tree, emit alone */ + ic->private.local.brl_committed = ic->private.local.brl_committing; + ic->private.local.composed = 0; + ev->xkey.keycode = 0; + _XPutBackEvent(d, ev); + return(True); + } + return(False); } |