diff options
author | hobbs <hobbs> | 2002-06-17 20:09:01 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-06-17 20:09:01 (GMT) |
commit | 25f604e4d2e56721809b177202db73a38df2491e (patch) | |
tree | 2526b5918abac20b6e67ff9f285600bd7cf3d3f4 /win/tkWinX.c | |
parent | a984d974f6b3123815d8116428afe8e51e025f31 (diff) | |
download | tk-25f604e4d2e56721809b177202db73a38df2491e.zip tk-25f604e4d2e56721809b177202db73a38df2491e.tar.gz tk-25f604e4d2e56721809b177202db73a38df2491e.tar.bz2 |
* generic/tkCmds.c (Tk_TkObjCmd):
* generic/tkInt.h (struct TkCaret):
* mac/tkMacXStubs.c (Tk_SetCaretPos):
* unix/tkUnixKey.c (TkpGetString, Tk_SetCaretPos):
* win/tkWinX.c (Tk_SetCaretPos):
* tests/tk.test: Added 'tk caret' implementation of TIP#96
* doc/SetCaret.3 (new): which adds a TkCaret structure element to
* doc/tk.n: TkDisplay for maintaining state.
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r-- | win/tkWinX.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c index 99b5783..85e9464 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.21 2002/04/12 07:19:13 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.22 2002/06/17 20:09:01 hobbs Exp $ */ #include "tkWinInt.h" @@ -1582,10 +1582,24 @@ void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) { static HWND caretHWND = NULL; - static int lastX = -1, lastY = -1; + TkCaret *caretPtr = &(((TkWindow *) tkwin)->dispPtr->caret); Window win; /* + * Prevent processing anything if the values haven't changed. + * Windows only has one display, so we can do this with statics. + */ + if ((caretPtr->winPtr == ((TkWindow *) tkwin)) + && (caretPtr->x == x) && (caretPtr->y == y)) { + return; + } + + caretPtr->winPtr = ((TkWindow *) tkwin); + caretPtr->x = x; + caretPtr->y = y; + caretPtr->height = height; + + /* * We adjust to the toplevel to get the coords right, as setting * the IME composition window is based on the toplevel hwnd, so * ignore height. @@ -1605,16 +1619,6 @@ Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) HIMC hIMC; HWND hwnd = Tk_GetHWND(win); - if ((hwnd == caretHWND) && (lastX == x) && (lastY == y)) { - /* - * Prevent processing anything if the values haven't changed. - */ - return; - } - - lastX = x; - lastY = y; - if (hwnd != caretHWND) { DestroyCaret(); if (CreateCaret(hwnd, NULL, 0, 0)) { @@ -1642,6 +1646,5 @@ Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) ImmSetCompositionWindow(hIMC, &cform); ImmReleaseContext(hwnd, hIMC); } - } } |