summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2006-04-06 09:28:59 (GMT)
committerdas <das>2006-04-06 09:28:59 (GMT)
commit94ec6d314586f3e5a501ef37de0039905b32bfe8 (patch)
tree561ae0afa388c45bf802efba1c5bb7400f5a61a9 /macosx
parentbe3f3efb44b4479135755373aeb4634d73814811 (diff)
downloadtk-94ec6d314586f3e5a501ef37de0039905b32bfe8.zip
tk-94ec6d314586f3e5a501ef37de0039905b32bfe8.tar.gz
tk-94ec6d314586f3e5a501ef37de0039905b32bfe8.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.13
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWm.c104
1 files changed, 69 insertions, 35 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index d716f92..b4e1c3f 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.7.2.18 2006/03/28 02:44:14 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.19 2006/04/06 09:29:00 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -832,10 +832,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,
@@ -852,14 +850,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,
@@ -1575,8 +1591,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?");
@@ -1590,28 +1609,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) {
@@ -3997,7 +4031,7 @@ TkWmRestackToplevel(
if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
TkWmMapWindow(otherPtr);
}
- otherMacWindow =GetWindowFromPort(TkMacOSXGetDrawablePort(otherPtr->window));
+ otherMacWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(otherPtr->window));
} else {
otherMacWindow = NULL;
}