summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2006-04-06 09:28:32 (GMT)
committerdas <das>2006-04-06 09:28:32 (GMT)
commitbee4ca6134bc242e333361c2b536f72345f82820 (patch)
tree344540b6567d7f6d98acd2e3a6a3092ec49ae153 /macosx
parent69cd5be142227fefcd4cbc58fec846a2849ff1d1 (diff)
downloadtk-bee4ca6134bc242e333361c2b536f72345f82820.zip
tk-bee4ca6134bc242e333361c2b536f72345f82820.tar.gz
tk-bee4ca6134bc242e333361c2b536f72345f82820.tar.bz2
* macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): fix errors
in setting/removing window proxy icons via [wm attributes -titlepath] and [wm iconbitmap], use HIWindow API on Tiger or later. [Bug 1455241] * unix/tcl.m4: remove TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING define on Darwin. [Tcl Bug 1457515] * unix/configure: autoconf-2.59 * unix/tkConfig.h.in: autoheader-2.59
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWm.c110
1 files changed, 75 insertions, 35 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index d2b0066..af42cca 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.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: tkMacOSXWm.c,v 1.24 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.25 2006/04/06 09:28:32 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -801,6 +801,12 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
return TCL_ERROR;
}
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ }
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ }
macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));
if (objc == 3) {
@@ -847,10 +853,8 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
}
for (i = 3; i < objc; i += 2) {
int boolean;
+ const char *path;
OSErr err;
- FSRef ref;
- AliasHandle alias;
- Boolean isDirectory;
double dval;
if (Tcl_GetIndexFromObj(interp, objv[i], optionTable, "option", 0,
@@ -867,14 +871,32 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
SetWindowModified(macWindow, boolean);
break;
case WmAttrTitlePathIdx:
- err = FSPathMakeRef(
- (unsigned char*) Tcl_GetStringFromObj(objv[i+1], NULL),
- &ref, &isDirectory);
- if (err == noErr) {
- err = FSNewAlias(NULL, &ref, &alias);
- }
- if (err == noErr) {
- err = SetWindowProxyAlias(macWindow, alias);
+ path = Tcl_FSGetNativePath(objv[i+1]);
+ if (path && *path) {
+ FSRef ref;
+ Boolean d;
+ err = FSPathMakeRef((unsigned char*) path, &ref, &d);
+ if (err == noErr) {
+#if defined(MAC_OS_X_VERSION_10_4) && \
+ (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+ err = HIWindowSetProxyFSRef(macWindow, &ref);
+#else
+ AliasHandle alias;
+ err = FSNewAlias(NULL, &ref, &alias);
+ if (err == noErr) {
+ err = SetWindowProxyAlias(macWindow, alias);
+ DisposeHandle(alias);
+ }
+#endif
+ }
+ } else {
+ int len;
+ Tcl_GetStringFromObj(objv[i+1], &len);
+ if (len == 0) {
+ err = RemoveWindowProxy(macWindow);
+ } else {
+ err = fnfErr;
+ }
}
if (err != noErr) {
Tcl_SetObjResult(interp,
@@ -1659,8 +1681,11 @@ int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
Pixmap pixmap;
+ const char *path;
+ int len = -1;
+ OSErr err = fnfErr;
+ FSRef ref;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -1674,28 +1699,43 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
}
return TCL_OK;
}
- argv3 = Tcl_GetString(objv[3]);
- if (*argv3 == '\0') {
- if (wmPtr->hints.icon_pixmap != None) {
- Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
- wmPtr->hints.icon_pixmap = None;
- }
- wmPtr->hints.flags &= ~IconPixmapHint;
+ path = Tcl_FSGetNativePath(objv[3]);
+ if (path && *path) {
+ Boolean d;
+ err = FSPathMakeRef((unsigned char*) path, &ref, &d);
+ } else {
+ Tcl_GetStringFromObj(objv[3], &len);
+ }
+ if (err == noErr || len == 0) {
+ WindowRef macWindow;
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ }
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ }
+ macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));
+ if (len) {
+#if defined(MAC_OS_X_VERSION_10_4) && \
+ (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
+ err = HIWindowSetProxyFSRef(macWindow, &ref);
+#else
+ AliasHandle alias;
+ err = FSNewAlias(NULL, &ref, &alias);
+ if (err == noErr) {
+ err = SetWindowProxyAlias(macWindow, alias);
+ DisposeHandle(alias);
+ }
+#endif
+ } else {
+ err = RemoveWindowProxy(macWindow);
+ if (wmPtr->hints.icon_pixmap != None) {
+ Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
+ wmPtr->hints.icon_pixmap = None;
+ }
+ wmPtr->hints.flags &= ~IconPixmapHint;
+ }
} else {
- OSErr err;
- AliasHandle alias;
- FSRef ref;
- Boolean isDirectory;
- err = FSPathMakeRef((unsigned char*) Tcl_GetStringFromObj(objv[3], NULL), &ref, &isDirectory);
- if (err == noErr) {
- err = FSNewAlias(NULL, &ref, &alias);
- if (err == noErr) {
- WindowRef macWin
- = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));
- SetWindowProxyAlias(macWin, alias);
- return TCL_OK;
- }
- }
pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr,
Tk_GetUid(Tcl_GetStringFromObj(objv[3], NULL)));
if (pixmap == None) {
@@ -4092,7 +4132,7 @@ TkWmRestackToplevel(
if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(otherPtr);
}
- otherMacWindow =GetWindowFromPort(TkMacOSXGetDrawablePort(otherPtr->window));
+ otherMacWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(otherPtr->window));
} else {
otherMacWindow = NULL;
}