diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-02 15:29:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-02 15:29:09 (GMT) |
commit | c89a70630558480627dcf1fc39b14106b7eee218 (patch) | |
tree | 4505d2383810b6bb60530d811694f87425ff1397 /macosx | |
parent | 6a3c10d43c1fe5874b42a5b4b2e66beeca3bd0a1 (diff) | |
parent | 4b91535ac926425f7179414f60f6e1c7aed67c36 (diff) | |
download | tk-c89a70630558480627dcf1fc39b14106b7eee218.zip tk-c89a70630558480627dcf1fc39b14106b7eee218.tar.gz tk-c89a70630558480627dcf1fc39b14106b7eee218.tar.bz2 |
Merge trunk
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXColor.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXCursor.c | 29 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 21 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 28 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 8 |
7 files changed, 43 insertions, 59 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ab28fbf..acbfa0e 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -31,7 +31,7 @@ static NSAppearance *lightAqua = nil; static NSAppearance *darkAqua = nil; #endif static NSColorSpace* sRGB = NULL; -static CGFloat windowBackground[4] = +static const CGFloat WINDOWBACKGROUND[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; void initColorTable() @@ -297,7 +297,7 @@ GetRGBA( if ([NSApp macOSVersion] < 101400) { for (int i = 0; i < 3; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 6c36ca7..9371889 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -366,14 +366,13 @@ FindCursorByName( TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - Tk_Window tkwin, /* Window in which cursor will be used. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; int argc; - (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -421,24 +420,16 @@ TkGetCursorByName( TkCursor * TkCreateCursorFromData( - Tk_Window tkwin, /* Window in which cursor will be used. */ - const char *source, /* Bitmap data for cursor shape. */ - const char *mask, /* Bitmap data for cursor mask. */ - int width, int height, /* Dimensions of cursor. */ - int xHot, int yHot, /* Location of hot-spot in cursor. */ - XColor fgColor, /* Foreground color for cursor. */ - XColor bgColor) /* Background color for cursor. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */ + TCL_UNUSED(int), /* Dimensions of cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(int), /* Location of hot-spot in cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(XColor), /* Foreground color for cursor. */ + TCL_UNUSED(XColor)) /* Background color for cursor. */ { - (void)tkwin; - (void)source; - (void)mask; - (void)width; - (void)height; - (void)xHot; - (void)yHot; - (void)fgColor; - (void)bgColor; - return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 1bfd163..8575b10 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -870,15 +870,15 @@ Tk_GetOpenFileObjCmd( selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { - NSUInteger i; + NSUInteger j; - for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { - if (filterCompatible(extension, i)) { - selectedFilterIndex = i; + for (j = 0; j < [filterInfo.fileTypeNames count]; j++) { + if (filterCompatible(extension, j)) { + selectedFilterIndex = j; break; } } - if (i == selectedFilterIndex) { + if (j == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 72c83b4..6c66ed8 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -550,13 +550,12 @@ TkpFontPkgInit( TkFont * TkpGetNativeFont( - Tk_Window tkwin, /* For display where font will be used. */ + TCL_UNUSED(Tk_Window), /* For display where font will be used. */ const char *name) /* Platform-specific font name. */ { MacFont *fontPtr = NULL; ThemeFontID themeFontId; CTFontRef ctFont; - (void)tkwin; if (strcmp(name, SYSTEMFONT_NAME) == 0) { themeFontId = kThemeSystemFont; @@ -700,11 +699,10 @@ TkpDeleteFont( void TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ - Tk_Window tkwin) /* For display to query. */ + TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; - (void)tkwin; for (NSString *family in list) { Tcl_ListObjAppendElement(NULL, resultPtr, @@ -774,7 +772,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ @@ -784,7 +782,6 @@ TkpGetFontAttrsForChar( *faPtr = fontPtr->font.fa; if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) { UTF16Char ch = (UTF16Char) c; - (void)tkwin; nsFont = [nsFont bestMatchingFontForCharacters:&ch length:1 attributes:nil actualCoveredLength:NULL]; @@ -1166,7 +1163,7 @@ TkpDrawCharsInContext( void TkpDrawAngledCharsInContext( - Display *display, /* Display on which to draw. */ + TCL_UNUSED(Display *), /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must @@ -1200,7 +1197,6 @@ TkpDrawAngledCharsInContext( NSFont *nsFont; CGAffineTransform t; CGFloat width, height, textX = (CGFloat) x, textY = (CGFloat) y; - (void)display; if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || @@ -1331,12 +1327,9 @@ TkMacOSXNSFontAttributesForFont( int TkMacOSXIsCharacterMissing( - Tk_Font tkfont, /* The font we are looking in. */ - unsigned int searchChar) /* The character we are looking for. */ + TCL_UNUSED(Tk_Font), /* The font we are looking in. */ + TCL_UNUSED(unsigned int)) /* The character we are looking for. */ { - (void)tkfont; - (void)searchChar; - return 0; } @@ -1375,7 +1368,7 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes( objv[i++] = Tcl_NewStringObj(familyName, -1); objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]); -#define S(s) Tcl_NewStringObj(STRINGIFY(s), (int)(sizeof(STRINGIFY(s))-1)) +#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 67ecba3..236ebbc 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -663,7 +663,7 @@ XKeysymToKeycode( macKC.x.keychar = (unsigned int) data; hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar)); if (hPtr != NULL) { - unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); + data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index ab674af..e36450d 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -36,7 +36,7 @@ #define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \ .flag = ENTRY_##f##_MENU } static const struct { - const char *name; const size_t len; const int flag; + const char *name; size_t len; int flag; } specialMenus[] = { SPECIALMENU(help, HELP), SPECIALMENU(apple, APPLE), @@ -47,8 +47,8 @@ static const struct { #define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f } static const struct { - const char *name; const size_t len; const NSUInteger mask; -} modifiers[] = { + const char *name; size_t len; NSUInteger mask; +} allModifiers[] = { MODIFIER(Control, NSControlKeyMask), MODIFIER(Ctrl, NSControlKeyMask), MODIFIER(Option, NSAlternateKeyMask), @@ -64,7 +64,7 @@ static const struct { #define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c } static const struct { - const char *name; const size_t len; const UniChar ch; + const char *name; size_t len; UniChar ch; } specialAccelerators[] = { ACCEL(PageUp, NSPageUpFunctionKey), ACCEL(PageDown, NSPageDownFunctionKey), @@ -1227,18 +1227,18 @@ ParseAccelerator( *maskPtr = 0; while (1) { i = 0; - while (modifiers[i].name) { - int l = modifiers[i].len; + while (allModifiers[i].name) { + int l = allModifiers[i].len; - if (!strncasecmp(accel, modifiers[i].name, l) && + if (!strncasecmp(accel, allModifiers[i].name, l) && (accel[l] == '-' || accel[l] == '+')) { - *maskPtr |= modifiers[i].mask; + *maskPtr |= allModifiers[i].mask; accel += l+1; break; } i++; } - if (!modifiers[i].name || !*accel) { + if (!allModifiers[i].name || !*accel) { break; } } @@ -1462,14 +1462,14 @@ TkpComputeStandardMenuGeometry( } } else { NSUInteger modifMask = [menuItem keyEquivalentModifierMask]; - int i = 0; + int j = 0; - while (modifiers[i].name) { - if (modifMask & modifiers[i].mask) { - modifMask &= ~modifiers[i].mask; + while (allModifiers[j].name) { + if (modifMask & allModifiers[j].mask) { + modifMask &= ~allModifiers[j].mask; modifierWidth += modifierCharWidth; } - i++; + j++; } accelWidth = [[menuItem keyEquivalent] sizeWithAttributes: TkMacOSXNSFontAttributesForFont(tkfont)].width; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 669ed68..46ccdf3 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -103,11 +103,11 @@ * debug message in case of failure. */ #define ChkErr(f, ...) ({ \ - OSStatus err = f(__VA_ARGS__); \ - if (err != noErr) { \ - TkMacOSXDbgOSErr(f, err); \ + OSStatus err_ = f(__VA_ARGS__); \ + if (err_ != noErr) { \ + TkMacOSXDbgOSErr(f, err_); \ } \ - err;}) + err_;}) #else /* TK_MAC_DEBUG */ #define TKLog(f, ...) |