summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-09-06 22:01:24 (GMT)
committerhobbs <hobbs>2006-09-06 22:01:24 (GMT)
commitc1e05e3afb76356ef8e2d5af2a2ce3660c6bee48 (patch)
tree983074bdc91b005de21970a3ec98bae0c6d5af63 /generic/tkText.c
parent87caa3a60c4200a5a79707791643a555407a1271 (diff)
downloadtk-c1e05e3afb76356ef8e2d5af2a2ce3660c6bee48.zip
tk-c1e05e3afb76356ef8e2d5af2a2ce3660c6bee48.tar.gz
tk-c1e05e3afb76356ef8e2d5af2a2ce3660c6bee48.tar.bz2
* generic/tkEntry.c: move hard-coded ALWAYS_SHOW_SELECTION
* generic/tkInt.h: control of entry/text selection display * generic/tkText.c: based on focus to the Tcl level, * generic/tkTextBTree.c: controlled by ::tk::AlwaysShowSelection * generic/tkTextDisp.c: (boolean, private). [Bug 1553691] * generic/tkWindow.c: * library/tk.tcl * unix/tkUnixPort.h:
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index a06b90f..33edca7 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.33.2.2 2006/09/06 19:53:22 hobbs Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.33.2.3 2006/09/06 22:01:25 hobbs Exp $
*/
#include "default.h"
@@ -1281,9 +1281,9 @@ TextEventProc(clientData, eventPtr)
textPtr->flags &= ~(GOT_FOCUS | INSERT_ON);
textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
}
-#ifndef ALWAYS_SHOW_SELECTION
- TkTextRedrawTag(textPtr, NULL, NULL, textPtr->selTagPtr, 1);
-#endif
+ if (!TkpAlwaysShowSelection(textPtr->tkwin)) {
+ TkTextRedrawTag(textPtr, NULL, NULL, textPtr->selTagPtr, 1);
+ }
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
TkTextIndexForwChars(&index, 1, &index2);
TkTextChanged(textPtr, &index, &index2);
@@ -1896,24 +1896,25 @@ TkTextLostSelection(clientData)
{
register TkText *textPtr = (TkText *) clientData;
XEvent event;
-#ifdef ALWAYS_SHOW_SELECTION
- TkTextIndex start, end;
- if (!textPtr->exportSelection) {
- return;
- }
+ if (TkpAlwaysShowSelection(textPtr->tkwin)) {
+ TkTextIndex start, end;
- /*
- * On Windows and Mac systems, we want to remember the selection
- * for the next time the focus enters the window. On Unix,
- * just remove the "sel" tag from everything in the widget.
- */
+ if (!textPtr->exportSelection) {
+ return;
+ }
- TkTextMakeByteIndex(textPtr->tree, 0, 0, &start);
- TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree), 0, &end);
- TkTextRedrawTag(textPtr, &start, &end, textPtr->selTagPtr, 1);
- TkBTreeTag(&start, &end, textPtr->selTagPtr, 0);
-#endif
+ /*
+ * On Windows and Mac systems, we want to remember the selection
+ * for the next time the focus enters the window. On Unix,
+ * just remove the "sel" tag from everything in the widget.
+ */
+
+ TkTextMakeByteIndex(textPtr->tree, 0, 0, &start);
+ TkTextMakeByteIndex(textPtr->tree, TkBTreeNumLines(textPtr->tree), 0, &end);
+ TkTextRedrawTag(textPtr, &start, &end, textPtr->selTagPtr, 1);
+ TkBTreeTag(&start, &end, textPtr->selTagPtr, 0);
+ }
/*
* Send an event that the selection changed. This is equivalent to