From edf6ae717ffa12d49b2c5163c7d44c7fa3693020 Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 5 Apr 2002 08:43:22 +0000 Subject: * win/tkWinButton.c (TkpDisplayButton): * generic/tkTextMark.c (TkTextInsertDisplayProc): * generic/tkCanvText.c (DisplayCanvText): * generic/tkEntry.c (DisplayEntry): added Tk_SetCaretPos calls. --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ generic/tkCanvText.c | 4 +++- generic/tkEntry.c | 35 +++++++++++++++++++---------------- generic/tkTextMark.c | 16 ++++++++++------ win/tkWinButton.c | 6 +++++- 5 files changed, 76 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index a60db28..aabcc44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2002-04-05 Jeff Hobbs + + * mac/tkMacXStubs.c: added Tk_SetCaretPos stub (does nothing). + * win/tkWinX.c: added Tk_SetCaretPos code to position IME windows + correctly when WM_IME_STARTCOMPOSITION is received. + * unix/tkUnixKey.c: added Tk_SetCaretPos and code for setting + XIM caret in TkpGetString. + + * generic/tkStubInit.c: + * generic/tkDecls.h: + * generic/tk.decls: added Tk_SetCaretPos declaration. This command + allows users to indicate the cursor position and is used by XIM + (Unix) or IME (Windows) to place the caret box correctly. It is + also part of correct Accessibility style on Windows to make the + magnifier jump to the focus point. + + * win/tkWinButton.c (TkpDisplayButton): + * generic/tkTextMark.c (TkTextInsertDisplayProc): + * generic/tkCanvText.c (DisplayCanvText): + * generic/tkEntry.c (DisplayEntry): added Tk_SetCaretPos calls + + * 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. + + * unix/tkUnixEvent.c: + * generic/tkWindow.c: moved OpenIM over to tkUnixEvent.c. + Removed setting inputContext to null in Tk_MakeWindowExist as it + was redundant. + + * unix/tkUnixWm.c (CreateWrapper): Removed redundat setting of + inputContext to null. + + * win/Makefile.in: changed gdb and shell targets to properly build + all binaries before running (otherwise an error often occured). + 2002-03-28 David Gravereaux * win/.cvsignore (new): diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index f8d0d7b..63ed827 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.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: tkCanvText.c,v 1.11 2002/01/17 03:35:00 dgp Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.12 2002/04/05 08:43:22 hobbs Exp $ */ #include @@ -828,6 +828,8 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height) - (textInfoPtr->insertWidth / 2)), (double) (textPtr->header.y1 + y), &drawableX, &drawableY); + Tk_SetCaretPos(Tk_CanvasTkwin(canvas), drawableX, drawableY, + height); if (textInfoPtr->cursorOn) { Tk_Fill3DRectangle(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 673817b..87a726c 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.27 2002/03/20 22:55:16 dgp Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.28 2002/04/05 08:43:22 hobbs Exp $ */ #include "tkInt.h" @@ -1894,23 +1894,26 @@ DisplayEntry(clientData) * cursor isn't on. Otherwise the selection would hide the cursor. */ - if ((entryPtr->insertPos >= entryPtr->leftIndex) - && (entryPtr->state == STATE_NORMAL) - && (entryPtr->flags & GOT_FOCUS)) { + if ((entryPtr->state == STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) { Tk_CharBbox(entryPtr->textLayout, entryPtr->insertPos, &cursorX, NULL, NULL, NULL); - cursorX += entryPtr->layoutX; - cursorX -= (entryPtr->insertWidth)/2; - if (cursorX < xBound) { - if (entryPtr->flags & CURSOR_ON) { - Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder, - cursorX, baseY - fm.ascent, entryPtr->insertWidth, - fm.ascent + fm.descent, entryPtr->insertBorderWidth, - TK_RELIEF_RAISED); - } else if (entryPtr->insertBorder == entryPtr->selBorder) { - Tk_Fill3DRectangle(tkwin, pixmap, border, - cursorX, baseY - fm.ascent, entryPtr->insertWidth, - fm.ascent + fm.descent, 0, TK_RELIEF_FLAT); + Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent, + fm.ascent + fm.descent); + if (entryPtr->insertPos >= entryPtr->leftIndex) { + cursorX += entryPtr->layoutX; + cursorX -= (entryPtr->insertWidth)/2; + if (cursorX < xBound) { + if (entryPtr->flags & CURSOR_ON) { + Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder, + cursorX, baseY - fm.ascent, entryPtr->insertWidth, + fm.ascent + fm.descent, + entryPtr->insertBorderWidth, + TK_RELIEF_RAISED); + } else if (entryPtr->insertBorder == entryPtr->selBorder) { + Tk_Fill3DRectangle(tkwin, pixmap, border, + cursorX, baseY - fm.ascent, entryPtr->insertWidth, + fm.ascent + fm.descent, 0, TK_RELIEF_FLAT); + } } } } diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index ff3ef44..3e97d7f 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.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: tkTextMark.c,v 1.4 1999/12/14 06:52:33 hobbs Exp $ + * RCS: @(#) $Id: tkTextMark.c,v 1.5 2002/04/05 08:43:22 hobbs Exp $ */ #include "tkInt.h" @@ -526,12 +526,16 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY) if ((x + halfWidth) < 0) { /* - * The insertion cursor is off-screen. Just return. + * The insertion cursor is off-screen. + * Indicate caret at 0,0 and return. */ + Tk_SetCaretPos(textPtr->tkwin, 0, 0, height); return; } + Tk_SetCaretPos(textPtr->tkwin, x - halfWidth, screenY, height); + /* * As a special hack to keep the cursor visible on mono displays * (or anywhere else that the selection and insertion cursors @@ -542,12 +546,12 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY) if (textPtr->flags & INSERT_ON) { Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder, - x - textPtr->insertWidth/2, y, textPtr->insertWidth, - height, textPtr->insertBorderWidth, TK_RELIEF_RAISED); + x - halfWidth, y, textPtr->insertWidth, height, + textPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (textPtr->selBorder == textPtr->insertBorder) { Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border, - x - textPtr->insertWidth/2, y, textPtr->insertWidth, - height, 0, TK_RELIEF_FLAT); + x - halfWidth, y, textPtr->insertWidth, height, + 0, TK_RELIEF_FLAT); } } diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 42cdc3f..a9f19d5 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.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: tkWinButton.c,v 1.14 2001/12/29 00:30:30 hobbs Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.15 2002/04/05 08:43:22 hobbs Exp $ */ #define OEMRESOURCE @@ -706,6 +706,10 @@ TkpDisplayButton(clientData) TkWinReleaseDrawableDC(pixmap, dc, &state); } + if (butPtr->flags & GOT_FOCUS) { + Tk_SetCaretPos(tkwin, x, y, 0 /* not used */); + } + /* * Copy the information from the off-screen pixmap onto the screen, * then delete the pixmap. -- cgit v0.12