summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXColor.c
diff options
context:
space:
mode:
authordas <das>2006-09-10 17:07:35 (GMT)
committerdas <das>2006-09-10 17:07:35 (GMT)
commitee1108db075d48eb9926012a05e0d9ee7e905497 (patch)
tree0ebf513edd6850ddaf086cc1404d6768e491fe45 /macosx/tkMacOSXColor.c
parent310e8028ec1d91d84536a77021f4a3f8e48a51f5 (diff)
downloadtk-ee1108db075d48eb9926012a05e0d9ee7e905497.zip
tk-ee1108db075d48eb9926012a05e0d9ee7e905497.tar.gz
tk-ee1108db075d48eb9926012a05e0d9ee7e905497.tar.bz2
* 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.
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r--macosx/tkMacOSXColor.c61
1 files changed, 55 insertions, 6 deletions
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;