diff options
author | vincentdarley <vincentdarley> | 2002-07-21 11:11:54 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-07-21 11:11:54 (GMT) |
commit | 24e4fa2fefa2a93dd70076d6fd51c1fba9cef68c (patch) | |
tree | 010b0a74602566194b738c6dc721edfb58cd38df | |
parent | 46974475eb30385385ea9cb3e024bdbd231da195 (diff) | |
download | tk-24e4fa2fefa2a93dd70076d6fd51c1fba9cef68c.zip tk-24e4fa2fefa2a93dd70076d6fd51c1fba9cef68c.tar.gz tk-24e4fa2fefa2a93dd70076d6fd51c1fba9cef68c.tar.bz2 |
encodings, and wm updates
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | macosx/tkMacOSXClipboard.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 17 | ||||
-rw-r--r-- | macosx/tkMacOSXHLEvents.c | 42 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 57 |
5 files changed, 113 insertions, 20 deletions
@@ -1,3 +1,14 @@ +2002-07-21 Vince Darley <vincentdarley@users.sourceforge.net> + + * macosx/takMacOSXClipboard.c: + * macosx/takMacOSXDialog.c: + * macosx/takMacOSXHLEvents.c: + * macosx/tkMacOSXWm.c: more fixed for encodings, and addition + of support for 'wm attributes' and 'wm iconbitmap' to MacOS X. + The latter sets the proxy icon for a window, and the former + has one option at present: to set the 'modified' state of the + proxy icon. + 2002-07-17 Vince Darley <vincentdarley@users.sourceforge.net> * macosx/tkMacOSXMenu.c: @@ -8,7 +19,7 @@ * macosx/takMacOSXKeyboard.c: * macosx/tkMacOSXKeyEvent.c: fix for some more encoding issues, and Jim's proper fix for the key-event problems. - + 2002-07-16 Vince Darley <vincentdarley@users.sourceforge.net> * macosx/tkMacOSXMenu.c: diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index c817081..93579bb 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.1.2.4 2002/07/19 09:22:34 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.1.2.5 2002/07/21 11:11:54 vincentdarley Exp $ */ #include "tkInt.h" @@ -299,7 +299,7 @@ TkSuspendClipboard() ClearCurrentScrap(); GetCurrentScrap(&scrapRef); - Tcl_UtfToExternalDString(NULL, buffer, length, &encodedText); + Tcl_UtfToExternalDString(TkMacOSXCarbonEncoding, buffer, length, &encodedText); PutScrapFlavor(scrapRef, 'TEXT', 0, Tcl_DStringLength(&encodedText), Tcl_DStringValue(&encodedText) ); Tcl_DStringFree(&encodedText); ckfree(buffer); diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index fdc4eeb..53e8745 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.1.2.5 2002/07/19 09:22:34 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.1.2.6 2002/07/21 11:11:55 vincentdarley Exp $ */ #include <Carbon/Carbon.h> @@ -205,6 +205,7 @@ Tk_ChooseColorObjCmd( cpinfo.colorProc = NULL; cpinfo.colorProcData = NULL; + /* This doesn't seem to actually set the title! */ Tcl_UtfToExternal(NULL, NULL, title, -1, 0, NULL, StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL); StrLength(cpinfo.prompt) = (unsigned char) dstWrote; @@ -327,7 +328,7 @@ Tk_GetOpenFileObjCmd( break; case OPEN_MESSAGE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(message), 255, &srcRead, &dstWrote, NULL); message[0] = dstWrote; @@ -349,7 +350,7 @@ Tk_GetOpenFileObjCmd( break; case OPEN_TITLE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(title), 255, &srcRead, &dstWrote, NULL); title[0] = dstWrote; @@ -465,7 +466,7 @@ Tk_GetSaveFileObjCmd( result = TCL_ERROR; goto end; } - Tcl_UtfToExternal(NULL, NULL, Tcl_DStringValue(&ds), + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), 0, NULL, StrBody(initialFile), 255, &srcRead, &dstWrote, NULL); StrLength(initialFile) = (unsigned char) dstWrote; @@ -473,7 +474,7 @@ Tk_GetSaveFileObjCmd( break; case SAVE_MESSAGE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(message), 255, &srcRead, &dstWrote, NULL); StrLength(message) = (unsigned char) dstWrote; @@ -488,7 +489,7 @@ Tk_GetSaveFileObjCmd( break; case SAVE_TITLE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(title), 255, &srcRead, &dstWrote, NULL); StrLength(title) = (unsigned char) dstWrote; @@ -593,7 +594,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) break; case CHOOSE_MESSAGE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(message), 255, &srcRead, &dstWrote, NULL); StrLength(message) = (unsigned char) dstWrote; @@ -608,7 +609,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv) break; case CHOOSE_TITLE: choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen); - Tcl_UtfToExternal(NULL, NULL, choice, choiceLen, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, choice, choiceLen, 0, NULL, StrBody(title), 255, &srcRead, &dstWrote, NULL); StrLength(title) = (unsigned char) dstWrote; diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 7abb5d7..cfe64e5 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.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: tkMacOSXHLEvents.c,v 1.1.2.3 2002/07/18 23:45:18 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.1.2.4 2002/07/21 11:11:55 vincentdarley Exp $ */ #include "tkMacOSXUtil.h" @@ -39,6 +39,7 @@ static OSErr OappHandler (const AppleEvent * event, AppleEvent * reply, long han static OSErr OdocHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon); static OSErr PrintHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon); static OSErr ScriptHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon); +static OSErr PrefsHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon); static int MissedAnyParameters _ANSI_ARGS_((const AppleEvent *theEvent)); static int ReallyKillMe _ANSI_ARGS_((Tcl_Event *eventPtr, int flags)); @@ -66,7 +67,8 @@ TkMacOSXInitAppleEvents( { OSErr err; AEEventHandlerUPP OappHandlerUPP, OdocHandlerUPP, - PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP; + PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP, + PrefsHandlerUPP; /* * Install event handlers for the core apple events. @@ -87,6 +89,10 @@ TkMacOSXInitAppleEvents( err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, PrintHandlerUPP, (long) interp, false); + PrefsHandlerUPP = NewAEEventHandlerUPP(PrefsHandler); + err = AEInstallEventHandler(kCoreEventClass, kAEShowPreferences, + PrefsHandlerUPP, (long) interp, false); + if (interp != NULL) { ScriptHandlerUPP = NewAEEventHandlerUPP(ScriptHandler); err = AEInstallEventHandler('misc', 'dosc', @@ -153,13 +159,33 @@ OSErr QuitHandler (const AppleEvent * event, AppleEvent * reply, long handlerRef return noErr; } +static OSErr +OappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) +{ + return noErr; +} -OSErr OappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) +/* Called when the user selects 'Preferences...' in MacOS X */ +static OSErr +PrefsHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) { + Tcl_CmdInfo dummy; + Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon; + /* + * Don't bother if we don't have an interp or + * the show preferences procedure doesn't exist. + */ + + if ((interp == NULL) || + (Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)) == 0) { + return noErr; + } + Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences"); return noErr; } -static OSErr OdocHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) +static OSErr +OdocHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) { Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon; AEDescList fileSpecList; @@ -233,7 +259,8 @@ static OSErr OdocHandler (const AppleEvent * event, AppleEvent * reply, long han return noErr; } -OSErr PrintHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) +static OSErr +PrintHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) { return noErr; } @@ -254,7 +281,8 @@ OSErr PrintHandler (const AppleEvent * event, AppleEvent * reply, long handlerRe *---------------------------------------------------------------------- */ -OSErr ScriptHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) +static OSErr +ScriptHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon) { OSErr theErr; AEDescList theDesc; @@ -376,7 +404,7 @@ OSErr ScriptHandler (const AppleEvent * event, AppleEvent * reply, long handlerR *---------------------------------------------------------------------- */ -int +static int ReallyKillMe(Tcl_Event *eventPtr, int flags) { Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 7b785ee..58d517c 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.1.2.3 2002/06/12 03:37:37 wolfsuit Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.1.2.4 2002/07/21 11:11:55 vincentdarley Exp $ */ #include <Carbon/Carbon.h> @@ -23,6 +23,7 @@ #include "tkScrollbar.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" +#include "tkMacOSXUtil.h" /* * This is a list of all of the toplevels that have been mapped so far. It is @@ -527,6 +528,44 @@ Tk_WmCmd( } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; goto updateGeom; + } else if ((c == 'a') && (strncmp(argv[1], "attributes", length) == 0) + && (length >= 2)) { + char buf[TCL_INTEGER_SPACE]; + int i, boolean; + WindowRef macWindow; + + if (argc < 3) { + configArgs: + Tcl_AppendResult(interp, "wrong # arguments: must be \"", + argv[0], " attributes window", + " ?-modified ?bool??", + "\"", (char *) NULL); + return TCL_ERROR; + } + macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)); + if (argc == 3) { + sprintf(buf, "%d", (IsWindowModified(macWindow) == true)); + Tcl_AppendResult(interp, "-modified ", buf, (char *) NULL); + return TCL_OK; + } + for (i = 3; i < argc; i += 2) { + length = strlen(argv[i]); + if ((length < 2) || (argv[i][0] != '-')) { + goto configArgs; + } + if ((i < argc-1) && + (Tcl_GetBoolean(interp, argv[i+1], &boolean) != TCL_OK)) { + return TCL_ERROR; + } + if (strncmp(argv[i], "-modified", length) == 0) { + SetWindowModified(macWindow, boolean); + } else { + goto configArgs; + } + if (i == argc-1) { + Tcl_SetIntObj(Tcl_GetObjResult(interp), boolean); + } + } } else if ((c == 'c') && (strncmp(argv[1], "client", length) == 0) && (length >= 2)) { if ((argc != 3) && (argc != 4)) { @@ -875,6 +914,20 @@ Tk_WmCmd( } wmPtr->hints.flags &= ~IconPixmapHint; } else { + OSErr err; + FSSpec spec; + FSRef ref; + Boolean isDirectory; + err = FSPathMakeRef(argv[3], &ref, &isDirectory); + if (err == noErr) { + err = FSGetCatalogInfo (&ref, kFSCatInfoNone, NULL, NULL, &spec, NULL); + if (err == noErr) { + WindowRef macWin = + GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)); + SetWindowProxyFSSpec(macWin, &spec); + return TCL_OK; + } + } pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, Tk_GetUid(argv[3])); if (pixmap == None) { @@ -3209,7 +3262,7 @@ TkSetWMName( if (Tk_IsEmbedded(winPtr)) { return; } - Tcl_UtfToExternal(NULL, NULL, titleUid, + Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, titleUid, strlen(titleUid), 0, NULL, (char *) &pTitle[1], 255, NULL, &destWrote, NULL); /* Internalize native */ |