summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2006-09-10 17:06:31 (GMT)
committerdas <das>2006-09-10 17:06:31 (GMT)
commit41dfe0d4791ea37a1f6a7c3b069b3f41c79466b0 (patch)
tree13ad5944ad3d007fdcb67d4af43aa55cb42e1470 /macosx
parentb0768715132b6b828aa0ec352e5c4669097307f9 (diff)
downloadtk-41dfe0d4791ea37a1f6a7c3b069b3f41c79466b0.zip
tk-41dfe0d4791ea37a1f6a7c3b069b3f41c79466b0.tar.gz
tk-41dfe0d4791ea37a1f6a7c3b069b3f41c79466b0.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, use this color as default for text widget -inactiveselectbackground to implement platform standard look for inactive text selections. * library/text.tcl (aqua): remove focus bindings to set selection color. * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show inactive * generic/tkTextDisp.c (GetStyle): text selection when text widget is in disabled state. * generic/tkEntry.c (DisplayEntry): change default TkAqua selection * macosx/tkMacOSXDefault.h: relief to "flat" (platform std). * generic/tkText.c (CreateWidget): 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/GNUmakefile: 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/Wish.xcodeproj/project.pbxproj: add new tclUnixCompat.c file. * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo. * unix/tcl.m4: sync with tcl/unix/tcl.m4. * unix/configure: autoconf-2.59
Diffstat (limited to 'macosx')
-rw-r--r--macosx/GNUmakefile9
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj4
-rw-r--r--macosx/tkMacOSXColor.c61
-rw-r--r--macosx/tkMacOSXDefault.h14
-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
10 files changed, 124 insertions, 24 deletions
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile
index ce9d159..2f88506 100644
--- a/macosx/GNUmakefile
+++ b/macosx/GNUmakefile
@@ -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: GNUmakefile,v 1.5 2006/07/20 06:25:18 das Exp $
+# RCS: @(#) $Id: GNUmakefile,v 1.6 2006/09/10 17:06:32 das Exp $
#
########################################################################################################
@@ -204,6 +204,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
@@ -238,7 +243,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/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index 31ae02d..6ad7390 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -281,6 +281,7 @@
F9EA4AF208FA3BD800B1F5F0 /* tkMacOSXCursors.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBCC08F27A3B005CB29B /* tkMacOSXCursors.r */; };
F9EA4AF308FA3BDA00B1F5F0 /* tkMacOSXAETE.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC408F27A3B005CB29B /* tkMacOSXAETE.r */; };
F9EA4AF408FA3BDB00B1F5F0 /* tkAboutDlg.r in Rez */ = {isa = PBXBuildFile; fileRef = F966BBC108F27A3B005CB29B /* tkAboutDlg.r */; };
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */ = {isa = PBXBuildFile; fileRef = F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -1621,6 +1622,7 @@
F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tk.framework; path = ../Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = Wish.app; path = ../Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = ../Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixCompat.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -3165,6 +3167,7 @@
F96D445D08F272B9004A47F5 /* tclLoadOSF.c */,
F96D445E08F272B9004A47F5 /* tclLoadShl.c */,
F96D445F08F272B9004A47F5 /* tclUnixChan.c */,
+ F9FC77B70AB29E9100B7077D /* tclUnixCompat.c */,
F96D446008F272B9004A47F5 /* tclUnixEvent.c */,
F96D446108F272B9004A47F5 /* tclUnixFCmd.c */,
F96D446208F272B9004A47F5 /* tclUnixFile.c */,
@@ -3525,6 +3528,7 @@
F96D49AE08F272C4004A47F5 /* tclMacOSXNotify.c in Sources */,
F96D4AC608F272C9004A47F5 /* tclLoadDyld.c in Sources */,
F96D4ACA08F272C9004A47F5 /* tclUnixChan.c in Sources */,
+ F9FC77B80AB29E9100B7077D /* tclUnixCompat.c in Sources */,
F96D4ACB08F272C9004A47F5 /* tclUnixEvent.c in Sources */,
F96D4ACC08F272C9004A47F5 /* tclUnixFCmd.c in Sources */,
F96D4ACD08F272C9004A47F5 /* tclUnixFile.c in Sources */,
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 78d80e1..b69354a 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.4 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXColor.c,v 1.5 2006/09/10 17:06:32 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;
@@ -228,16 +252,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 dc8b07d..54f5f66 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.10 2006/09/06 22:39:28 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXDefault.h,v 1.11 2006/09/10 17:06:32 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"
@@ -146,9 +147,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
@@ -511,14 +513,14 @@
#define DEF_TEXT_PADX "1"
#define DEF_TEXT_PADY "1"
#define DEF_TEXT_RELIEF "flat"
-#define DEF_TEXT_INACTIVE_SELECT_COLOR NULL
+#define DEF_TEXT_INACTIVE_SELECT_COLOR INACTIVE_SELECT_BG
#define DEF_TEXT_SELECT_COLOR SELECT_BG
#define DEF_TEXT_SELECT_MONO BLACK
#define DEF_TEXT_SELECT_BD_COLOR "1"
#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 c8f047a..bc9a181 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.6 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.7 2006/09/10 17:06:32 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 8ac888d..d16d23c 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.31 2006/08/18 07:47:10 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.32 2006/09/10 17:06:32 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 2f9e4ba..0fc3473 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.24 2006/08/18 07:47:11 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.25 2006/09/10 17:06:32 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 cfabc15..ef276b6 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.8 2006/03/13 18:19:18 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXPort.h,v 1.9 2006/09/10 17:06:32 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 ee56ffc..6547f38 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.15 2006/07/24 04:45:23 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.16 2006/09/10 17:06:32 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 a556531..ab81fb3 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.15 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.16 2006/09/10 17:06:32 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -656,6 +656,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
@@ -665,6 +678,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