summaryrefslogtreecommitdiffstats
path: root/generic/tkEvent.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2002-04-05 08:41:06 (GMT)
committerhobbs <hobbs@noemail.net>2002-04-05 08:41:06 (GMT)
commit061d8a64384d402d4213d4a8e2e75b5a298ab5f1 (patch)
tree406c959ae617e1855a29d8b178868bad86dcf996 /generic/tkEvent.c
parent8f18d0da415b96bd8b526d948c8e89504163f4c1 (diff)
downloadtk-061d8a64384d402d4213d4a8e2e75b5a298ab5f1.zip
tk-061d8a64384d402d4213d4a8e2e75b5a298ab5f1.tar.gz
tk-061d8a64384d402d4213d4a8e2e75b5a298ab5f1.tar.bz2
* generic/tkInt.h: added TK_XIM_SPOT #define (default 1).
Added XFontSet attribute to TkDisplay when TK_XIM_SPOT is true. * generic/tkEvent.c (Tk_HandleEvent): made sure inputContexts are not getting created on DestroyNotify events (for dead windows). Added over-the-spot support if TK_XIM_SPOT is defined (default). The is the nicer XIM behavior, but uses a bit more memory. FossilOrigin-Name: e1e658edf77580ce80312031ae8791cbebea5140
Diffstat (limited to 'generic/tkEvent.c')
-rw-r--r--generic/tkEvent.c55
1 files changed, 44 insertions, 11 deletions
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 366ba86..9ad96d1 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.8 2000/06/03 08:58:16 hobbs Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.9 2002/04/05 08:41:07 hobbs Exp $
*/
#include "tkPort.h"
@@ -749,18 +749,51 @@ Tk_HandleEvent(eventPtr)
* Pass the event to the input method(s), if there are any, and
* discard the event if the input method(s) insist. Create the
* input context for the window if it hasn't already been done
- * (XFilterEvent needs this context).
+ * (XFilterEvent needs this context). XIM is only ever enabled on
+ * Unix, but this hasn't been factored out of the generic code yet.
*/
- if (winPtr->dispPtr->useInputMethods) {
- if (!(winPtr->flags & TK_CHECKED_IC)) {
- if (winPtr->dispPtr->inputMethod != NULL) {
- winPtr->inputContext = XCreateIC(
- winPtr->dispPtr->inputMethod, XNInputStyle,
- XIMPreeditNothing|XIMStatusNothing,
- XNClientWindow, winPtr->window,
- XNFocusWindow, winPtr->window, NULL);
- }
+ dispPtr = winPtr->dispPtr;
+ if ((dispPtr->useInputMethods)) {
+ if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
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);
+ }
+ }
+
+ 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);
+#endif
+ }
}
if (XFilterEvent(eventPtr, None)) {
goto done;