summaryrefslogtreecommitdiffstats
path: root/macosx
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
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')
-rw-r--r--macosx/Makefile9
-rw-r--r--macosx/tkMacOSXColor.c61
-rw-r--r--macosx/tkMacOSXDefault.h12
-rw-r--r--macosx/tkMacOSXEntry.c4
-rw-r--r--macosx/tkMacOSXMenu.c3
-rw-r--r--macosx/tkMacOSXMouseEvent.c11
-rw-r--r--macosx/tkMacOSXPort.h4
-rw-r--r--macosx/tkMacOSXWindowEvent.c7
-rw-r--r--macosx/tkMacOSXXStubs.c31
9 files changed, 119 insertions, 23 deletions
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