diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-06-08 16:57:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-06-08 16:57:03 (GMT) |
commit | 321e94853dc9a87fb9eab06376938a85fa2c767a (patch) | |
tree | 3125f74fb7d6f8d0774c41f843402e22fe39bd20 /macosx | |
parent | a3eb1edc6e9c2eb227b40c7d46f42e6162be78d6 (diff) | |
download | tk-321e94853dc9a87fb9eab06376938a85fa2c767a.zip tk-321e94853dc9a87fb9eab06376938a85fa2c767a.tar.gz tk-321e94853dc9a87fb9eab06376938a85fa2c767a.tar.bz2 |
Add more type-casts, code cleanup (all backported from 8.7)
Diffstat (limited to 'macosx')
28 files changed, 370 insertions, 341 deletions
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 49736f0..29ad97e 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -3,9 +3,9 @@ * * This file handles the implementation of native bitmaps. * - * Copyright (c) 1996-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1996-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -136,7 +136,7 @@ PixmapFromImage( TkMacOSXDrawingContext dc; Pixmap pixmap; - pixmap = Tk_GetPixmap(display, None, size.width, size.height, 0); + pixmap = Tk_GetPixmap(display, None, (int)size.width, (int)size.height, 0); if (TkMacOSXSetupDrawingContext(pixmap, NULL, &dc)) { if (dc.context) { CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, @@ -321,8 +321,8 @@ TkpGetNativeAppBitmap( pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); } } - *width = size.width; - *height = size.height; + *width = (int)size.width; + *height = (int)size.height; return pixmap; } @@ -350,7 +350,8 @@ TkMacOSXIconBitmapObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_HashEntry *hPtr; - int i = 1, len, isNew, result = TCL_ERROR; + int isNew, result = TCL_ERROR; + int i = 1, len; const char *name, *value; IconBitmap ib, *iconBitmap; diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index f8f60f8..3c91fc8 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -4,12 +4,12 @@ * This file implements the Macintosh specific portion of the button * widgets. * - * Copyright (c) 1996-1997 by Sun Microsystems, Inc. - * Copyright 2001, Apple Computer, Inc. - * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2007 Revar Desmera. - * Copyright 2015 Kevin Walzer/WordTech Communications LLC. - * Copyright 2015 Marc Culler. + * Copyright © 1996-1997 Sun Microsystems, Inc. + * Copyright © 2001 Apple Computer, Inc. + * Copyright © 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2007 Revar Desmera. + * Copyright © 2015 Kevin Walzer/WordTech Communications LLC. + * Copyright © 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -409,10 +409,10 @@ TkpComputeButtonGeometry( tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY); HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); if (height < contBounds.size.height) { - height = contBounds.size.height; + height = (int)contBounds.size.height; } if (width < contBounds.size.width) { - width = contBounds.size.width; + width = (int)contBounds.size.width; } height += 2*HI_PADY; width += 2*HI_PADX; diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index b8159d6..126af47 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -3,9 +3,9 @@ * * This file manages the clipboard for the Tk toolkit. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -37,7 +37,7 @@ static Tk_Window clipboardOwner = NULL; cbPtr; cbPtr = cbPtr->nextPtr) { NSString *s = [[TKNSString alloc] initWithTclUtfBytes:cbPtr->buffer - length:cbPtr->length]; + length:(NSUInteger)cbPtr->length]; [string appendString:s]; [s release]; } diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 1991466..a456a19 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -5,11 +5,11 @@ * toolkit, in order to avoid round-trips to the server to * map color names to pixel values. * - * Copyright (c) 1990-1994 The Regents of the University of California. - * Copyright (c) 1994-1996 Sun Microsystems, Inc. - * Copyright (c) 2001-2009 Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2020 Marc Culler + * Copyright © 1990-1994 The Regents of the University of California. + * Copyright © 1994-1996 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -43,7 +43,8 @@ void initColorTable() SystemColorDatum *entry, *oldEntry; Tcl_HashSearch search; Tcl_HashEntry *hPtr; - int newPtr, index = 0; + int newPtr; + int index = 0; NSColorList *systemColorList = [NSColorList colorListNamed:@"System"]; NSString *key; @@ -93,13 +94,13 @@ void initColorTable() */ for (key in [systemColorList allKeys]) { - int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + NSUInteger length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; char *name; entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum)); bzero(entry, sizeof(SystemColorDatum)); name = (char *)ckalloc(length + 1); strcpy(name, key.UTF8String); - name[0] = toupper(name[0]); + name[0] = (char)toupper(UCHAR(name[0])); if (!strcmp(name, "WindowBackgroundColor")) { /* @@ -185,9 +186,9 @@ TkMacOSXRGBPixel( { MacPixel p = {0}; p.pixel.colortype = rgbColor; - p.pixel.value = ((red & 0xff) << 16) | + p.pixel.value = (unsigned int)(((red & 0xff) << 16) | ((green & 0xff) << 8) | - (blue & 0xff); + (blue & 0xff)); return p.ulong; } @@ -531,7 +532,7 @@ TkMacOSXGetNSColor( if (cgColor) { nsColor = [NSColor colorWithColorSpace:sRGB components:CGColorGetComponents(cgColor) - count:CGColorGetNumberOfComponents(cgColor)]; + count:(NSInteger)CGColorGetNumberOfComponents(cgColor)]; CGColorRelease(cgColor); } return nsColor; @@ -661,7 +662,7 @@ TkpGetColor( CGColorRef c = NULL; p.pixel.colortype = entry->type; - p.pixel.value = entry->index; + p.pixel.value = (unsigned int)entry->index; color.pixel = p.ulong; if (entry->type == semantic) { CGFloat rgba[4]; @@ -699,9 +700,9 @@ TkpGetColor( #else GetRGBA(entry, p.ulong, rgba); #endif - color.red = rgba[0] * 65535.0; - color.green = rgba[1] * 65535.0; - color.blue = rgba[2] * 65535.0; + color.red = (unsigned short)(rgba[0] * 65535.0); + color.green = (unsigned short)(rgba[1] * 65535.0); + color.blue = (unsigned short)(rgba[2] * 65535.0); goto validXColor; } else if (SetCGColorComponents(entry, 0, &c)) { const size_t n = CGColorGetNumberOfComponents(c); @@ -709,12 +710,12 @@ TkpGetColor( switch (n) { case 4: - color.red = rgba[0] * 65535.0; - color.green = rgba[1] * 65535.0; - color.blue = rgba[2] * 65535.0; + color.red = (unsigned short)(rgba[0] * 65535.0); + color.green = (unsigned short)(rgba[1] * 65535.0); + color.blue = (unsigned short)(rgba[2] * 65535.0); break; case 2: - color.red = color.green = color.blue = rgba[0] * 65535.0; + color.red = color.green = color.blue = (unsigned short)(rgba[0] * 65535.0); break; default: Tcl_Panic("CGColor with %d components", (int) n); diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c index 841fc54..1588d21 100644 --- a/macosx/tkMacOSXConfig.c +++ b/macosx/tkMacOSXConfig.c @@ -4,8 +4,8 @@ * This module implements the Macintosh system defaults for * the configuration package. * - * Copyright (c) 1997 by Sun Microsystems, Inc. - * Copyright 2001, Apple Inc. + * Copyright © 1997 Sun Microsystems, Inc. + * Copyright © 2001, Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -39,6 +39,10 @@ TkpGetSystemDefault( const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { + (void)tkwin; + (void)dbName; + (void)className; + return NULL; } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index dc5b61a..df87fd0 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -3,9 +3,9 @@ * * This file contains Macintosh specific cursor related routines. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c index fc01ef4..b2022b9 100644 --- a/macosx/tkMacOSXDebug.c +++ b/macosx/tkMacOSXDebug.c @@ -4,8 +4,8 @@ * Implementation of Macintosh specific functions for debugging MacOS * events, regions, etc... * - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2001-2009, Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 2e38866..d620157 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -262,7 +262,8 @@ getFileURL( } if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; - int objc, result = Tcl_ListObjGetElements(callbackInfo->interp, + int objc; + int result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { @@ -294,7 +295,8 @@ getFileURL( if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; - int objc, result = Tcl_ListObjGetElements(callbackInfo->interp, + int objc; + int result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { @@ -316,7 +318,7 @@ getFileURL( - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; - filterInfo.fileTypeIndex = [button indexOfSelectedItem]; + filterInfo.fileTypeIndex = (NSUInteger)[button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [openpanel setAllowsOtherFileTypes:YES]; @@ -340,7 +342,7 @@ getFileURL( - (void)saveFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; - filterInfo.fileTypeIndex = [button indexOfSelectedItem]; + filterInfo.fileTypeIndex = (NSUInteger)[button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [savepanel setAllowsOtherFileTypes:YES]; @@ -691,7 +693,8 @@ Tk_GetOpenFileObjCmd( Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; - int index, len, multiple = 0; + int index, multiple = 0; + int len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil; NSString *message = nil, *title = nil; @@ -789,7 +792,7 @@ Tk_GetOpenFileObjCmd( [message release]; } - [openpanel setAllowsMultipleSelection:multiple]; + [openpanel setAllowsMultipleSelection:multiple != 0]; if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; @@ -820,7 +823,7 @@ Tk_GetOpenFileObjCmd( * and open the accessory view. */ - [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; + [popupButton selectItemAtIndex:(NSInteger)filterInfo.fileTypeIndex]; /* * On OSX > 10.11, the options are not visible by default. Ergo @@ -963,7 +966,8 @@ Tk_GetSaveFileObjCmd( char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; - int index, len; + int index; + int len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; NSString *directory = nil, *filename = nil, *defaultType = nil; NSString *message = nil, *title = nil; @@ -1093,7 +1097,7 @@ Tk_GetSaveFileObjCmd( initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; - [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; + [popupButton selectItemAtIndex:(NSInteger)filterInfo.fileTypeIndex]; [popupButton setTarget:NSApp]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; @@ -1204,7 +1208,8 @@ Tk_ChooseDirectoryObjCmd( Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; - int index, len, mustexist = 0; + int index, mustexist = 0; + int len; Tcl_Obj *cmdObj = NULL; NSString *directory = nil; NSString *message, *title; @@ -1510,7 +1515,7 @@ Tk_MessageBoxObjCmd( } } [[buttons objectAtIndex: [buttons count]-1] setKeyEquivalent: @"\033"]; - [[buttons objectAtIndex: defaultNativeButtonIndex-1] + [[buttons objectAtIndex: (NSUInteger)(defaultNativeButtonIndex-1)] setKeyEquivalent: @"\r"]; if (cmdObj) { if (Tcl_IsShared(cmdObj)) { @@ -1706,7 +1711,8 @@ FontchooserEvent( fontPanelFont, fontPanelFontAttributes); if (fontObj) { if (fcdPtr->cmdObj) { - int objc, result; + int objc; + int result; Tcl_Obj **objv, **tmpv; result = Tcl_ListObjGetElements(fontchooserInterp, @@ -1817,7 +1823,8 @@ FontchooserConfigureCmd( Tk_Window tkwin = (Tk_Window)clientData; FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); - int i, r = TCL_OK; + int i; + int r = TCL_OK; /* * With no arguments we return all the options in a dict @@ -1839,7 +1846,8 @@ FontchooserConfigureCmd( } for (i = 1; i < objc; i += 2) { - int optionIndex, len; + int optionIndex; + int len; if (Tcl_GetIndexFromObjStruct(interp, objv[i], fontchooserOptionStrings, sizeof(char *), "option", 0, &optionIndex) != TCL_OK) { diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 5698a44..ec3c963 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -4,10 +4,10 @@ * This file contains functions that draw to windows. Many of thees * functions emulate Xlib functions. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright (c) 2001-2009 Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2014-2020 Marc Culler. + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2014-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -133,7 +133,7 @@ TkMacOSXGetNSImageFromTkImage( { Pixmap pixmap; NSImage *nsImage; - if (width == 0 || height == 0) { + if (width <= 0 || height <= 0) { return nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0,0)]; } pixmap = Tk_GetPixmap(display, None, width, height, 0); @@ -175,7 +175,7 @@ TkMacOSXGetNSImageFromBitmap( gc->background = transparentColor; XSetClipOrigin(display, gc, 0, 0); - XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1); + XCopyPlane(display, bitmap, pixmap, gc, 0, 0, (unsigned)width, (unsigned)height, 0, 0, 1); gc->background = origBackground; nsImage = CreateNSImageFromPixmap(pixmap, width, height); Tk_FreePixmap(display, pixmap); @@ -273,8 +273,8 @@ TkMacOSXGetCGContextForDrawable( len = macDraw->size.height * bytesPerRow; data = (char *)ckalloc(len); bzero(data, len); - macDraw->context = CGBitmapContextCreate(data, macDraw->size.width, - macDraw->size.height, bitsPerComponent, bytesPerRow, + macDraw->context = CGBitmapContextCreate(data, (unsigned)macDraw->size.width, + (unsigned)macDraw->size.height, bitsPerComponent, bytesPerRow, colorspace, bitmapInfo); if (macDraw->context) { CGContextClearRect(macDraw->context, bounds); diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c index 75cd198..286a7fe 100644 --- a/macosx/tkMacOSXEntry.c +++ b/macosx/tkMacOSXEntry.c @@ -3,9 +3,9 @@ * * This file implements the native aqua entry widget. * - * Copyright 2001, Apple Computer, Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2008-2009, Apple Inc. + * Copyright © 2001 Apple Computer, Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -259,10 +259,10 @@ TkpDrawSpinboxButtons( */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); - rects[0].x = Tk_Width(tkwin) - incDecWidth - 1; + rects[0].x = (short)(Tk_Width(tkwin) - incDecWidth - 1); rects[0].y = 0; - rects[0].width = incDecWidth + 1; - rects[0].height = Tk_Height(tkwin); + rects[0].width = (unsigned short)(incDecWidth + 1); + rects[0].height = (unsigned short)Tk_Height(tkwin); XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1); if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) { diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 6afaca4..74d2d9f 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -3,9 +3,9 @@ * * This file contains the basic Mac OS X Event handling routines. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009, Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXFileTypes.c b/macosx/tkMacOSXFileTypes.c index 2fcc6cd..f9c4310 100644 --- a/macosx/tkMacOSXFileTypes.c +++ b/macosx/tkMacOSXFileTypes.c @@ -54,7 +54,7 @@ MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) { } Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&ostype2identifier, INT2PTR(ostype)); if (hPtr) { - char *UTI = Tcl_GetHashValue(hPtr); + char *UTI = (char *)Tcl_GetHashValue(hPtr); return [[NSString alloc] initWithCString:UTI encoding:NSASCIIStringEncoding]; } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 54edb81..d413f0b 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -4,9 +4,9 @@ * Contains the Macintosh implementation of the platform-independent font * package interface. * - * Copyright (c) 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2008-2009 Apple Inc. + * Copyright © 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -47,7 +47,7 @@ typedef struct { #define MENUITEMFONT_NAME "menu" struct SystemFontMapEntry { - const ThemeFontID id; + ThemeFontID id; const char *systemName; const char *tkName; const char *tkName1; @@ -74,7 +74,7 @@ static const struct SystemFontMapEntry systemFontMap[] = { ThemeFont(MiniSystem, NULL, NULL), { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, - { -1, NULL, NULL, NULL } + { (ThemeFontID)-1, NULL, NULL, NULL } }; #undef ThemeFont @@ -349,9 +349,9 @@ InitFont( nsFont = [nsFont screenFontWithRenderingMode:renderingMode]; GetTkFontAttributesForNSFont(nsFont, faPtr); fmPtr = &fontPtr->font.fm; - fmPtr->ascent = floor([nsFont ascender] + [nsFont leading] + 0.5); - fmPtr->descent = floor(-[nsFont descender] + 0.5); - fmPtr->maxWidth = [nsFont maximumAdvancement].width; + fmPtr->ascent = (int)floor([nsFont ascender] + [nsFont leading] + 0.5); + fmPtr->descent = (int)floor(-[nsFont descender] + 0.5); + fmPtr->maxWidth = (int)[nsFont maximumAdvancement].width; fmPtr->fixed = [nsFont isFixedPitch]; /* Does not work for all fonts */ /* @@ -369,8 +369,8 @@ InitFont( kern = [nsFont advancementForGlyph:glyphs[2]].width - [fontPtr->nsFont advancementForGlyph:glyphs[2]].width; } - descent = floor(-bounds.origin.y + 0.5); - ascent = floor(bounds.size.height + bounds.origin.y + 0.5); + descent = (int)floor(-bounds.origin.y + 0.5); + ascent = (int)floor(bounds.size.height + bounds.origin.y + 0.5); if (ascent > fmPtr->ascent) { fmPtr->ascent = ascent; } diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 3b87fbe..76af976 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -3,11 +3,11 @@ * * Implements high level event support for the Macintosh. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright (c) 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2015-2019 Marc Culler - * Copyright (c) 2019 Kevin Walzer/WordTech Communications LLC. + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2015-2019 Marc Culler + * Copyright © 2019 Kevin Walzer/WordTech Communications LLC. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -54,27 +54,30 @@ static void ProcessAppleEvent(ClientData clientData); * Names of the procedures which can be used to process AppleEvents. */ -static const char *openDocumentProc = "::tk::mac::OpenDocument"; -static const char *launchURLProc = "::tk::mac::LaunchURL"; -static const char *printDocProc = "::tk::mac::PrintDocument"; -static const char *scriptFileProc = "::tk::mac::DoScriptFile"; -static const char *scriptTextProc = "::tk::mac::DoScriptText"; +static const char openDocumentProc[] = "::tk::mac::OpenDocument"; +static const char launchURLProc[] = "::tk::mac::LaunchURL"; +static const char printDocProc[] = "::tk::mac::PrintDocument"; +static const char scriptFileProc[] = "::tk::mac::DoScriptFile"; +static const char scriptTextProc[] = "::tk::mac::DoScriptText"; #pragma mark TKApplication(TKHLEvents) @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender { + (void)sender; [self handleQuitApplicationEvent:Nil withReplyEvent:Nil]; } - (void) superTerminate: (id) sender { + (void) sender; [super terminate:nil]; } - (void) preferences: (id) sender { + (void)sender; [self handleShowPreferencesEvent:Nil withReplyEvent:Nil]; } @@ -82,6 +85,8 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; withReplyEvent: (NSAppleEventDescriptor *)replyEvent { KillEvent *eventPtr; + (void)event; + (void)replyEvent; if (_eventInterp) { /* @@ -92,7 +97,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; * quickly as possible. */ - eventPtr = ckalloc(sizeof(KillEvent)); + eventPtr = (KillEvent *)ckalloc(sizeof(KillEvent)); eventPtr->header.proc = ReallyKillMe; eventPtr->interp = _eventInterp; @@ -103,6 +108,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleOpenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication", @@ -116,6 +124,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + [NSApp activateIgnoringOtherApps: YES]; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ReopenApplication", NULL, 0)) { @@ -130,6 +141,9 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleShowPreferencesEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowPreferences", @@ -153,7 +167,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; long count, index; AEKeyword keyword; Tcl_DString pathName; - + (void)replyEvent; /* * Do nothing if we don't have an interpreter. @@ -193,7 +207,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; * procedure, passing the paths contained in the AppleEvent as arguments. */ - AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *openCommand = &AEInfo->command; Tcl_DStringInit(openCommand); Tcl_DStringAppend(openCommand, openDocumentProc, -1); @@ -237,8 +251,10 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *printFile = [file UTF8String]; - AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *printCommand = &AEInfo->command; + (void)replyEvent; + Tcl_DStringInit(printCommand); Tcl_DStringAppend(printCommand, printDocProc, -1); Tcl_DStringAppendElement(printCommand, printFile); @@ -299,7 +315,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; URLBuffer[actual] = '\0'; NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; NSURL *fileURL = [NSURL URLWithString:urlString]; - AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *scriptFileCommand = &AEInfo->command; Tcl_DStringInit(scriptFileCommand); Tcl_DStringAppend(scriptFileCommand, scriptFileProc, -1); @@ -320,15 +336,15 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; */ if (actual > 0) { - char *data = ckalloc(actual + 1); + char *data = (char *)ckalloc(actual + 1); if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, data, actual, NULL)) { - data[actual] = '\0'; - AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); - Tcl_DString *scriptTextCommand = &AEInfo->command; - Tcl_DStringInit(scriptTextCommand); - Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1); + data[actual] = '\0'; + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); + Tcl_DString *scriptTextCommand = &AEInfo->command; + Tcl_DStringInit(scriptTextCommand); + Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1); Tcl_DStringAppendElement(scriptTextCommand, data); AEInfo->interp = _eventInterp; AEInfo->procedure = scriptTextProc; @@ -351,8 +367,10 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText"; NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *cURL=[url UTF8String]; - AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *launchCommand = &AEInfo->command; + (void)replyEvent; + Tcl_DStringInit(launchCommand); Tcl_DStringAppend(launchCommand, launchURLProc, -1); Tcl_DStringAppendElement(launchCommand, cURL); @@ -460,7 +478,7 @@ static void ProcessAppleEvent( void TkMacOSXInitAppleEvents( - Tcl_Interp *interp) /* not used */ + TCL_UNUSED(Tcl_Interp *)) { NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager]; static Boolean initialized = FALSE; @@ -620,7 +638,6 @@ MissedAnyParameters( return (err != errAEDescNotFound); } - /* * Local Variables: diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index ea08dc5..5f55638 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -114,7 +114,7 @@ _XInitImageFuncPtrs( static void ReleaseData( void *info, TCL_UNUSED(const void *), /* data */ - TCL_UNUSED(size_t)) /* size */ + TCL_UNUSED(size_t)) /* size */ { ckfree(info); } @@ -388,7 +388,7 @@ ImagePutPixel( XImage * XCreateImage( Display* display, - TCL_UNUSED(Visual*), /* visual */ + TCL_UNUSED(Visual*), /* visual */ unsigned int depth, int format, int offset, @@ -503,6 +503,7 @@ TkMacOSXPutImage( TkMacOSXDrawingContext dc; MacDrawable *macDraw = (MacDrawable *)drawable; int result = Success; + LastKnownRequestProcessed(display)++; if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) { return BadDrawable; @@ -747,7 +748,7 @@ XGetImage( int y, unsigned int width, unsigned int height, - TCL_UNUSED(unsigned long), /* plane_mask */ + TCL_UNUSED(unsigned long), /* plane_mask */ int format) { NSBitmapImageRep* bitmapRep = nil; diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 3b451a0..71d7c33 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -4,10 +4,10 @@ * This file contains Mac OS X -specific interpreter initialization * functions. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright (c) 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2017 Marc Culler + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2017 Marc Culler * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -178,6 +178,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, /* * Initialize the graphics context. */ + TkMacOSXUseAntialiasedText(_eventInterp, -1); TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); @@ -249,8 +250,8 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, #else NSOperatingSystemVersion systemVersion; systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; - majorVersion = systemVersion.majorVersion; - minorVersion = systemVersion.minorVersion; + majorVersion = (int)systemVersion.majorVersion; + minorVersion = (int)systemVersion.minorVersion; #endif if (majorVersion == 10 && minorVersion == 16) { @@ -266,7 +267,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, struct utsname name; char *endptr; if (uname(&name) == 0) { - majorVersion = strtol(name.release, &endptr, 10) - 9; + majorVersion = (int)strtol(name.release, &endptr, 10) - 9; minorVersion = 0; } } @@ -421,7 +422,7 @@ TCL_NORETURN void TkpExitProc( if (doCleanup == YES) { [(TKApplication *)NSApp superTerminate:nil]; /* Should not return. */ } - exit((long)clientdata); /* Convince the compiler that we don't return. */ + exit((int)PTR2INT(clientdata)); /* Convince the compiler that we don't return. */ } #endif @@ -645,12 +646,10 @@ TkpInit( if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } - if (scriptPath[0] != '\0') { Tcl_SetVar2(interp, "auto_path", NULL, scriptPath, TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } - Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 59218ce..f313c90 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -4,10 +4,10 @@ * This file implements functions that decode & handle keyboard events on * MacOS X. * - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2012 Adrian Robert. - * Copyright 2015-2020 Marc Culler. + * Copyright © 2001-2009, Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2012 Adrian Robert. + * Copyright © 2015-2020 Marc Culler. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -400,6 +400,9 @@ static NSUInteger textInputModifiers; - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)theRange actualRange:(NSRangePointer)thePointer { + (void)theRange; + (void)thePointer; + return nil; } @@ -417,6 +420,7 @@ static NSUInteger textInputModifiers; Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; + (void)selRange; str = ([aString isKindOfClass: [NSAttributedString class]]) ? [aString string] : aString; @@ -493,6 +497,9 @@ static NSUInteger textInputModifiers; { NSRect rect; NSPoint pt; + (void)theRange; + (void)thePointer; + pt.x = caret_x; pt.y = caret_y; @@ -547,6 +554,8 @@ static NSUInteger textInputModifiers; - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint { + (void)thePoint; + if (NS_KEYLOG) { TKLog(@"characterIndexForPoint request"); } @@ -556,6 +565,8 @@ static NSUInteger textInputModifiers; - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange { static NSAttributedString *str = nil; + (void)theRange; + if (str == nil) { str = [NSAttributedString new]; } @@ -710,6 +721,10 @@ XGrabKeyboard( { keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window); TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture(); + (void)owner_events; + (void)pointer_mode; + (void)keyboard_mode; + (void)time; if (keyboardGrabWinPtr && captureWinPtr) { NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window); @@ -752,6 +767,9 @@ XUngrabKeyboard( Display* display, Time time) { + (void)display; + (void)time; + if (modalSession) { [NSApp endModalSession:modalSession]; modalSession = nil; diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 2e43258..2a19146 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -3,10 +3,10 @@ * * Routines to support keyboard events on the Macintosh. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2020 Marc Culler + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009, Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2020 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -154,8 +154,6 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars, (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, sel_getName(_cmd), notification); -#else - (void)notification; #endif keyboardChanged = YES; UpdateKeymaps(); diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index f853abe..fd70266 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -3,10 +3,10 @@ * * This module implements the Mac-platform specific features of menus. * - * Copyright (c) 1996-1997 Sun Microsystems, Inc. - * Copyright (c) 2001-2009 Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2012 Adrian Robert. + * Copyright © 1996-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2012 Adrian Robert. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -167,7 +167,6 @@ static int ModifierCharWidth(Tk_Font tkfont); TKBackgroundLoop *backgroundLoop = nil; - #pragma mark TKMenu /* @@ -1048,7 +1047,7 @@ TkpPostTearoffMenu( * at the given coordinates. */ - if (index >= menuPtr->numEntries) { + if (index < 0 || index >= menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 2853db9..9b88eb9 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -4,8 +4,8 @@ * This file implements functions that decode & handle mouse events on * MacOS X. * - * Copyright (c) 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index 5da13d4..9885199 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -4,10 +4,10 @@ * This file implements the Macintosh specific portion of the * scale widget. * - * Copyright (c) 1996 by Sun Microsystems, Inc. - * Copyright (c) 1998-2000 by Scriptics Corporation. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2008-2009, Apple Inc. + * Copyright © 1996 Sun Microsystems, Inc. + * Copyright © 1998-2000 Scriptics Corporation. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2008-2009 Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -287,6 +287,7 @@ TkpDisplayScale( SetControlVisibility(macScalePtr->scaleHandle, true, true); HiliteControl(macScalePtr->scaleHandle, 0); Draw1Control(macScalePtr->scaleHandle); + done: scalePtr->flags &= ~REDRAW_ALL; } diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 5cb8e03..8173e0a 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -4,11 +4,11 @@ * This file implements the Macintosh specific portion of the scrollbar * widget. * - * Copyright (c) 1996 by Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2015 Kevin Walzer/WordTech Commununications LLC. - * Copyright (c) 2018-2019 Marc Culler + * Copyright © 1996 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2015 Kevin Walzer/WordTech Commununications LLC. + * Copyright © 2018-2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -486,6 +486,7 @@ void TkpConfigureScrollbar( TkScrollbar *scrollPtr) { + (void)scrollPtr; /* empty */ } @@ -660,7 +661,7 @@ UpdateControlValues( * * ScrollbarEvent -- * - * This procedure is invoked in response to <ButtonPress>, + * This procedure is invoked in response to <Button>, * <ButtonRelease>, <EnterNotify>, and <LeaveNotify> events. The * Scrollbar appearance is modified for each event. * diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c index 72c4bcf..b563817 100644 --- a/macosx/tkMacOSXSend.c +++ b/macosx/tkMacOSXSend.c @@ -22,10 +22,10 @@ * may not get done for awhile. So this sketch is offered for the brave * to attempt if they need the functionality... * - * Copyright (c) 1989-1994 The Regents of the University of California. - * Copyright (c) 1994-1998 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1989-1994 The Regents of the University of California. + * Copyright © 1994-1998 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -209,7 +209,8 @@ Tk_SetAppName( { TkWindow *winPtr = (TkWindow *) tkwin; Tcl_Interp *interp = winPtr->mainPtr->interp; - int i, suffix, offset, result; + int suffix, result; + int i, offset; RegisteredInterp *riPtr, *prevPtr; const char *actualName; Tcl_DString dString; @@ -281,9 +282,9 @@ Tk_SetAppName( * We have found a unique name. Now add it to the registry. */ - riPtr = ckalloc(sizeof(RegisteredInterp)); + riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; - riPtr->name = ckalloc(strlen(actualName) + 1); + riPtr->name = (char *)ckalloc(strlen(actualName) + 1); riPtr->nextPtr = interpListPtr; interpListPtr = riPtr; strcpy(riPtr->name, actualName); @@ -320,7 +321,7 @@ Tk_SetAppName( int Tk_SendObjCmd( - ClientData clientData, /* Used only for deletion */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* The interp we are sending from */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* The arguments */ @@ -461,7 +462,7 @@ Tk_SendObjCmd( int TkGetInterpNames( Tcl_Interp *interp, /* Interpreter for returning a result. */ - Tk_Window tkwin) /* Window whose display is to be used for the + TCL_UNUSED(Tk_Window)) /* Window whose display is to be used for the * lookup. */ { Tcl_Obj *listObjPtr; @@ -498,9 +499,7 @@ TkGetInterpNames( static int SendInit( - Tcl_Interp *interp) /* Interpreter to use for error reporting (no - * errors are ever returned, but the - * interpreter is needed anyway). */ + TCL_UNUSED(Tcl_Interp *)) { return TCL_OK; } diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index 59e3439..a2bbf9f 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -3,9 +3,9 @@ *\ * This file allows the integration of Tk and the Cocoa NSServices API. * - * Copyright (c) 2010-2019 Kevin Walzer/WordTech Communications LLC. - * Copyright (c) 2019 Marc Culler. - * Copyright (c) 2010 Adrian Robert. + * Copyright © 2010-2019 Kevin Walzer/WordTech Communications LLC. + * Copyright © 2019 Marc Culler. + * Copyright © 2010 Adrian Robert. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 9d70d3a..14d0cce 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -3,9 +3,9 @@ * * Implements subwindows for the macintosh version of Tk. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index e520bb0..d9075f7 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -4,10 +4,10 @@ * This file defines the routines for both creating and handling Window * Manager class events for Tk. * - * Copyright 2001-2009, Apple Inc. - * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2015 Kevin Walzer/WordTech Communications LLC. - * Copyright (c) 2015 Marc Culler. + * Copyright © 2001-2009 Apple Inc. + * Copyright © 2005-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2015 Kevin Walzer/WordTech Communications LLC. + * Copyright © 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index c87cd08..e078938 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -5,11 +5,11 @@ * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window manager. * - * Copyright (c) 1994-1997 Sun Microsystems, Inc. - * Copyright (c) 2001-2009, Apple Inc. - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC. - * Copyright (c) 2017-2019 Marc Culler. + * Copyright © 1994-1997 Sun Microsystems, Inc. + * Copyright © 2001-2009, Apple Inc. + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2010 Kevin Walzer/WordTech Communications LLC. + * Copyright © 2017-2019 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -342,6 +342,7 @@ static void RemoveTransient(TkWindow *winPtr); NSRect pointrect = {point, {0,0}}; return [self convertRectToScreen:pointrect].origin; } + - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { NSRect pointrect = {point, {0,0}}; @@ -1173,7 +1174,8 @@ Tk_WmObjCmd( WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; - int index, length; + int index; + int length; char *argv1; TkWindow *winPtr; @@ -1207,10 +1209,10 @@ Tk_WmObjCmd( } if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr) - != TCL_OK) { + != TCL_OK) { return TCL_ERROR; } - if (!Tk_IsTopLevel(winPtr) + if (winPtr && !Tk_IsTopLevel(winPtr) && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't a top-level window", winPtr->pathName)); @@ -1426,7 +1428,7 @@ WmSetAttribute( return TCL_ERROR; } if (boolean != [macWindow isDocumentEdited]) { - [macWindow setDocumentEdited:boolean]; + [macWindow setDocumentEdited:(BOOL)boolean]; } break; case WMATT_NOTIFY: @@ -1577,7 +1579,7 @@ WmGetAttribute( static int WmAttributesCmd( - TCL_UNUSED(Tk_Window), /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index f2ad636..c6857b3 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -3,12 +3,12 @@ * * Tk theme engine for Mac OSX, using the Appearance Manager API. * - * Copyright (c) 2004 Joe English - * Copyright (c) 2005 Neil Madden - * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright 2008-2009, Apple Inc. - * Copyright 2009 Kevin Walzer/WordTech Communications LLC. - * Copyright 2019 Marc Culler + * Copyright © 2004 Joe English + * Copyright © 2005 Neil Madden + * Copyright © 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright © 2008-2009 Apple Inc. + * Copyright © 2009 Kevin Walzer/WordTech Communications LLC. + * Copyright © 2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -332,7 +332,7 @@ static void DrawDownArrow( CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; - y = bounds.origin.y + trunc(bounds.size.height / 2); + y = bounds.origin.y + trunc(bounds.size.height / 2) + 1; CGContextBeginPath(context); CGPoint arrow[3] = { {x, y - size / 4}, {x + size / 2, y + size / 4}, @@ -1085,11 +1085,11 @@ static void DrawDarkTab( } } else { - /* - * This is the selected tab. If it is first, cover up the separator - * line drawn by the second one. (The selected tab is always drawn - * last.) - */ + /* + * This is the selected tab; paint it with the current accent color. + * If it is first, cover up the separator line drawn by the second one. + * (The selected tab is always drawn last.) + */ if ((state & TTK_STATE_FIRST_TAB) && !(state & TTK_STATE_LAST_TAB)) { bounds.size.width += 1; @@ -1388,11 +1388,8 @@ static inline HIThemeButtonDrawInfo computeButtonDrawInfo( static void ButtonElementMinSize( void *clientData, - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), int *minWidth, - int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + int *minHeight) { ThemeButtonParams *params = (ThemeButtonParams *)clientData; @@ -1408,7 +1405,7 @@ static void ButtonElementMinSize( *minHeight += 2; /* - * The minwidth must be 0 to force the generic ttk code to compute the + * For buttons with labels the minwidth must be 0 to force the * correct text layout. For example, a non-zero value will cause the * text to be left justified, no matter what -anchor setting is used in * the style. @@ -1420,7 +1417,7 @@ static void ButtonElementMinSize( static void ButtonElementSize( void *clientData, - void *elementRecord, + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *minWidth, int *minHeight, @@ -1433,8 +1430,7 @@ static void ButtonElementSize( CGRect contentBounds, backgroundBounds; int verticalPad; - ButtonElementMinSize(clientData, elementRecord, tkwin, - minWidth, minHeight, paddingPtr); + ButtonElementMinSize(clientData, minWidth, minHeight); /* * Given a hypothetical bounding rectangle for a button, HIToolbox will @@ -1466,7 +1462,7 @@ static void ButtonElementSize( static void ButtonElementDraw( void *clientData, - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1507,35 +1503,35 @@ static void ButtonElementDraw( } } else { - /* - * Apple's PushButton and PopupButton do not change their fill color - * when the window is inactive. However, except in 10.7 (Lion), the - * color of the arrow button on a PopupButton does change. For some - * reason HITheme fills inactive buttons with a transparent color that - * allows the window background to show through, leading to - * inconsistent behavior. We work around this by filling behind an - * inactive PopupButton with a text background color before asking - * HIToolbox to draw it. For PushButtons, we simply draw them in the - * active state. - */ + /* + * Apple's PushButton and PopupButton do not change their fill color + * when the window is inactive. However, except in 10.7 (Lion), the + * color of the arrow button on a PopupButton does change. For some + * reason HITheme fills inactive buttons with a transparent color that + * allows the window background to show through, leading to + * inconsistent behavior. We work around this by filling behind an + * inactive PopupButton with a text background color before asking + * HIToolbox to draw it. For PushButtons, we simply draw them in the + * active state. + */ - if (info.kind == kThemePopupButton && + if (info.kind == kThemePopupButton && (state & TTK_STATE_BACKGROUND)) { - CGRect innerBounds = CGRectInset(bounds, 1, 1); - NSColor *whiteRGBA = [NSColor whiteColor]; - SolidFillRoundedRectangle(dc.context, innerBounds, 4, whiteRGBA); - } + CGRect innerBounds = CGRectInset(bounds, 1, 1); + NSColor *whiteRGBA = [NSColor whiteColor]; + SolidFillRoundedRectangle(dc.context, innerBounds, 4, whiteRGBA); + } - /* - * A BevelButton with mixed value is drawn borderless, which does make - * much sense for us. - */ + /* + * A BevelButton with mixed value is drawn borderless, which does make + * much sense for us. + */ - if (info.kind == kThemeRoundedBevelButton && + if (info.kind == kThemeRoundedBevelButton && info.value == kThemeButtonMixed) { - info.value = kThemeButtonOff; - info.state = kThemeStateInactive; - } + info.value = kThemeButtonOff; + info.state = kThemeStateInactive; + } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } @@ -1618,10 +1614,10 @@ static Ttk_StateTable TabPositionTable[] = { */ static void TabElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - TCL_UNUSED(int *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ + TCL_UNUSED(int *), /* minWidth */ int *minHeight, Ttk_Padding *paddingPtr) { @@ -1631,8 +1627,8 @@ static void TabElementSize( } static void TabElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1672,19 +1668,19 @@ static Ttk_ElementSpec TabElementSpec = { */ static void PaneElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - TCL_UNUSED(int *), - TCL_UNUSED(int *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ + TCL_UNUSED(int *), /* minWidth */ + TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(9, 5, 9, 9); } static void PaneElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1733,19 +1729,19 @@ static Ttk_ElementSpec PaneElementSpec = { */ static void GroupElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - TCL_UNUSED(int *), - TCL_UNUSED(int *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ + TCL_UNUSED(int *), /* minWidth */ + TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(4); } static void GroupElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1798,11 +1794,11 @@ static Ttk_ElementOptionSpec EntryElementOptions[] = { }; static void EntryElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - TCL_UNUSED(int *), - TCL_UNUSED(int *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ + TCL_UNUSED(int *), /* minWidth */ + TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(7, 5, 7, 6); @@ -1922,8 +1918,8 @@ static Ttk_Padding ComboboxPadding = {4, 4, 20, 4}; static Ttk_Padding DarkComboboxPadding = {6, 6, 22, 6}; static void ComboboxElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, int *minWidth, int *minHeight, @@ -1939,8 +1935,8 @@ static void ComboboxElementSize( } static void ComboboxElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2008,13 +2004,13 @@ static Ttk_ElementSpec ComboboxElementSpec = { static Ttk_Padding SpinbuttonMargins = {0, 0, 2, 0}; -static void SpinButtonUpElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), +static void SpinButtonElementSize( + TCL_UNUSED(void *), /* clientdata */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* PaddingPtr */ { SInt32 s; @@ -2025,8 +2021,8 @@ static void SpinButtonUpElementSize( } static void SpinButtonUpElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2062,28 +2058,13 @@ static Ttk_ElementSpec SpinButtonUpElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, - SpinButtonUpElementSize, + SpinButtonElementSize, SpinButtonUpElementDraw }; -static void SpinButtonDownElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - int *minWidth, - int *minHeight, - TCL_UNUSED(Ttk_Padding *)) -{ - SInt32 s; - - ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s); - *minWidth = s + Ttk_PaddingWidth(SpinbuttonMargins); - ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s); - *minHeight = (s + Ttk_PaddingHeight(SpinbuttonMargins)) / 2; -} static void SpinButtonDownElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2093,7 +2074,7 @@ static void SpinButtonDownElementDraw( int infoState = 0; bounds.origin.y -= bounds.size.height; - bounds.size.height *= 2; + bounds.size.height += bounds.size.height; if (state & TTK_STATE_PRESSED) { infoState = kThemeStatePressedDown; } else { @@ -2121,7 +2102,7 @@ static Ttk_ElementSpec SpinButtonDownElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, - SpinButtonDownElementSize, + SpinButtonElementSize, SpinButtonDownElementDraw }; @@ -2168,11 +2149,11 @@ static Ttk_ElementOptionSpec TrackElementOptions[] = { }; static void TrackElementSize( void *clientData, - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { TrackElementData *data = (TrackElementData *)clientData; SInt32 size = 24; /* reasonable default ... */ @@ -2218,7 +2199,7 @@ static void TrackElementDraw( (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), - .trackInfo.progress.phase = 0, + .trackInfo.progress.phase = 0 }; if (info.kind == kThemeSlider) { @@ -2266,12 +2247,12 @@ static Ttk_ElementSpec TrackElementSpec = { */ static void SliderElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { *minWidth = *minHeight = 24; } @@ -2314,12 +2295,12 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = { {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void PbarElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { SInt32 size = 24; /* @@@ Check HIG for correct default */ @@ -2427,9 +2408,9 @@ static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TroughElementSize( - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ void *elementRecord, - TCL_UNUSED(Tk_Window), + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) @@ -2468,12 +2449,12 @@ static CGFloat darkActiveThumb[4] = { 158.0 / 255, 158.0 / 255, 159.0 / 255, 1.0 }; static void TroughElementDraw( - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, - TCL_UNUSED(Ttk_State)) + TCL_UNUSED(Ttk_State)) /* state */ { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2510,12 +2491,12 @@ static Ttk_ElementSpec TroughElementSpec = { TroughElementDraw }; static void ThumbElementSize( - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ void *elementRecord, - TCL_UNUSED(Tk_Window), + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2531,7 +2512,7 @@ static void ThumbElementSize( } static void ThumbElementDraw( - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2646,12 +2627,12 @@ static Ttk_ElementSpec ThumbElementSpec = { ThumbElementDraw }; static void ArrowElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { if ([NSApp macOSVersion] < 100800) { *minHeight = *minWidth = 14; @@ -2677,19 +2658,19 @@ static Ttk_ElementSpec ArrowElementSpec = { */ static void SeparatorElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { *minWidth = *minHeight = 1; } static void SeparatorElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2729,12 +2710,12 @@ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { HIThemeGrowBoxDrawInfo info = { .version = 0, @@ -2751,9 +2732,9 @@ static void SizegripElementSize( } static void SizegripElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ Drawable d, Ttk_Box b, unsigned int state) @@ -2828,8 +2809,8 @@ static Ttk_ElementSpec SizegripElementSpec = { */ static void FillElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2855,7 +2836,6 @@ static void FillElementDraw( : kThemeBrushModelessDialogBackgroundActive; BEGIN_DRAWING(d) ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation); - //QDSetPatternOrigin(PatternOrigin(tkwin, d)); CGContextFillRect(dc.context, bounds); END_DRAWING } @@ -2903,8 +2883,8 @@ static Ttk_ElementSpec BackgroundElementSpec = { */ static void ToolbarBackgroundElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), @@ -2946,7 +2926,7 @@ static Ttk_ElementOptionSpec FieldElementOptions[] = { }; static void FieldElementDraw( - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2973,7 +2953,7 @@ static Ttk_ElementSpec FieldElementSpec = { /*---------------------------------------------------------------------- * +++ Treeview headers -- * - * On systems older than 10.9 The header is a kThemeListHeaderButton drawn + * On systems older than 10.9 the header is a kThemeListHeaderButton drawn * by HIToolbox. On newer systems those buttons do not match the Apple * buttons, so we draw them from scratch. */ @@ -2996,11 +2976,11 @@ static Ttk_StateTable TreeHeaderAdornmentTable[] = { }; static void TreeAreaElementSize ( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), - TCL_UNUSED(int *), - TCL_UNUSED(int *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ + TCL_UNUSED(int *), /* minWidth */ + TCL_UNUSED(int *), /* minHeight */ Ttk_Padding *paddingPtr) { @@ -3039,7 +3019,7 @@ static void TreeHeaderElementSize( static void TreeHeaderElementDraw( void *clientData, - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -3095,12 +3075,12 @@ static Ttk_StateTable DisclosureValueTable[] = { {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( - TCL_UNUSED(void *), - TCL_UNUSED(void *), - TCL_UNUSED(Tk_Window), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ + TCL_UNUSED(Tk_Window), /* tkwin */ int *minWidth, int *minHeight, - TCL_UNUSED(Ttk_Padding *)) + TCL_UNUSED(Ttk_Padding *)) /* paddingPtr */ { SInt32 s; @@ -3111,8 +3091,8 @@ static void DisclosureElementSize( } static void DisclosureElementDraw( - TCL_UNUSED(void *), - TCL_UNUSED(void *), + TCL_UNUSED(void *), /* clientData */ + TCL_UNUSED(void *), /* elementRecord */ Tk_Window tkwin, Drawable d, Ttk_Box b, |