diff options
author | das <das> | 2006-04-06 09:28:32 (GMT) |
---|---|---|
committer | das <das> | 2006-04-06 09:28:32 (GMT) |
commit | 51e742898c9dbae025546b73a412d1f992329241 (patch) | |
tree | 344540b6567d7f6d98acd2e3a6a3092ec49ae153 | |
parent | dcd72fae9845151ba5a984535c43827513b52349 (diff) | |
download | tk-51e742898c9dbae025546b73a412d1f992329241.zip tk-51e742898c9dbae025546b73a412d1f992329241.tar.gz tk-51e742898c9dbae025546b73a412d1f992329241.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
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 110 | ||||
-rwxr-xr-x | unix/configure | 5 | ||||
-rw-r--r-- | unix/tcl.m4 | 2 | ||||
-rw-r--r-- | unix/tkConfig.h.in | 4 |
5 files changed, 86 insertions, 46 deletions
@@ -1,3 +1,14 @@ +2006-04-06 Daniel Steffen <das@users.sourceforge.net> + + * 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 + 2006-04-05 Jeff Hobbs <jeffh@ActiveState.com> * generic/tkWindow.c (Initialize): remove impotent use of 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; } diff --git a/unix/configure b/unix/configure index 9a3a53f..135efca 100755 --- a/unix/configure +++ b/unix/configure @@ -6226,11 +6226,6 @@ cat >>confdefs.h <<\_ACEOF #define TCL_LOAD_FROM_MEMORY 1 _ACEOF - -cat >>confdefs.h <<\_ACEOF -#define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING 1 -_ACEOF - # prior to Darwin 7, realpath is not threadsafe, so don't # use it when threads are enabled, c.f. bug # 711232: echo "$as_me:$LINENO: checking for realpath" >&5 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 884dc4e..f55be99 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1629,8 +1629,6 @@ dnl AC_CHECK_TOOL(AR, ar) [Are we to override what our default encoding is?]) AC_DEFINE(MODULE_SCOPE, __private_extern__, [Linker support for module scope symbols]) AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1, [Can this platform load code from memory?]) - AC_DEFINE(TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING, 1, - [Use better emulation of non-blocking channels for channels without BlockModeProc?]) # prior to Darwin 7, realpath is not threadsafe, so don't # use it when threads are enabled, c.f. bug # 711232: AC_CHECK_FUNC(realpath) diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index da96f16..678e010 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -154,10 +154,6 @@ /* Are we to override what our default encoding is? */ #undef TCL_DEFAULT_ENCODING -/* Use better emulation of non-blocking channels for channels without - BlockModeProc? */ -#undef TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING - /* Can this platform load code from memory? */ #undef TCL_LOAD_FROM_MEMORY |