From ee1108db075d48eb9926012a05e0d9ee7e905497 Mon Sep 17 00:00:00 2001 From: das Date: Sun, 10 Sep 2006 17:07:35 +0000 Subject: * macosx/tkMacOSXColor.c (TkSetMacColor, TkpGetColor): use AppearanceMgr * macosx/tkMacOSXDefault.h: to retrieve platform std colors for text * macosx/tkMacOSXPort.h: selections, add "systemHighlightSecondary" color name for standard color of inactive selections. * library/text.tcl (aqua): change focus bindings to implement platform standard look for inactive text selections using this new color. * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show text * generic/tkTextDisp.c (GetStyle): selection when text widget * generic/tkText.c (TextEventProc): is in disabled state. * generic/tkEntry.c (DisplayEntry): change default TkAqua selection * macosx/tkMacOSXDefault.h: relief to "flat" (platform std). * generic/tkText.c (Tk_TextCmd): fix bug leading to default text selection relief string DEF_TEXT_SELECT_RELIEF being ignored. * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): allow mouse event delivery to background windows with kWindowNoActivatesAttribute (e.g. overrideredirect windows), as these never come to the foreground they would not receive any mouse events otherwise. [Bug 1472624] * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): do not send focus events to any windows with kWindowNoActivatesAttribute. * macosx/tkMacOSXXStubs.c (XQueryColor, XQueryColors): implement basic XColor computation from pixel values, enough to make tkImg's window.c happy, fixes img::window failures reported on tcl-mac. * macosx/tkMacOSXMenu.c (DrawMenuEntryLabel): fix leak. [Bug 1554672] * macosx/Makefile: workaround bug in 'cp -pRH' on Darwin 6 and earlier, fixes 'make embedded' failure reported on tcl-mac; fix error from 'make deploy' with same build tree as previous 'make embedded'. * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo. * unix/tcl.m4: sync with tcl/unix/tcl.m4. --- ChangeLog | 42 +++++ generic/tkEntry.c | 10 +- generic/tkText.c | 13 +- generic/tkTextBTree.c | 10 +- generic/tkTextDisp.c | 10 +- library/text.tcl | 7 +- macosx/Makefile | 9 +- macosx/tkMacOSXColor.c | 61 +++++++- macosx/tkMacOSXDefault.h | 12 +- macosx/tkMacOSXEntry.c | 4 +- macosx/tkMacOSXMenu.c | 3 +- macosx/tkMacOSXMouseEvent.c | 11 +- macosx/tkMacOSXPort.h | 4 +- macosx/tkMacOSXWindowEvent.c | 7 +- macosx/tkMacOSXXStubs.c | 31 +++- unix/tcl.m4 | 364 +++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 561 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fff972..7d78f6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2006-09-10 Daniel Steffen + + * macosx/tkMacOSXColor.c (TkSetMacColor, TkpGetColor): use AppearanceMgr + * macosx/tkMacOSXDefault.h: to retrieve platform std colors for text + * macosx/tkMacOSXPort.h: selections, add "systemHighlightSecondary" + color name for standard color of inactive selections. + + * library/text.tcl (aqua): change focus bindings to implement platform + standard look for inactive text selections using this new color. + + * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show text + * generic/tkTextDisp.c (GetStyle): selection when text widget + * generic/tkText.c (TextEventProc): is in disabled state. + + * generic/tkEntry.c (DisplayEntry): change default TkAqua selection + * macosx/tkMacOSXDefault.h: relief to "flat" (platform std). + + * generic/tkText.c (Tk_TextCmd): fix bug leading to default text + selection relief string DEF_TEXT_SELECT_RELIEF being ignored. + + * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): allow mouse + event delivery to background windows with kWindowNoActivatesAttribute + (e.g. overrideredirect windows), as these never come to the foreground + they would not receive any mouse events otherwise. [Bug 1472624] + + * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): do not + send focus events to any windows with kWindowNoActivatesAttribute. + + * macosx/tkMacOSXXStubs.c (XQueryColor, XQueryColors): implement basic + XColor computation from pixel values, enough to make tkImg's window.c + happy, fixes img::window failures reported on tcl-mac. + + * macosx/tkMacOSXMenu.c (DrawMenuEntryLabel): fix leak. [Bug 1554672] + + * macosx/Makefile: workaround bug in 'cp -pRH' on Darwin 6 and earlier, + fixes 'make embedded' failure reported on tcl-mac; fix error from 'make + deploy' with same build tree as previous 'make embedded'. + + * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo. + + * unix/tcl.m4: sync with tcl/unix/tcl.m4. + 2006-09-07 Daniel Steffen * generic/tkWindow.c: add #include "tclInt.h" now required due to use diff --git a/generic/tkEntry.c b/generic/tkEntry.c index f98f446..60cbdcf 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.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: tkEntry.c,v 1.35.2.2 2006/09/06 22:01:25 hobbs Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.35.2.3 2006/09/10 17:07:35 das Exp $ */ #include "tkInt.h" @@ -1700,7 +1700,13 @@ DisplayEntry(clientData) baseY - fm.ascent - entryPtr->selBorderWidth, (selEndX - selStartX) + 2*entryPtr->selBorderWidth, (fm.ascent + fm.descent) + 2*entryPtr->selBorderWidth, - entryPtr->selBorderWidth, TK_RELIEF_RAISED); + entryPtr->selBorderWidth, +#ifndef MAC_OSX_TK + TK_RELIEF_RAISED +#else + MAC_OSX_ENTRY_SELECT_RELIEF +#endif + ); } } diff --git a/generic/tkText.c b/generic/tkText.c index 33edca7..750d0d8 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.3 2006/09/06 22:01:25 hobbs Exp $ + * RCS: @(#) $Id: tkText.c,v 1.33.2.4 2006/09/10 17:07:35 das Exp $ */ #include "default.h" @@ -426,7 +426,7 @@ Tk_TextCmd(clientData, interp, argc, argv) textPtr->selTagPtr->reliefString = (char *) ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF)); strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF); - textPtr->selTagPtr->relief = TK_RELIEF_RAISED; + Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &(textPtr->selTagPtr->relief)); textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &startIndex); textPtr->insertMarkPtr = TkTextSetMark(textPtr, "insert", &startIndex); @@ -1281,7 +1281,14 @@ TextEventProc(clientData, eventPtr) textPtr->flags &= ~(GOT_FOCUS | INSERT_ON); textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; } - if (!TkpAlwaysShowSelection(textPtr->tkwin)) { + if ( +#ifndef MAC_OSX_TK + !TkpAlwaysShowSelection(textPtr->tkwin) +#else + /* Don't show inactive selection in disabled widgets. */ + textPtr->state != TK_STATE_DISABLED +#endif + ) { TkTextRedrawTag(textPtr, NULL, NULL, textPtr->selTagPtr, 1); } TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 5c4069e..c2a5fbd 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextBTree.c,v 1.6.2.2 2006/09/06 22:01:25 hobbs Exp $ + * RCS: @(#) $Id: tkTextBTree.c,v 1.6.2.3 2006/09/10 17:07:35 das Exp $ */ #include "tkInt.h" @@ -2551,7 +2551,13 @@ TkTextIsElided(textPtr, indexPtr) for (i = numTags-1; i >=0; i--) { if (tagCnts[i] & 1) { /* who would make the selection elided? */ - if (!TkpAlwaysShowSelection(textPtr->tkwin) + if ( +#ifndef MAC_OSX_TK + !TkpAlwaysShowSelection(textPtr->tkwin) +#else + /* Don't show inactive selection in disabled widgets. */ + textPtr->state == TK_STATE_DISABLED +#endif && (tagPtr == textPtr->selTagPtr) && !(textPtr->flags & GOT_FOCUS)) { continue; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index e13766e..ab0a8cf 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.3 2006/09/06 22:01:26 hobbs Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.4 2006/09/10 17:07:35 das Exp $ */ #include "tkPort.h" @@ -550,7 +550,13 @@ GetStyle(textPtr, indexPtr) * unless we always want to show the selection. */ - if (!TkpAlwaysShowSelection(textPtr->tkwin) + if ( +#ifndef MAC_OSX_TK + !TkpAlwaysShowSelection(textPtr->tkwin) +#else + /* Don't show inactive selection in disabled widgets. */ + textPtr->state == TK_STATE_DISABLED +#endif && (tagPtr == textPtr->selTagPtr) && !(textPtr->flags & GOT_FOCUS)) { continue; diff --git a/library/text.tcl b/library/text.tcl index 6d94ff6..6b045a5 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: text.tcl,v 1.24.2.8 2006/01/25 18:21:41 dgp Exp $ +# RCS: @(#) $Id: text.tcl,v 1.24.2.9 2006/09/10 17:07:36 das Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -393,15 +393,12 @@ bind Text { # Macintosh only bindings: -# if text black & highlight black -> text white, other text the same if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} { bind Text { - %W tag configure sel -borderwidth 0 %W configure -selectbackground systemHighlight -selectforeground systemHighlightText } bind Text { - %W tag configure sel -borderwidth 1 - %W configure -selectbackground white -selectforeground black + %W configure -selectbackground systemHighlightSecondary -selectforeground systemHighlightText } bind Text { tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord] diff --git a/macosx/Makefile b/macosx/Makefile index 0f52d38..5393a04 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -4,7 +4,7 @@ # uses the standard unix build system in tk/unix (which can be used directly instead of this # if you are not using the tk/macosx projects). # -# RCS: @(#) $Id: Makefile,v 1.7.2.14 2006/04/12 00:58:44 das Exp $ +# RCS: @(#) $Id: Makefile,v 1.7.2.15 2006/09/10 17:07:36 das Exp $ # ######################################################################################################## @@ -203,6 +203,11 @@ ifeq (${EMBEDDED_BUILD},1) @rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tk.framework" endif ${DO_MAKE} +ifeq (${EMBEDDED_BUILD}_${TK_X11},1_) +# workaround bug with 'cp -pRH' on Darwin 6 and earlier + @if [ "`uname -r | awk -F. '{print $$1}'`" -lt 7 ]; then \ + mkdir -p ${TOP_DIR}/{"${TCL_FMWK_DIR}","${TK_FMWK_DIR}"}/PrivateHeaders; fi +endif ifeq (${INSTALL_BUILD},1) ifeq (${EMBEDDED_BUILD},1) # if we are embedding frameworks, don't install wish @@ -237,7 +242,7 @@ endif ifeq (${TK_X11},) ifeq (${EMBEDDED_BUILD},) # install Wish.app link in APPLICATION_INSTALL_PATH and setup 'Wish Shell' compatibility links - @cd ${TOP_DIR} && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && \ + @cd ${TOP_DIR} && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && rm -rf "./${APP_DIR}/Wish.app" && \ ln -fsh "./$$(echo ${APP_DIR} | sed -e 's#/[^/][^/]*#/..#g')/${FMWK_DIR}/${PRODUCT_NAME}.framework/Resources/Wish.app" "./${APP_DIR}" && \ ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app"; fi && \ ln -fsh Wish.app "./${TK_FMWK_DIR}/Resources/Wish Shell.app" && \ diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 9207b03..2e059c2 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.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: tkMacOSXColor.c,v 1.2.2.2 2006/03/28 02:44:13 das Exp $ + * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.3 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" @@ -58,12 +58,36 @@ TkSetMacColor( unsigned long pixel, /* Pixel value to convert. */ RGBColor *macColor) /* Mac color struct to modify. */ { + OSStatus err; + switch (pixel >> 24) { case HIGHLIGHT_PIXEL: - LMGetHiliteRGB(macColor); + err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, + 32, true, macColor); + if (err != noErr) { + LMGetHiliteRGB(macColor); + } + return true; + case HIGHLIGHT_SECONDARY_PIXEL: + err = GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, + 32, true, macColor); + if (err != noErr) { + LMGetHiliteRGB(macColor); + } + return true; + case HIGHLIGHT_ALTERNATE_PIXEL: + err = GetThemeBrushAsColor(kThemeBrushAlternatePrimaryHighlightColor, + 32, true, macColor); + if (err != noErr) { + LMGetHiliteRGB(macColor); + } return true; case HIGHLIGHT_TEXT_PIXEL: - LMGetHiliteRGB(macColor); + err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, + 32, true, macColor); + if (err != noErr) { + LMGetHiliteRGB(macColor); + } if ((macColor->red == 0) && (macColor->green == 0) && (macColor->blue == 0)) { macColor->red = macColor->green = macColor->blue = 0xFFFF; @@ -199,16 +223,41 @@ TkpGetColor( * will do all the work. */ if (strncasecmp(name, "system", 6) == 0) { - int foundSystemColor = false; + OSStatus err; + int foundSystemColor = false; RGBColor rgbValue; char pixelCode = 0; if (!strcasecmp(name+6, "Highlight")) { - LMGetHiliteRGB(&rgbValue); + err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, + 32, true, &rgbValue); + if (err != noErr) { + LMGetHiliteRGB(&rgbValue); + } pixelCode = HIGHLIGHT_PIXEL; foundSystemColor = true; + } else if (!strcasecmp(name+6, "HighlightSecondary")) { + err = GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, + 32, true, &rgbValue); + if (err != noErr) { + LMGetHiliteRGB(&rgbValue); + } + pixelCode = HIGHLIGHT_SECONDARY_PIXEL; + foundSystemColor = true; + } else if (!strcasecmp(name+6, "HighlightAlternate")) { + err = GetThemeBrushAsColor(kThemeBrushAlternatePrimaryHighlightColor, + 32, true, &rgbValue); + if (err != noErr) { + LMGetHiliteRGB(&rgbValue); + } + pixelCode = HIGHLIGHT_ALTERNATE_PIXEL; + foundSystemColor = true; } else if (!strcasecmp(name+6, "HighlightText")) { - LMGetHiliteRGB(&rgbValue); + err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, + 32, true, &rgbValue); + if (err != noErr) { + LMGetHiliteRGB(&rgbValue); + } if ((rgbValue.red == 0) && (rgbValue.green == 0) && (rgbValue.blue == 0)) { rgbValue.red = rgbValue.green = rgbValue.blue = 0xFFFF; diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index a04442f..a2fc1a6 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.2.2.3 2005/06/23 20:15:22 das Exp $ + * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.2.2.4 2006/09/10 17:07:36 das Exp $ */ #ifndef _TKMACDEFAULT @@ -35,6 +35,7 @@ #define ACTIVE_BG "#ececec" #define SELECT_BG "systemHighlight" #define SELECT_FG "systemHighlightText" +#define INACTIVE_SELECT_BG "systemHighlightSecondary" #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" #define DISABLED "#a3a3a3" @@ -145,9 +146,10 @@ * won't get the native widget by default. */ -#define MAC_OSX_FOCUS_WIDTH 3 -#define MAC_OSX_ENTRY_BORDER 2 -#define MAC_OSX_ENTRY_RELEIF TK_RELIEF_SUNKEN +#define MAC_OSX_FOCUS_WIDTH 3 +#define MAC_OSX_ENTRY_BORDER 2 +#define MAC_OSX_ENTRY_RELIEF TK_RELIEF_SUNKEN +#define MAC_OSX_ENTRY_SELECT_RELIEF TK_RELIEF_FLAT #define DEF_ENTRY_BG_COLOR NORMAL_BG #define DEF_ENTRY_BG_MONO WHITE @@ -513,7 +515,7 @@ #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_FG_MONO WHITE -#define DEF_TEXT_SELECT_RELIEF "solid" +#define DEF_TEXT_SELECT_RELIEF "flat" #define DEF_TEXT_SET_GRID "0" #define DEF_TEXT_SPACING1 "0" #define DEF_TEXT_SPACING2 "0" diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index 4da889f..f231937 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -50,7 +50,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.2.2.6 2006/03/28 02:44:13 das Exp $ + * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.2.2.7 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" @@ -161,7 +161,7 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox) if (entryPtr->borderWidth != MAC_OSX_ENTRY_BORDER || entryPtr->highlightWidth != MAC_OSX_FOCUS_WIDTH - ||entryPtr->relief != MAC_OSX_ENTRY_RELEIF) { + || entryPtr->relief != MAC_OSX_ENTRY_RELIEF) { return 0; } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index e194ddb..a27b376 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.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: tkMacOSXMenu.c,v 1.6.2.21 2006/08/18 07:47:25 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.22 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" @@ -3561,6 +3561,7 @@ DrawMenuEntryLabel( Tcl_DStringLength(&itemTextDString), leftEdge, baseline); */ + Tcl_DStringFree(&convertedTextDString); Tcl_DStringFree(&itemTextDString); } } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 3e274ed..2f0a7df 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -54,10 +54,11 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.16 2006/08/18 07:47:25 das Exp $ + * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.6.2.17 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" +#include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" @@ -315,7 +316,13 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) */ if ((result = HandleWindowTitlebarMouseDown(medPtr, tkwin)) != -1) { return result; - } else { + } else + /* + * Only windows with the kWindowNoActivatesAttribute can + * receive mouse events in the background. + */ + if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes & + kWindowNoActivatesAttribute)) { /* * Allow background window dragging & growing with Command down */ diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 61e2795..e922acd 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXPort.h,v 1.3.2.5 2006/03/13 18:19:00 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXPort.h,v 1.3.2.6 2006/09/10 17:07:36 das Exp $ */ #ifndef _TKMACPORT @@ -189,7 +189,9 @@ extern int strncasecmp _ANSI_ARGS_((CONST char *s1, */ #define HIGHLIGHT_PIXEL 31 +#define HIGHLIGHT_SECONDARY_PIXEL 32 #define HIGHLIGHT_TEXT_PIXEL 33 +#define HIGHLIGHT_ALTERNATE_PIXEL 34 #define CONTROL_TEXT_PIXEL 35 #define CONTROL_BODY_PIXEL 37 #define CONTROL_FRAME_PIXEL 39 diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 2db4bd1..7212ab4 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.14 2006/07/24 04:45:26 das Exp $ + * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.15 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" @@ -467,10 +467,11 @@ TkMacOSXGenerateFocusEvent( /* * Don't send focus events to windows of class help or to - * overrideredirect windows. + * windows with the kWindowNoActivatesAttribute. */ if (((TkWindow *)tkwin)->wmInfoPtr->macClass == kHelpWindowClass || - Tk_Attributes(tkwin)->override_redirect) { + ((TkWindow *)tkwin)->wmInfoPtr->attributes & + kWindowNoActivatesAttribute) { return false; } diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 31d969e..2ebf2b1 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.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: tkMacOSXXStubs.c,v 1.2.2.12 2006/03/28 02:44:14 das Exp $ + * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.13 2006/09/10 17:07:36 das Exp $ */ #include "tkMacOSXInt.h" @@ -654,6 +654,19 @@ XQueryColor( Colormap colormap, XColor* def_in_out) { + unsigned long p; + unsigned char r, g, b; + XColor *d = def_in_out; + + p = d->pixel; + r = (p & 0x00FF0000) >> 16; + g = (p & 0x0000FF00) >> 8; + b = (p & 0x000000FF); + d->red = (r << 8) | r; + d->green = (g << 8) | g; + d->blue = (b << 8) | b; + d->flags = DoRed|DoGreen|DoBlue; + d->pad = 0; } void @@ -663,6 +676,22 @@ XQueryColors( XColor* defs_in_out, int ncolors) { + int i; + unsigned long p; + unsigned char r, g, b; + XColor *d = defs_in_out; + + for (i = 0; i < ncolors; i++, d++) { + p = d->pixel; + r = (p & 0x00FF0000) >> 16; + g = (p & 0x0000FF00) >> 8; + b = (p & 0x000000FF); + d->red = (r << 8) | r; + d->green = (g << 8) | g; + d->blue = (b << 8) | b; + d->flags = DoRed|DoGreen|DoBlue; + d->pad = 0; + } } int diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 0dccb7c..8c122b3 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2797,3 +2797,367 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ fi fi ]) + +#-------------------------------------------------------------------- +# SC_TCL_GETHOSTBYADDR_R +# +# Check if we have MT-safe variant of gethostbyaddr(). +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETHOSTBYADDR_R +# HAVE_GETHOSTBYADDR_R_7 +# HAVE_GETHOSTBYADDR_R_8 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [ + AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [ + AC_TRY_COMPILE([ + #include + ], [ + char *addr; + int length; + int type; + struct hostent *result; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &h_errnop); + ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)]) + tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) + else + AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [ + AC_TRY_COMPILE([ + #include + ], [ + char *addr; + int length; + int type; + struct hostent *result, *resultp; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &resultp, &h_errnop); + ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)]) + tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R) + fi +])]) + +#-------------------------------------------------------------------- +# SC_TCL_GETHOSTBYNAME_R +# +# Check to see what variant of gethostbyname_r() we have. +# Based on David Arnold's example from the comp.programming.threads +# FAQ Q213 +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETHOSTBYADDR_R +# HAVE_GETHOSTBYADDR_R_3 +# HAVE_GETHOSTBYADDR_R_5 +# HAVE_GETHOSTBYADDR_R_6 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [ + AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [ + AC_TRY_COMPILE([ + #include + ], [ + char *name; + struct hostent *he, *res; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); + ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)]) + tcl_ok=$tcl_cv_api_gethostbyname_r_6 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) + else + AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [ + AC_TRY_COMPILE([ + #include + ], [ + char *name; + struct hostent *he; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); + ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)]) + tcl_ok=$tcl_cv_api_gethostbyname_r_5 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) + else + AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [ + AC_TRY_COMPILE([ + #include + ], [ + char *name; + struct hostent *he; + struct hostent_data data; + + (void) gethostbyname_r(name, he, &data); + ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)]) + tcl_ok=$tcl_cv_api_gethostbyname_r_3 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) + fi + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R) + fi +])]) + +#-------------------------------------------------------------------- +# SC_TCL_GETPWUID_R +# +# Check if we have MT-safe variant of getpwuid() and if yes, +# which one exactly. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETPWUID_R +# HAVE_GETPWUID_R_4 +# HAVE_GETPWUID_R_5 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [ + AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + uid_t uid; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; + + (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); + ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)]) + tcl_ok=$tcl_cv_api_getpwuid_r_5 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWUID_R_5) + else + AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + uid_t uid; + struct passwd pw; + char buf[512]; + int buflen = 512; + + (void)getpwnam_r(uid, &pw, buf, buflen); + ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)]) + tcl_ok=$tcl_cv_api_getpwuid_r_4 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWUID_R_4) + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWUID_R) + fi +])]) + +#-------------------------------------------------------------------- +# SC_TCL_GETPWNAM_R +# +# Check if we have MT-safe variant of getpwnam() and if yes, +# which one exactly. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETPWNAM_R +# HAVE_GETPWNAM_R_4 +# HAVE_GETPWNAM_R_5 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [ + AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + char *name; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; + + (void) getpwnam_r(name, &pw, buf, buflen, &pwp); + ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)]) + tcl_ok=$tcl_cv_api_getpwnam_r_5 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWNAM_R_5) + else + AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + char *name; + struct passwd pw; + char buf[512]; + int buflen = 512; + + (void)getpwnam_r(name, &pw, buf, buflen); + ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)]) + tcl_ok=$tcl_cv_api_getpwnam_r_4 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWNAM_R_4) + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETPWNAM_R) + fi +])]) + +#-------------------------------------------------------------------- +# SC_TCL_GETGRGID_R +# +# Check if we have MT-safe variant of getgrgid() and if yes, +# which one exactly. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETGRGID_R +# HAVE_GETGRGID_R_4 +# HAVE_GETGRGID_R_5 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [ + AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + gid_t gid; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrgid_r(gid, &gr, buf, buflen, &grp); + ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)]) + tcl_ok=$tcl_cv_api_getgrgid_r_5 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRGID_R_5) + else + AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + gid_t gid; + struct group gr; + char buf[512]; + int buflen = 512; + + (void)getgrgid_r(gid, &gr, buf, buflen); + ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)]) + tcl_ok=$tcl_cv_api_getgrgid_r_4 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRGID_R_4) + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRGID_R) + fi +])]) + +#-------------------------------------------------------------------- +# SC_TCL_GETGRNAM_R +# +# Check if we have MT-safe variant of getgrnam() and if yes, +# which one exactly. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# HAVE_GETGRNAM_R +# HAVE_GETGRNAM_R_4 +# HAVE_GETGRNAM_R_5 +# +#-------------------------------------------------------------------- + +AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [ + AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + char *name; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrnam_r(name, &gr, buf, buflen, &grp); + ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)]) + tcl_ok=$tcl_cv_api_getgrnam_r_5 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRNAM_R_5) + else + AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [ + AC_TRY_COMPILE([ + #include + #include + ], [ + char *name; + struct group gr; + char buf[512]; + int buflen = 512; + + (void)getgrnam_r(name, &gr, buf, buflen); + ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)]) + tcl_ok=$tcl_cv_api_getgrnam_r_4 + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRNAM_R_4) + fi + fi + if test "$tcl_ok" = yes; then + AC_DEFINE(HAVE_GETGRNAM_R) + fi +])]) -- cgit v0.12