summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixKey.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index ac18f9c..6be5584 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.9 2002/06/15 02:08:12 hobbs Exp $
+ * RCS: @(#) $Id: tkUnixKey.c,v 1.10 2002/06/17 20:09:01 hobbs Exp $
*/
#include "tkInt.h"
@@ -18,10 +18,6 @@
* Prototypes for local procedures defined in this file:
*/
-#ifdef TK_USE_INPUT_METHODS
-static int caretX = 0, caretY = 0;
-#endif
-
/*
*----------------------------------------------------------------------
@@ -31,6 +27,7 @@ static int caretX = 0, caretY = 0;
* This enables correct placement of the XIM caret. This is called
* by widgets to indicate their cursor placement, and the caret
* location is used by TkpGetString to place the XIM caret.
+ * This is currently only used for over-the-spot XIM.
*
* Results:
* None
@@ -48,13 +45,16 @@ Tk_SetCaretPos(tkwin, x, y, height)
int y;
int height;
{
-#ifdef TK_USE_INPUT_METHODS
+ TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret);
+
/*
* Use height for best placement of the XIM over-the-spot box.
*/
- caretX = x;
- caretY = y + height;
-#endif
+
+ caretPtr->winPtr = ((TkWindow *) tkwin);
+ caretPtr->x = x;
+ caretPtr->y = y;
+ caretPtr->height = height;
}
/*
@@ -86,6 +86,9 @@ TkpGetString(winPtr, eventPtr, dsPtr)
int len;
Tcl_DString buf;
Status status;
+#ifdef TK_USE_INPUT_METHODS
+ TkDisplay *dispPtr = winPtr->dispPtr;
+#endif
/*
* Overallocate the dstring to the maximum stack amount.
@@ -95,7 +98,7 @@ TkpGetString(winPtr, eventPtr, dsPtr)
Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
#ifdef TK_USE_INPUT_METHODS
- if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)
+ if ((dispPtr->flags & TK_DISPLAY_USE_IM)
&& (winPtr->inputContext != NULL)
&& (eventPtr->type == KeyPress)) {
#if TK_XIM_SPOT
@@ -121,10 +124,12 @@ TkpGetString(winPtr, eventPtr, dsPtr)
#if TK_XIM_SPOT
/*
- * Adjust the XIM caret position.
+ * Adjust the XIM caret position. We might want to check that
+ * this is the right caret.winPtr as well.
*/
- if (winPtr->dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
- spot.x = caretX; spot.y = caretY;
+ if (dispPtr->flags & TK_DISPLAY_XIM_SPOT) {
+ spot.x = dispPtr->caret.x;
+ spot.y = dispPtr->caret.y + dispPtr->caret.height;
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
XSetICValues(winPtr->inputContext,
XNPreeditAttributes, preedit_attr, NULL);
@@ -183,7 +188,7 @@ TkpSetKeycodeAndState(tkwin, keySym, eventPtr)
if (state & 2) {
TkDisplay *dispPtr;
- dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ dispPtr = ((TkWindow *) tkwin)->dispPtr;
eventPtr->xkey.state |= dispPtr->modeModMask;
}
break;