summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-09-06 22:39:28 (GMT)
committerhobbs <hobbs>2006-09-06 22:39:28 (GMT)
commit76db84f0e28288ac0e6da5dc33d1a97626efcf54 (patch)
tree2ba9cc0bf93a726ed5be5bd91f8d50a43b16fb71 /generic/tkText.c
parent94edca83e594d771323cb9f0b5a4e1e0d03d8dc5 (diff)
downloadtk-76db84f0e28288ac0e6da5dc33d1a97626efcf54.zip
tk-76db84f0e28288ac0e6da5dc33d1a97626efcf54.tar.gz
tk-76db84f0e28288ac0e6da5dc33d1a97626efcf54.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/tkWindow.c: controlled by ::tk::AlwaysShowSelection * library/tk.tcl: (boolean, private). [Bug 1553691] * macosx/tkMacOSXDefault.h: * unix/tkUnixDefault.h: * unix/tkUnixPort.h: * win/tkWinDefault.h:
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index aeb40bb..56e016f 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,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.68 2006/04/05 17:16:29 vincentdarley Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.69 2006/09/06 22:39:28 hobbs Exp $
*/
#include "default.h"
@@ -160,11 +160,7 @@ static Tk_OptionSpec optionSpecs[] = {
Tk_Offset(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY},
{TK_OPTION_BORDER, "-inactiveselectbackground", "inactiveSelectBackground",
"Foreground",
-#ifdef ALWAYS_SHOW_SELECTION
- DEF_TEXT_SELECT_COLOR,
-#else
- NULL,
-#endif
+ DEF_TEXT_INACTIVE_SELECT_COLOR,
-1, Tk_Offset(TkText, inactiveSelBorder),
TK_OPTION_NULL_OK, (ClientData) DEF_TEXT_SELECT_MONO, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
@@ -3316,25 +3312,28 @@ TkTextLostSelection(clientData)
ClientData clientData; /* Information about text widget. */
{
register TkText *textPtr = (TkText *) clientData;
-#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->sharedTextPtr->tree, textPtr, 0, 0, &start);
- TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
- TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr), 0, &end);
- TkTextRedrawTag(NULL, 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->sharedTextPtr->tree, textPtr,
+ 0, 0, &start);
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr),
+ 0, &end);
+ TkTextRedrawTag(NULL, textPtr, &start, &end, textPtr->selTagPtr, 1);
+ TkBTreeTag(&start, &end, textPtr->selTagPtr, 0);
+ }
/*
* Send an event that the selection changed. This is equivalent to: