diff options
author | vincentdarley <vincentdarley> | 2002-07-21 20:40:33 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2002-07-21 20:40:33 (GMT) |
commit | 0c26d08242fee1efff28cc5af0a3235211cf10f6 (patch) | |
tree | ae3eff4f6e484d7fd4a66c0c8483bfd86f66d750 | |
parent | 24e4fa2fefa2a93dd70076d6fd51c1fba9cef68c (diff) | |
download | tk-0c26d08242fee1efff28cc5af0a3235211cf10f6.zip tk-0c26d08242fee1efff28cc5af0a3235211cf10f6.tar.gz tk-0c26d08242fee1efff28cc5af0a3235211cf10f6.tar.bz2 |
encoding issues, proxy icons
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tkFont.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXButton.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXMenubutton.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 50 |
5 files changed, 57 insertions, 23 deletions
@@ -6,8 +6,12 @@ * 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. + has two options at present: to set the 'modified' state of the + proxy icon, and to set the filepath of the titlebar proxy. + * macosx/tkMacOSXButton.c: + * macosx/tkMacOSXMenubutton.c: fix for final encoding issues. + * generic/tkFont.c: fix to the MacOSX-added function to allow + multi-byte chars to work properly. 2002-07-17 Vince Darley <vincentdarley@users.sourceforge.net> diff --git a/generic/tkFont.c b/generic/tkFont.c index c9c0f08..2f6e696 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -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: tkFont.c,v 1.12.2.3 2002/02/05 02:25:15 wolfsuit Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.12.2.4 2002/07/21 20:40:34 vincentdarley Exp $ */ #include "tkPort.h" @@ -3694,7 +3694,7 @@ Tk_GetFirstTextLayout( { TextLayout *layoutPtr; LayoutChunk *chunkPtr; - int numDisplayChars; + int numBytesInChunk; layoutPtr = (TextLayout *)layout; if ((layoutPtr==NULL) @@ -3704,10 +3704,10 @@ Tk_GetFirstTextLayout( return 0; } chunkPtr = layoutPtr->chunks; - numDisplayChars = chunkPtr->numDisplayChars; - strncpy(dst, chunkPtr->start, numDisplayChars); + numBytesInChunk = chunkPtr->numBytes; + strncpy(dst, chunkPtr->start, numBytesInChunk); *font = layoutPtr->tkfont; - return numDisplayChars; + return numBytesInChunk; } diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 1245960..32212ff 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.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: tkMacOSXButton.c,v 1.1.2.2 2002/07/16 14:32:57 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXButton.c,v 1.1.2.3 2002/07/21 20:40:34 vincentdarley Exp $ */ #include "tkButton.h" @@ -958,7 +958,7 @@ TkMacOSXDrawControl( if (bcmp(mbPtr->controlTitle, controlTitle, len+1)) { CFStringRef cf; cf = CFStringCreateWithCString(NULL, - controlTitle, kCFStringEncodingMacRoman); + controlTitle, kCFStringEncodingUTF8); if (cf != NULL) { SetControlTitleWithCFString(mbPtr->control, cf); CFRelease(cf); diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 1611c98..fd2887c 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.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: tkMacOSXMenubutton.c,v 1.1.2.2 2002/07/16 14:32:57 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.1.2.3 2002/07/21 20:40:34 vincentdarley Exp $ */ #include <Carbon/Carbon.h> @@ -234,7 +234,7 @@ TkpDisplayMenuButton( if (titleChanged) { CFStringRef cf; cf = CFStringCreateWithCString(NULL, - titleParams.title, kCFStringEncodingMacRoman); + titleParams.title, kCFStringEncodingUTF8); if (hasImageOrBitmap) { SetControlTitleWithCFString(mbPtr->control, cf); } else { @@ -658,7 +658,7 @@ MenuButtonInitControl ( if (mbPtr->params.isBevel) { CFStringRef cf; cf = CFStringCreateWithCString(NULL, - mbPtr->titleParams.title, kCFStringEncodingMacRoman); + mbPtr->titleParams.title, kCFStringEncodingUTF8); SetControlTitleWithCFString(mbPtr->control, cf); CFRelease(cf); if (mbPtr->titleParams.len) { @@ -681,7 +681,7 @@ MenuButtonInitControl ( return 1; } cf = CFStringCreateWithCString(NULL, - mbPtr->titleParams.title, kCFStringEncodingMacRoman); + mbPtr->titleParams.title, kCFStringEncodingUTF8); AppendMenuItemText(mbPtr->menuRef, "\px"); if (cf != NULL) { SetMenuItemTextWithCFString(mbPtr->menuRef, 1, cf); diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 58d517c..9c19731 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.4 2002/07/21 11:11:55 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.1.2.5 2002/07/21 20:40:34 vincentdarley Exp $ */ #include <Carbon/Carbon.h> @@ -531,7 +531,7 @@ Tk_WmCmd( } else if ((c == 'a') && (strncmp(argv[1], "attributes", length) == 0) && (length >= 2)) { char buf[TCL_INTEGER_SPACE]; - int i, boolean; + int i; WindowRef macWindow; if (argc < 3) { @@ -544,8 +544,16 @@ Tk_WmCmd( } macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)); if (argc == 3) { + FSSpec spec; sprintf(buf, "%d", (IsWindowModified(macWindow) == true)); Tcl_AppendResult(interp, "-modified ", buf, (char *) NULL); + if (GetWindowProxyFSSpec(macWindow, &spec) == noErr) { + Tcl_AppendResult(interp, " -titlepath", (char *) NULL); + /* Need to get the path from the spec */ + Tcl_AppendElement(interp, "<read_unimplemented>"); + } else { + Tcl_AppendResult(interp, " -titlepath {}", (char *) NULL); + } return TCL_OK; } for (i = 3; i < argc; i += 2) { @@ -553,18 +561,40 @@ Tk_WmCmd( 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); + int boolean; + if (i < argc-1) { + if (Tcl_GetBoolean(interp, argv[i+1], &boolean) != TCL_OK) { + return TCL_ERROR; + } + SetWindowModified(macWindow, boolean); + } + } else if (strncmp(argv[i], "-titlepath", length) == 0) { + if (i < argc-1) { + OSErr err; + FSSpec spec; + FSRef ref; + Boolean isDirectory; + err = FSPathMakeRef(argv[i+1], &ref, &isDirectory); + if (err == noErr) { + err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, + &spec, NULL); + if (err == noErr) { + if (SetWindowProxyFSSpec(macWindow,&spec) != noErr) { + Tcl_AppendResult(interp, "couldn't set window proxy title path", + (char *) NULL); + return TCL_ERROR; + } + } + } + } } else { goto configArgs; } - if (i == argc-1) { - Tcl_SetIntObj(Tcl_GetObjResult(interp), boolean); - } + if (i == argc-2) { + /* Want to return last result */ + Tcl_SetResult(interp, argv[i+1], TCL_VOLATILE); + } } } else if ((c == 'c') && (strncmp(argv[1], "client", length) == 0) && (length >= 2)) { |