diff options
author | hobbs <hobbs> | 2002-06-15 01:09:36 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-06-15 01:09:36 (GMT) |
commit | 9fd0bc2cfca5bb16562660ec0cb6ff22a6b30b95 (patch) | |
tree | 6ef8952ae7ba141ba39a22f140f638515ab7bdcc | |
parent | ac9f08b14460f4602b522996fafea36a36bb64f9 (diff) | |
download | tk-9fd0bc2cfca5bb16562660ec0cb6ff22a6b30b95.zip tk-9fd0bc2cfca5bb16562660ec0cb6ff22a6b30b95.tar.gz tk-9fd0bc2cfca5bb16562660ec0cb6ff22a6b30b95.tar.bz2 |
* generic/tkEvent.c (Tk_HandleEvent):
* unix/tkUnixEvent.c (OpenIM):
* unix/tkUnixKey.c (TkpGetString):
* generic/tkInt.h: added TK_USE_XIM_SPOT flag bit for TkDisplay
and used this to allow a runtime check to see if over-the-spot XIM
is possible. If not it will try and fallback to the old-style
input context, which handles things like dead keys input.
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | generic/tkEvent.c | 67 | ||||
-rw-r--r-- | generic/tkInt.h | 7 | ||||
-rw-r--r-- | unix/tkUnixEvent.c | 21 | ||||
-rw-r--r-- | unix/tkUnixKey.c | 14 |
5 files changed, 85 insertions, 51 deletions
@@ -1,10 +1,27 @@ +2002-06-14 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tkEvent.c (Tk_HandleEvent): + * unix/tkUnixEvent.c (OpenIM): + * unix/tkUnixKey.c (TkpGetString): + * generic/tkInt.h: added TK_USE_XIM_SPOT flag bit for TkDisplay + and used this to allow a runtime check to see if over-the-spot XIM + is possible. If not it will try and fallback to the old-style + input context, which handles things like dead keys input. + + * generic/tk.decls: added TIP #84 implementation that adds a + * generic/tkDecls.h: Tk_CollapseMotionEvents API which controls + * generic/tkEvent.c: Tk's collapsing of incoming motion events + * generic/tkInt.h: on its windows. The default remains to do + * generic/tkStubInit.c: collapsing. Added a flags parameter to the + * generic/tkWindow.c: internal display structure to support this + * doc/QWinEvent.3: and be used in the future for other bits. + + * unix/mkLinks: updated from current docs + 2002-06-14 Mo DeJong <mdejong@users.sourceforge.net> * generic/tkBind.c (TkXErrorHandler): Declare static function to avoid compiler error with VC++. - -2002-06-14 Mo DeJong <mdejong@users.sourceforge.net> - * generic/tkBind.c (ExpandPercents): Cast argument to Tk_GetAtomName in order to avoid compiler warning. @@ -33,8 +50,8 @@ * unix/tkUnixWm.c: * win/tkWinScrlbr.c: * win/tkWinWindow.c: - * win/tkWinWm.c: Implementation of TIP #47 - "Modifying Tk to Allow Writing X Window managers" (patch from Neil McKay). + * win/tkWinWm.c: Implementation of TIP #47 by Neil McKay + "Modifying Tk to Allow Writing X Window managers". Add CirculateRequest, Create, MapRequest, ResizeRequest, and ConfigureRequest event types; Split TK_TOPLEVEL flag into TK_TOPLEVEL, TK_HAS_WRAPPER, diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 8ceb358..16d2215 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.12 2002/06/15 00:21:42 hobbs Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.13 2002/06/15 01:09:36 hobbs Exp $ */ #include "tkPort.h" @@ -866,41 +866,42 @@ Tk_HandleEvent(eventPtr) winPtr->flags |= TK_CHECKED_IC; if (dispPtr->inputMethod != NULL) { #if TK_XIM_SPOT - XVaNestedList preedit_attr; - XPoint spot = {0, 0}; - - if (dispPtr->inputXfs == NULL) { - /* - * We only need to create one XFontSet - */ - char **missing_list; - int missing_count; - char *def_string; - - dispPtr->inputXfs = XCreateFontSet(dispPtr->display, - "-*-*-*-R-Normal--14-130-75-75-*-*", - &missing_list, &missing_count, &def_string); - if (missing_count > 0) { - XFreeStringList(missing_list); + if (dispPtr->flags & TK_USE_XIM_SPOT) { + XVaNestedList preedit_attr; + XPoint spot = {0, 0}; + + if (dispPtr->inputXfs == NULL) { + /* + * We only need to create one XFontSet + */ + char **missing_list; + int missing_count; + char *def_string; + + dispPtr->inputXfs = XCreateFontSet(dispPtr->display, + "-*-*-*-R-Normal--14-130-75-75-*-*", + &missing_list, &missing_count, &def_string); + if (missing_count > 0) { + XFreeStringList(missing_list); + } } - } - preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, - XNFontSet, dispPtr->inputXfs, NULL); - winPtr->inputContext = XCreateIC(dispPtr->inputMethod, - XNInputStyle, XIMPreeditPosition | XIMStatusNothing, - XNClientWindow, winPtr->window, - XNFocusWindow, winPtr->window, - XNPreeditAttributes, preedit_attr, - NULL); - XFree(preedit_attr); -#else - winPtr->inputContext = XCreateIC(dispPtr->inputMethod, - XNInputStyle, XIMPreeditNothing | XIMStatusNothing, - XNClientWindow, winPtr->window, - XNFocusWindow, winPtr->window, - NULL); + preedit_attr = XVaCreateNestedList(0, XNSpotLocation, + &spot, XNFontSet, dispPtr->inputXfs, NULL); + winPtr->inputContext = XCreateIC(dispPtr->inputMethod, + XNInputStyle, XIMPreeditPosition|XIMStatusNothing, + XNClientWindow, winPtr->window, + XNFocusWindow, winPtr->window, + XNPreeditAttributes, preedit_attr, + NULL); + XFree(preedit_attr); + } else #endif + winPtr->inputContext = XCreateIC(dispPtr->inputMethod, + XNInputStyle, XIMPreeditNothing|XIMStatusNothing, + XNClientWindow, winPtr->window, + XNFocusWindow, winPtr->window, + NULL); } } if (XFilterEvent(eventPtr, None)) { diff --git a/generic/tkInt.h b/generic/tkInt.h index 0849d7e..f0c80a3 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: $Id: tkInt.h,v 1.45 2002/06/15 00:21:42 hobbs Exp $ + * RCS: $Id: tkInt.h,v 1.46 2002/06/15 01:09:36 hobbs Exp $ */ #ifndef _TKINT @@ -499,9 +499,14 @@ typedef struct TkDisplay { /* * Flag values for TkDisplay flags. + * TK_DISPLAY_COLLAPSE_MOTION_EVENTS: (default on) + * Indicates that we should collapse motion events on this display + * TK_USE_INPUT_METHODS: (default off) + * Indicates that we should use over-the-spot XIM on this display */ #define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0) +#define TK_USE_XIM_SPOT (1 << 1) /* * One of the following structures exists for each error handler diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 097a0f1..bbf3455 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixEvent.c,v 1.6 2002/04/12 10:20:05 hobbs Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.7 2002/06/15 01:09:36 hobbs Exp $ */ #include "tkInt.h" @@ -583,14 +583,23 @@ OpenIM(dispPtr) NULL) != NULL) || (stylePtr == NULL)) { goto error; } +#if TK_XIM_SPOT + /* + * If we want to do over-the-spot XIM, we have to check that this + * mode is supported. If not we will fall-through to the check below. + */ for (i = 0; i < stylePtr->count_styles; i++) { if (stylePtr->supported_styles[i] -#if TK_XIM_SPOT - == (XIMPreeditPosition | XIMStatusNothing) -#else - == (XIMPreeditNothing | XIMStatusNothing) + == (XIMPreeditPosition | XIMStatusNothing)) { + dispPtr->flags |= TK_USE_XIM_SPOT; + XFree(stylePtr); + return; + } + } #endif - ) { + for (i = 0; i < stylePtr->count_styles; i++) { + if (stylePtr->supported_styles[i] + == (XIMPreeditNothing | XIMStatusNothing)) { XFree(stylePtr); return; } diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index 3f74a8d..5c01d46 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixKey.c,v 1.6 2002/04/05 08:38:41 hobbs Exp $ + * RCS: @(#) $Id: tkUnixKey.c,v 1.7 2002/06/15 01:09:36 hobbs Exp $ */ #include "tkInt.h" @@ -123,11 +123,13 @@ TkpGetString(winPtr, eventPtr, dsPtr) /* * Adjust the XIM caret position. */ - spot.x = caretX; spot.y = caretY; - preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); - XSetICValues(winPtr->inputContext, - XNPreeditAttributes, preedit_attr, NULL); - XFree(preedit_attr); + if (winPtr->dispPtr->flags & TK_USE_XIM_SPOT) { + spot.x = caretX; spot.y = caretY; + preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); + XSetICValues(winPtr->inputContext, + XNPreeditAttributes, preedit_attr, NULL); + XFree(preedit_attr); + } #endif } else { len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf), |