diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-10-25 20:42:56 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-10-25 20:42:56 (GMT) |
commit | 500e20b19e28944fc01d53eaf0d4de2120b63e5c (patch) | |
tree | fa23d08cc47013050a0d390a8cdc76a79a081be3 /unix/tkUnixKey.c | |
parent | 11fa39bc28e728fe9bfbf4a0ef4b24025c323c4d (diff) | |
parent | 92fd6c36bca199a694c294f966fb4a3d02728e90 (diff) | |
download | tk-500e20b19e28944fc01d53eaf0d4de2120b63e5c.zip tk-500e20b19e28944fc01d53eaf0d4de2120b63e5c.tar.gz tk-500e20b19e28944fc01d53eaf0d4de2120b63e5c.tar.bz2 |
Fix for bug 3410609; confirmed to work on UK keyboard.
Diffstat (limited to 'unix/tkUnixKey.c')
-rw-r--r-- | unix/tkUnixKey.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index 9c38891..030e472 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -123,13 +123,13 @@ TkpGetString( Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1); len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), - NULL, &status); + &kePtr->keysym, &status); if (status == XBufferOverflow) { /* Expand buffer and try again */ Tcl_DStringSetLength(dsPtr, len); len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey, Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr), - NULL, &status); + &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; @@ -144,8 +144,8 @@ TkpGetString( Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey, - Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), NULL, - &status); + Tcl_DStringValue(&buf), Tcl_DStringLength(&buf), + &kePtr->keysym, &status); /* * If the buffer wasn't big enough, grow the buffer and try again. @@ -154,7 +154,7 @@ TkpGetString( if (status == XBufferOverflow) { Tcl_DStringSetLength(&buf, len); len = XmbLookupString(winPtr->inputContext, &eventPtr->xkey, - Tcl_DStringValue(&buf), len, NULL, &status); + Tcl_DStringValue(&buf), len, &kePtr->keysym, &status); } if ((status != XLookupChars) && (status != XLookupBoth)) { len = 0; @@ -179,7 +179,7 @@ TkpGetString( Tcl_DStringInit(&buf); Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1); len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf), - TCL_DSTRING_STATIC_SIZE, 0, 0); + TCL_DSTRING_STATIC_SIZE, &kePtr->keysym, 0); Tcl_DStringValue(&buf)[len] = '\0'; if (len == 1) { @@ -277,6 +277,29 @@ TkpGetKeySym( { KeySym sym; int index; + TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr; + +#ifdef TK_USE_INPUT_METHODS + /* + * If input methods are active, we may already have determined a keysym. + * Return it. + */ + + if (eventPtr->type == KeyPress && dispPtr + && (dispPtr->flags & TK_DISPLAY_USE_IM)) { + if (kePtr->charValuePtr == NULL) { + Tcl_DString ds; + TkWindow *winPtr = (TkWindow *) + Tk_IdToWindow(eventPtr->xany.display, eventPtr->xany.window); + Tcl_DStringInit(&ds); + (void) TkpGetString(winPtr, eventPtr, &ds); + Tcl_DStringFree(&ds); + } + if (kePtr->charValuePtr != NULL) { + return kePtr->keysym; + } + } +#endif /* * Refresh the mapping information if it's stale |