diff options
Diffstat (limited to 'macosx')
29 files changed, 510 insertions, 510 deletions
diff --git a/macosx/README b/macosx/README index 64be140..c6159a6 100644 --- a/macosx/README +++ b/macosx/README @@ -477,9 +477,9 @@ https://developer.apple.com/library/mac/documentation/Cocoa/\ Reference/ApplicationKit/Classes/NSApplication_Class) void NSApplicationMain(int argc, char *argv[]) { - [NSApplication sharedApplication]; - [NSBundle loadNibNamed:@"myMain" owner:NSApp]; - [NSApp run]; + [NSApplication sharedApplication]; + [NSBundle loadNibNamed:@"myMain" owner:NSApp]; + [NSApp run]; } Here NSApp is a standard global variable, initialized by the OS, which points to an object in a subclass of NSApplication (called diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index f16ab0d..8d5f727 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -126,8 +126,8 @@ TkSelGetSelection( ([[NSPasteboard generalPasteboard] changeCount] != changeCount); if (dispPtr && (haveExternalClip || dispPtr->clipboardActive) - && selection == dispPtr->clipboardAtom - && (target == XA_STRING || target == dispPtr->utf8Atom)) { + && selection == dispPtr->clipboardAtom + && (target == XA_STRING || target == dispPtr->utf8Atom)) { NSString *string = nil; NSPasteboard *pb = [NSPasteboard generalPasteboard]; NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject: diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index cd42be8..436597f 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -52,7 +52,7 @@ static void initColorTable() #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; - lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; + lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; } #endif @@ -103,7 +103,7 @@ static void initColorTable() name = (char *)ckalloc(length + 1); strcpy(name, key.UTF8String); name[0] = (char)toupper(UCHAR(name[0])); - if (!strcmp(name, "WindowBackgroundColor")) { + if (!strcmp(name, "WindowBackgroundColor")) { /* * Avoid black windows on old systems. @@ -192,8 +192,8 @@ TkMacOSXRGBPixel( MacPixel p = {0}; p.pixel.colortype = rgbColor; p.pixel.value = (unsigned int)(((red & 0xff) << 16) | - ((green & 0xff) << 8) | - (blue & 0xff)); + ((green & 0xff) << 8) | + (blue & 0xff)); return p.ulong; } @@ -436,7 +436,7 @@ TkMacOSXInDarkMode(Tk_Window tkwin) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { - TkWindow *winPtr = (TkWindow*) tkwin; + TkWindow *winPtr = (TkWindow*) tkwin; NSAppearanceName name; NSView *view = nil; if (winPtr && winPtr->privatePtr) { diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 6fc98e9..60430be 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -475,7 +475,7 @@ #define DEF_SCROLLBAR_BORDER_WIDTH "0" #define DEF_SCROLLBAR_COMMAND "" #define DEF_SCROLLBAR_CURSOR "" -#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" +#define DEF_SCROLLBAR_EL_BORDER_WIDTH NULL #define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG #define DEF_SCROLLBAR_HIGHLIGHT NORMAL_FG #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index b9b0bcf..8ebdde4 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -419,16 +419,16 @@ XDrawLines( } } - /* - * In the case of closed polylines, the first and last points are the - * same. We want miter or bevel join be rendered also at this point, - * this needs telling CoreGraphics that the path is closed. - */ - - if ((points[0].x == points[npoints-1].x) && - (points[0].y == points[npoints-1].y)) { - CGContextClosePath(dc.context); - } + /* + * In the case of closed polylines, the first and last points are the + * same. We want miter or bevel join be rendered also at this point, + * this needs telling CoreGraphics that the path is closed. + */ + + if ((points[0].x == points[npoints-1].x) && + (points[0].y == points[npoints-1].y)) { + CGContextClosePath(dc.context); + } CGContextStrokePath(dc.context); } TkMacOSXRestoreDrawingContext(&dc); @@ -1330,7 +1330,7 @@ TkMacOSXSetupDrawingContext( }; CGContextConcatCTM(dc.context, t); } -//#if 0 // disable clipping +//#if 0 // disable clipping if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index ef4f44d..f95d5d1 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -850,12 +850,12 @@ EmbedStructureProc( if (eventPtr->type == ConfigureNotify) { /* - * Send a ConfigureNotify to the embedded application. - */ + * Send a ConfigureNotify to the embedded application. + */ - if (containerPtr->embeddedPtr != NULL) { - TkDoConfigureNotify(containerPtr->embeddedPtr); - } + if (containerPtr->embeddedPtr != NULL) { + TkDoConfigureNotify(containerPtr->embeddedPtr); + } if (containerPtr->embedded != None) { /* * Ignore errors, since the embedded application could have diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 4f36915..63493bc 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -35,7 +35,7 @@ enum { switch ((NSInteger)type) { case NSAppKitDefined: - subtype = [theEvent subtype]; + subtype = [theEvent subtype]; switch (subtype) { /* Ignored at the moment. */ @@ -49,11 +49,11 @@ enum { break; case NSWindowMovedEventType: break; - case NSWindowWillMoveEventType: - break; + case NSWindowWillMoveEventType: + break; - default: - break; + default: + break; } break; /* AppkitEvent. Return theEvent */ case NSKeyUp: @@ -80,7 +80,7 @@ enum { break; /* Mouse event. Return the processed event. */ #if 0 case NSSystemDefined: - subtype = [theEvent subtype]; + subtype = [theEvent subtype]; break; case NSApplicationDefined: { id win; @@ -88,14 +88,14 @@ enum { break; } case NSCursorUpdate: - break; + break; case NSEventTypeGesture: case NSEventTypeMagnify: case NSEventTypeRotate: case NSEventTypeSwipe: case NSEventTypeBeginGesture: case NSEventTypeEndGesture: - break; + break; #endif default: diff --git a/macosx/tkMacOSXFileTypes.c b/macosx/tkMacOSXFileTypes.c index 5df7ddd..acf2da9 100644 --- a/macosx/tkMacOSXFileTypes.c +++ b/macosx/tkMacOSXFileTypes.c @@ -26,9 +26,9 @@ without generating deprecation warnings. #include "tkMacOSXPrivate.h" #define CHARS_TO_OSTYPE(string) (OSType) string[0] << 24 | \ - (OSType) string[1] << 16 | \ - (OSType) string[2] << 8 | \ - (OSType) string[3] + (OSType) string[1] << 16 | \ + (OSType) string[2] << 8 | \ + (OSType) string[3] MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) { char string[5]; diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 8e1fff5..0d07fdf 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -307,34 +307,34 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef"; /* * This descriptor can be coerced to a file url. Construct a Tcl * expression which passes the file path as a string argument to - * ::tk::mac::DoScriptFile. + * ::tk::mac::DoScriptFile. */ if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeFileURL, &type, - (Ptr) URLBuffer, URL_MAX_LENGTH, &actual)) { - if (actual > 0) { - URLBuffer[actual] = '\0'; - NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; - NSURL *fileURL = [NSURL URLWithString:urlString]; - AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); - Tcl_DString *scriptFileCommand = &AEInfo->command; - Tcl_DStringInit(scriptFileCommand); - Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE); - Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]); - AEInfo->interp = _eventInterp; - AEInfo->procedure = scriptFileProc; - AEInfo->replyEvent = nil; + (Ptr) URLBuffer, URL_MAX_LENGTH, &actual)) { + if (actual > 0) { + URLBuffer[actual] = '\0'; + NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; + NSURL *fileURL = [NSURL URLWithString:urlString]; + AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); + Tcl_DString *scriptFileCommand = &AEInfo->command; + Tcl_DStringInit(scriptFileCommand); + Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE); + Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]); + AEInfo->interp = _eventInterp; + AEInfo->procedure = scriptFileProc; + AEInfo->replyEvent = nil; AEInfo->retryCount = 0; - ProcessAppleEvent((void *)AEInfo); - } - } + ProcessAppleEvent((void *)AEInfo); + } + } } else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, NULL, 0, &actual)) { - /* - * The descriptor cannot be coerced to a file URL but can be coerced to - * text. Construct a Tcl expression which passes the text as a string - * argument to ::tk::mac::DoScriptText. - */ + /* + * The descriptor cannot be coerced to a file URL but can be coerced to + * text. Construct a Tcl expression which passes the text as a string + * argument to ::tk::mac::DoScriptText. + */ if (actual > 0) { char *data = (char *)ckalloc(actual + 1); @@ -350,23 +350,23 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef"; AEInfo->interp = _eventInterp; AEInfo->procedure = scriptTextProc; AEInfo->retryCount = 0; - if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) { - AEInfo->replyEvent = replyEvent; - ProcessAppleEvent(AEInfo); - } else { - AEInfo->replyEvent = nil; - ProcessAppleEvent(AEInfo); - } + if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) { + AEInfo->replyEvent = replyEvent; + ProcessAppleEvent(AEInfo); + } else { + AEInfo->replyEvent = nil; + ProcessAppleEvent(AEInfo); + } } } } } - (void)handleURLEvent:(NSAppleEventDescriptor*)event - withReplyEvent:(NSAppleEventDescriptor*)replyEvent + withReplyEvent:(NSAppleEventDescriptor*)replyEvent { NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] - stringValue]; + stringValue]; const char *cURL=[url UTF8String]; AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo)); Tcl_DString *launchCommand = &AEInfo->command; @@ -456,18 +456,18 @@ static void ProcessAppleEvent( Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL); if (AEInfo->replyEvent && code >= 0) { - Tcl_Size reslen; - const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(AEInfo->interp), - &reslen); - if (code == TCL_OK) { - AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], - keyDirectObject, typeChar, result, reslen); - } else { - AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], - keyErrorString, typeChar, result, reslen); - AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], - keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int)); - } + Tcl_Size reslen; + const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(AEInfo->interp), + &reslen); + if (code == TCL_OK) { + AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], + keyDirectObject, typeChar, result, reslen); + } else { + AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], + keyErrorString, typeChar, result, reslen); + AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc], + keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int)); + } } else if (code != TCL_OK) { Tcl_BackgroundException(AEInfo->interp, code); } @@ -537,8 +537,8 @@ TkMacOSXInitAppleEvents( /* * We do not load our sdef dynamically but this event handler - * is required to silence error messages from inline execution - * of AppleScript at the Objective-C level. + * is required to silence error messages from inline execution + * of AppleScript at the Objective-C level. */ [aeManager setEventHandler:NSApp andSelector:@selector(handleGetSDEFEvent:withReplyEvent:) diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 87d1276..488f029 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -1012,7 +1012,7 @@ XCopyPlane( TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask; unsigned long imageBackground = gc->background; - if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) { + if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) { srcRect = CGRectMake(src_x, src_y, width, height); CGImageRef mask = CreateCGImageFromPixmap( clipPtr->value.pixmap); @@ -1387,7 +1387,7 @@ TkMacOSXNSImageConfigureModel( case NAME_SOURCE: Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown named NSImage.\n" "Try omitting ImageName, " - "e.g. use NSCaution for NSImageNameCaution.", TCL_INDEX_NONE)); + "e.g. use NSCaution for NSImageNameCaution.", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL); goto errorExit; case FILE_SOURCE: @@ -1491,9 +1491,9 @@ TkMacOSXNSImageObjCmd( objPtr = Tk_GetOptionValue(interp, (char *)modelPtr, optionTable, objv[2], NULL); if (objPtr == NULL) { - goto error; - } - Tcl_SetObjResult(interp, objPtr); + goto error; + } + Tcl_SetObjResult(interp, objPtr); break; case CONFIGURE: if (objc == 2) { diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index b1f6855..bbd41ee 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -386,7 +386,7 @@ static void closePanels( [[NSFontPanel sharedFontPanel] orderOut:nil]; } if ([NSColorPanel sharedColorPanelExists]) { - [[NSColorPanel sharedColorPanel] orderOut:nil]; + [[NSColorPanel sharedColorPanel] orderOut:nil]; } } @@ -425,9 +425,9 @@ TCL_NORETURN void TkpExitProc( /* * At this point it is too late to be looking up the Tk window associated * to any NSWindows, but it can happen. This makes sure the answer is None - * if such a query is attempted. + * if such a query is attempted. */ - + for (TKWindow *w in [NSApp orderedWindows]) { if ([w respondsToSelector: @selector (tkWindow)]) { [w setTkWindow: None]; @@ -475,7 +475,7 @@ TkpInit( if (!initialized) { struct stat st; Bool shouldOpenConsole = NO; - Bool stdinIsNullish = (!isatty(0) && + Bool stdinIsNullish = (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0))); /* @@ -499,7 +499,7 @@ TkpInit( if (Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 0, PATH_MAX, tkLibPath) != TCL_OK) { - # if 0 /* This is not really an error. Wish still runs fine. */ + # if 0 /* This is not really an error. Wish still runs fine. */ TkMacOSXDbgMsg("Tcl_MacOSXOpenVersionedBundleResources failed"); # endif } @@ -521,40 +521,40 @@ TkpInit( [TKApplication sharedApplication]; [pool drain]; - /* - * WARNING: The finishLaunching method runs asynchronously. This - * creates a race between the initialization of the NSApplication and - * the initialization of Tk. If Tk wins the race bad things happen - * with the root window (see below). If the NSApplication wins then an - * AppleEvent created during launch, e.g. by dropping a file icon on - * the application icon, will be delivered before the procedure meant - * to to handle the AppleEvent has been defined. This is handled in - * tkMacOSXHLEvents.c by scheduling a timer event to handle the - * AppleEvent later, after the required procedure has been defined. - */ + /* + * WARNING: The finishLaunching method runs asynchronously. This + * creates a race between the initialization of the NSApplication and + * the initialization of Tk. If Tk wins the race bad things happen + * with the root window (see below). If the NSApplication wins then an + * AppleEvent created during launch, e.g. by dropping a file icon on + * the application icon, will be delivered before the procedure meant + * to to handle the AppleEvent has been defined. This is handled in + * tkMacOSXHLEvents.c by scheduling a timer event to handle the + * AppleEvent later, after the required procedure has been defined. + */ [NSApp _setup:interp]; [NSApp finishLaunching]; - /* - * Create a Tk event source based on the Appkit event queue. - */ + /* + * Create a Tk event source based on the Appkit event queue. + */ Tk_MacOSXSetupTkNotifier(); /* * If Tk initialization wins the race, the root window is mapped before - * the NSApplication is initialized. This can cause bad things to - * happen. The root window can open off screen with no way to make it - * appear on screen until the app icon is clicked. This will happen if - * a Tk application opens a modal window in its startup script (see - * ticket 56a1823c73). In other cases, an empty root window can open - * on screen and remain visible for a noticeable amount of time while - * the Tk initialization finishes (see ticket d1989fb7cf). The call - * below forces Tk to block until the Appkit event queue has been - * created. This seems to be sufficient to ensure that the - * NSApplication initialization wins the race, avoiding these bad - * window behaviors. + * the NSApplication is initialized. This can cause bad things to + * happen. The root window can open off screen with no way to make it + * appear on screen until the app icon is clicked. This will happen if + * a Tk application opens a modal window in its startup script (see + * ticket 56a1823c73). In other cases, an empty root window can open + * on screen and remain visible for a noticeable amount of time while + * the Tk initialization finishes (see ticket d1989fb7cf). The call + * below forces Tk to block until the Appkit event queue has been + * created. This seems to be sufficient to ensure that the + * NSApplication initialization wins the race, avoiding these bad + * window behaviors. */ Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT); @@ -679,7 +679,7 @@ TkpInit( Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPathObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::macOSVersion", - TkMacOSVersionObjCmd, NULL, NULL); + TkMacOSVersionObjCmd, NULL, NULL); MacSystrayInit(interp); MacPrint_Init(interp); diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index a16eb42..42698ca 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -64,8 +64,8 @@ static NSUInteger textInputModifiers; static NSMutableArray *nsEvArray = nil; if (nsEvArray == nil) { - nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1]; - processingCompose = NO; + nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1]; + processingCompose = NO; } if (!winPtr) { return theEvent; @@ -80,7 +80,7 @@ static NSUInteger textInputModifiers; if ([theEvent type] == NSKeyDown && [theEvent isARepeat] && [NSEvent keyRepeatDelay] < 0) { - return theEvent; + return theEvent; } /* @@ -311,7 +311,7 @@ static NSUInteger textInputModifiers; Bool sendingIMEText = NO; str = ([aString isKindOfClass: [NSAttributedString class]]) ? - [aString string] : aString; + [aString string] : aString; len = [str length]; if (NS_KEYLOG) { @@ -426,7 +426,7 @@ static NSUInteger textInputModifiers; (void)selRange; str = ([aString isKindOfClass: [NSAttributedString class]]) ? - [aString string] : aString; + [aString string] : aString; if (focusWin) { /* @@ -636,12 +636,12 @@ setupXEvent(XEvent *xEvent, Tk_Window tkwin, NSUInteger modifiers) display = Tk_Display(tkwin); if (modifiers) { state = (modifiers & NSAlphaShiftKeyMask ? LockMask : 0) | - (modifiers & NSShiftKeyMask ? ShiftMask : 0) | - (modifiers & NSControlKeyMask ? ControlMask : 0) | - (modifiers & NSCommandKeyMask ? Mod1Mask : 0) | - (modifiers & NSAlternateKeyMask ? Mod2Mask : 0) | - (modifiers & NSNumericPadKeyMask ? Mod3Mask : 0) | - (modifiers & NSFunctionKeyMask ? Mod4Mask : 0) ; + (modifiers & NSShiftKeyMask ? ShiftMask : 0) | + (modifiers & NSControlKeyMask ? ControlMask : 0) | + (modifiers & NSCommandKeyMask ? Mod1Mask : 0) | + (modifiers & NSAlternateKeyMask ? Mod2Mask : 0) | + (modifiers & NSNumericPadKeyMask ? Mod3Mask : 0) | + (modifiers & NSFunctionKeyMask ? Mod4Mask : 0) ; } memset(xEvent, 0, sizeof(XEvent)); xEvent->xany.serial = LastKnownRequestProcessed(display); diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 3874dbd..f898496 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -268,7 +268,7 @@ UpdateKeymaps() */ for (index = 3; index >= 0; index--) { - for (virt = 0; virt < 128; virt++) { + for (virt = 0; virt < 128; virt++) { MacKeycode macKC; macKC.v = (keycode_v) {.virt = virt, .o_s = index, .keychar = 0}; int modifiers = INDEX2CARBON(index); @@ -288,7 +288,7 @@ UpdateKeymaps() hPtr = Tcl_CreateHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(macKC.x.xvirtual)); - } + } xvirtual2unichar[macKC.x.xvirtual] = macKC.x.keychar; } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 8a8d613..bf41d66 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -969,8 +969,8 @@ TkpPostMenu( inPostMenu = true; result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { - inPostMenu = false; - return result; + inPostMenu = false; + return result; } if (itemIndex >= numItems) { itemIndex = numItems - 1; diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index ac7befd..6d71ffc 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -173,7 +173,7 @@ TkpDisplayMenuButton( butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { - return; + return; } pixmap = (Pixmap) Tk_WindowId(tkwin); @@ -191,7 +191,7 @@ TkpDisplayMenuButton( */ if (butPtr->highlightWidth < 3) { - if (butPtr->flags & GOT_FOCUS) { + if (butPtr->flags & GOT_FOCUS) { GC gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); TkMacOSXDrawSolidBorder(tkwin, gc, 0, butPtr->highlightWidth); } @@ -259,23 +259,23 @@ TkpComputeMenuButtonGeometry( avgWidth = 0; if (butPtr->image != NULL) { - Tk_SizeOfImage(butPtr->image, &width, &height); - haveImage = 1; + Tk_SizeOfImage(butPtr->image, &width, &height); + haveImage = 1; } else if (butPtr->bitmap != None) { - Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); - haveImage = 1; + Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); + haveImage = 1; } if (butPtr->text && strlen(butPtr->text) > 0) { haveText = 1; - Tk_FreeTextLayout(butPtr->textLayout); - butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, - butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength, - butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); - txtWidth = butPtr->textWidth; - txtHeight = butPtr->textHeight; - avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); - Tk_GetFontMetrics(butPtr->tkfont, &fm); + Tk_FreeTextLayout(butPtr->textLayout); + butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, + butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength, + butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); + txtWidth = butPtr->textWidth; + txtHeight = butPtr->textHeight; + avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); + Tk_GetFontMetrics(butPtr->tkfont, &fm); } /* @@ -286,7 +286,7 @@ TkpComputeMenuButtonGeometry( */ if (haveImage && haveText) { - switch ((enum compound) butPtr->compound) { + switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* @@ -315,33 +315,33 @@ TkpComputeMenuButtonGeometry( break; case COMPOUND_NONE: break; - } + } - if (butPtr->width > 0) { - width = butPtr->width; - } - if (butPtr->height > 0) { - height = butPtr->height; - } + if (butPtr->width > 0) { + width = butPtr->width; + } + if (butPtr->height > 0) { + height = butPtr->height; + } } else { - if (haveImage) { /* Image only */ - if (butPtr->width > 0) { - width = butPtr->width; - } - if (butPtr->height > 0) { - height = butPtr->height; - } - } else { /* Text only */ - width = txtWidth; - height = txtHeight; - if (butPtr->width > 0) { - width = butPtr->width * avgWidth + 2*butPtr->padX; - } - if (butPtr->height > 0) { - height = butPtr->height * fm.linespace + 2*butPtr->padY; - } - } + if (haveImage) { /* Image only */ + if (butPtr->width > 0) { + width = butPtr->width; + } + if (butPtr->height > 0) { + height = butPtr->height; + } + } else { /* Text only */ + width = txtWidth; + height = txtHeight; + if (butPtr->width > 0) { + width = butPtr->width * avgWidth + 2*butPtr->padX; + } + if (butPtr->height > 0) { + height = butPtr->height * fm.linespace + 2*butPtr->padY; + } + } } butPtr->inset = highlightWidth + butPtr->borderWidth; @@ -381,30 +381,30 @@ DrawMenuButtonImageAndText( int fullWidth = 0, fullHeight = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } DrawParams *dpPtr = &mbPtr->drawParams; pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != NULL) { - Tk_SizeOfImage(butPtr->image, &width, &height); - haveImage = 1; + Tk_SizeOfImage(butPtr->image, &width, &height); + haveImage = 1; } else if (butPtr->bitmap != None) { - Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); - haveImage = 1; + Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); + haveImage = 1; } haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { - int x = 0, y = 0; + int x = 0, y = 0; - textXOffset = 0; - textYOffset = 0; - fullWidth = 0; - fullHeight = 0; + textXOffset = 0; + textYOffset = 0; + fullWidth = 0; + fullHeight = 0; - switch ((enum compound) butPtr->compound) { + switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* @@ -435,7 +435,7 @@ DrawMenuButtonImageAndText( } fullWidth = butPtr->textWidth + butPtr->padX + width; fullHeight = (height > butPtr->textHeight ? height : - butPtr->textHeight); + butPtr->textHeight); textYOffset = (fullHeight - butPtr->textHeight)/2; imageYOffset = (fullHeight - height)/2; break; @@ -446,7 +446,7 @@ DrawMenuButtonImageAndText( fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth); fullHeight = (height > butPtr->textHeight ? height : - butPtr->textHeight); + butPtr->textHeight); textXOffset = (fullWidth - butPtr->textWidth) / 2; imageXOffset = (fullWidth - width) / 2; textYOffset = (fullHeight - butPtr->textHeight) / 2; @@ -456,54 +456,54 @@ DrawMenuButtonImageAndText( break; } - TkComputeAnchor(butPtr->anchor, tkwin, - butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset, - fullWidth, fullHeight, &x, &y); - imageXOffset = LEFT_INSET; - imageYOffset += y; - textYOffset -= 1; + TkComputeAnchor(butPtr->anchor, tkwin, + butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset, + fullWidth, fullHeight, &x, &y); + imageXOffset = LEFT_INSET; + imageYOffset += y; + textYOffset -= 1; - if (butPtr->image != NULL) { + if (butPtr->image != NULL) { Tk_RedrawImage(butPtr->image, 0, 0, width, - height, pixmap, imageXOffset, imageYOffset); - } else { - XSetClipOrigin(butPtr->display, dpPtr->gc, - imageXOffset, imageYOffset); - XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, - 0, 0, (unsigned int) width, (unsigned int) height, - imageXOffset, imageYOffset, 1); - XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); - } - - Tk_DrawTextLayout(butPtr->display, pixmap, - dpPtr->gc, butPtr->textLayout, - x + textXOffset, y + textYOffset, 0, -1); - Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, x + textXOffset, y + textYOffset, - butPtr->underline); + height, pixmap, imageXOffset, imageYOffset); + } else { + XSetClipOrigin(butPtr->display, dpPtr->gc, + imageXOffset, imageYOffset); + XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, + 0, 0, (unsigned int) width, (unsigned int) height, + imageXOffset, imageYOffset, 1); + XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); + } + + Tk_DrawTextLayout(butPtr->display, pixmap, + dpPtr->gc, butPtr->textLayout, + x + textXOffset, y + textYOffset, 0, -1); + Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, + butPtr->textLayout, x + textXOffset, y + textYOffset, + butPtr->underline); } else { int x, y; - if (haveImage) { - TkComputeAnchor(butPtr->anchor, tkwin, - butPtr->padX + butPtr->borderWidth, - butPtr->padY + butPtr->borderWidth, - width, height, &x, &y); + if (haveImage) { + TkComputeAnchor(butPtr->anchor, tkwin, + butPtr->padX + butPtr->borderWidth, + butPtr->padY + butPtr->borderWidth, + width, height, &x, &y); imageXOffset = LEFT_INSET; imageYOffset += y; if (butPtr->image != NULL) { Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); - } else { - XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); - XCopyPlane(butPtr->display, butPtr->bitmap, + } else { + XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); + XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); - XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); - } - } else { + XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); + } + } else { textXOffset = LEFT_INSET; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, butPtr->textWidth, butPtr->textHeight, &x, &y); @@ -537,7 +537,7 @@ TkMacOSXDrawMenuButton( MacMenuButton *mbPtr, /* Mac menubutton. */ TCL_UNUSED(GC), /* The GC we are drawing into - not used */ Pixmap pixmap) /* The pixmap we are drawing into - needed for the - * bevel button */ + * bevel button */ { TkMenuButton *butPtr = (TkMenuButton *) mbPtr; TkWindow *winPtr = (TkWindow *) butPtr->tkwin; @@ -552,23 +552,23 @@ TkMacOSXDrawMenuButton( Tk_Width(butPtr->tkwin), Tk_Height(butPtr->tkwin)); if (useNewerHITools == 1) { - HIRect contHIRec; - static HIThemeButtonDrawInfo hiinfo; + HIRect contHIRec; + static HIThemeButtonDrawInfo hiinfo; - MenuButtonBackgroundDrawCB(mbPtr, 32, true); + MenuButtonBackgroundDrawCB(mbPtr, 32, true); if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } - hiinfo.version = 0; - hiinfo.state = mbPtr->drawinfo.state; - hiinfo.kind = mbPtr->btnkind; - hiinfo.value = mbPtr->drawinfo.value; - hiinfo.adornment = mbPtr->drawinfo.adornment; - hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); - if (hiinfo.animation.time.start == 0) { - hiinfo.animation.time.start = hiinfo.animation.time.current; - } + hiinfo.version = 0; + hiinfo.state = mbPtr->drawinfo.state; + hiinfo.kind = mbPtr->btnkind; + hiinfo.value = mbPtr->drawinfo.value; + hiinfo.adornment = mbPtr->drawinfo.adornment; + hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); + if (hiinfo.animation.time.start == 0) { + hiinfo.animation.time.start = hiinfo.animation.time.current; + } /* * To avoid menubuttons with white text on a white background, we @@ -581,10 +581,10 @@ TkMacOSXDrawMenuButton( hiinfo.state = kThemeStateInactive; } - HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, + HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); - MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo, + MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo, mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { @@ -623,11 +623,11 @@ MenuButtonBackgroundDrawCB ( Pixmap pixmap; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } pixmap = (Pixmap) Tk_WindowId(tkwin); Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, - Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); + Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } /* @@ -658,7 +658,7 @@ MenuButtonContentDrawCB ( Tk_Window tkwin = butPtr->tkwin; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } DrawMenuButtonImageAndText(butPtr); } @@ -749,22 +749,22 @@ TkMacOSXComputeMenuButtonParams( drawinfo->state = kThemeStateInactive; if ((mbPtr->flags & ACTIVE) == 0) { - if (butPtr->state == STATE_DISABLED) { - drawinfo->state = kThemeStateUnavailableInactive; - } else { - drawinfo->state = kThemeStateInactive; - } + if (butPtr->state == STATE_DISABLED) { + drawinfo->state = kThemeStateUnavailableInactive; + } else { + drawinfo->state = kThemeStateInactive; + } } else if (butPtr->state == STATE_DISABLED) { - drawinfo->state = kThemeStateUnavailable; + drawinfo->state = kThemeStateUnavailable; } else { - drawinfo->state = kThemeStateActive; + drawinfo->state = kThemeStateActive; } drawinfo->adornment = kThemeAdornmentNone; if (butPtr->highlightWidth >= 3) { - if ((butPtr->flags & GOT_FOCUS)) { - drawinfo->adornment |= kThemeAdornmentFocus; - } + if ((butPtr->flags & GOT_FOCUS)) { + drawinfo->adornment |= kThemeAdornmentFocus; + } } drawinfo->adornment |= kThemeAdornmentArrowDoubleArrow; } @@ -795,12 +795,12 @@ TkMacOSXComputeMenuButtonDrawParams( ((butPtr->image != NULL) || (butPtr->bitmap != None)); dpPtr->border = butPtr->normalBorder; if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) { - dpPtr->gc = butPtr->disabledGC; + dpPtr->gc = butPtr->disabledGC; } else if (butPtr->state == STATE_ACTIVE) { - dpPtr->gc = butPtr->activeTextGC; - dpPtr->border = butPtr->activeBorder; + dpPtr->gc = butPtr->activeTextGC; + dpPtr->border = butPtr->activeBorder; } else { - dpPtr->gc = butPtr->normalTextGC; + dpPtr->gc = butPtr->normalTextGC; } } diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index b1b8bad..b717352 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -116,18 +116,18 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); _defaultWindowsMenuItems = [_defaultWindowsMenuItems arrayByAddingObjectsFromArray: [NSArray arrayWithObjects: - [NSMenuItem separatorItem], + [NSMenuItem separatorItem], [NSMenuItem itemWithTitle:@"Show Previous Tab" - action:@selector(selectPreviousTab:) - target:nil + action:@selector(selectPreviousTab:) + target:nil keyEquivalent:@"\t" - keyEquivalentModifierMask: + keyEquivalentModifierMask: NSControlKeyMask|NSShiftKeyMask], - [NSMenuItem itemWithTitle:@"Show Next Tab" - action:@selector(selectNextTab:) - target:nil + [NSMenuItem itemWithTitle:@"Show Next Tab" + action:@selector(selectNextTab:) + target:nil keyEquivalent:@"\t" - keyEquivalentModifierMask:NSControlKeyMask], + keyEquivalentModifierMask:NSControlKeyMask], [NSMenuItem itemWithTitle:@"Move Tab To New Window" action:@selector(moveTabToNewWindow:) target:nil], @@ -135,7 +135,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); action:@selector(mergeAllWindows:) target:nil], [NSMenuItem separatorItem], - nil]]; + nil]]; } _defaultWindowsMenuItems = [_defaultWindowsMenuItems arrayByAddingObject: [NSMenuItem itemWithTitle:@"Bring All to Front" @@ -193,7 +193,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); } return haveDemo; } else { - return [super validateUserInterfaceItem:anItem]; + return [super validateUserInterfaceItem:anItem]; } } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 9eca985..062a125 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -884,9 +884,9 @@ TkpWarpPointer( CGWarpMouseCursorPosition(pt); if (dispPtr->warpWindow) { - TkGenerateButtonEventForXPointer(Tk_WindowId(dispPtr->warpWindow)); + TkGenerateButtonEventForXPointer(Tk_WindowId(dispPtr->warpWindow)); } else { - TkGenerateButtonEventForXPointer(None); + TkGenerateButtonEventForXPointer(None); } } diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 5530e22..f353380 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -361,7 +361,7 @@ TkMacOSXDrawAllViews( if (dirtyCount) { *dirtyCount = count; } - + /* * Trigger calls to updateLayer methods for the views flagged above. */ @@ -436,7 +436,7 @@ TkMacOSXEventsSetupProc( */ NSEvent *currentEvent = - [NSApp nextEventMatchingMask:NSAnyEventMask + [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(TkMacOSXGetModalSession()) dequeue:NO]; diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c index ee30e1f..ac29714 100644 --- a/macosx/tkMacOSXPrint.c +++ b/macosx/tkMacOSXPrint.c @@ -92,8 +92,8 @@ StartPrint( /* Check for proper number of arguments. */ if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "file"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "file"); + return TCL_ERROR; } fileName = [NSString stringWithUTF8String: Tcl_GetString(objv[1])]; @@ -105,20 +105,20 @@ StartPrint( status = PMCreateSession( & printSession); if (status != noErr) { - NSLog(@ "Error creating print session."); - return TCL_ERROR; + NSLog(@ "Error creating print session."); + return TCL_ERROR; } status = PMCreatePrintSettings( & printSettings); if (status != noErr) { - NSLog(@ "Error creating print settings."); - return TCL_ERROR; + NSLog(@ "Error creating print settings."); + return TCL_ERROR; } status = PMSessionDefaultPrintSettings(printSession, printSettings); if (status != noErr) { - NSLog(@ "Error creating default print settings."); - return TCL_ERROR; + NSLog(@ "Error creating default print settings."); + return TCL_ERROR; } printSession = (PMPrintSession)[printInfo PMPrintSession]; @@ -163,25 +163,25 @@ FinishPrint( * otherwise printing will occur regardless of value. */ if (buttonValue == NSModalResponseCancel) { - return noErr; + return noErr; } status = PMCreateSession( & printSession); if (status != noErr) { - NSLog(@ "Error creating print session."); - return status; + NSLog(@ "Error creating print session."); + return status; } status = PMCreatePrintSettings( & printSettings); if (status != noErr) { - NSLog(@ "Error creating print settings."); - return status; + NSLog(@ "Error creating print settings."); + return status; } status = PMSessionDefaultPrintSettings(printSession, printSettings); if (status != noErr) { - NSLog(@ "Error creating default print settings."); - return status; + NSLog(@ "Error creating default print settings."); + return status; } printSession = (PMPrintSession)[printInfo PMPrintSession]; @@ -191,81 +191,81 @@ FinishPrint( /*Handle print operation.*/ if (buttonValue == NSModalResponseOK) { - if (urlFile == NULL) { - NSLog(@ "Could not get file to print."); - return noErr; - } - - fileName = file; - - CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false); - - PMPrinter currentPrinter; - PMDestinationType printDestination; - - /*Get the intended destination.*/ - status = PMSessionGetDestinationType(printSession, printSettings, & printDestination); - - /*Destination is printer. Send file to printer.*/ - if (status == noErr && printDestination == kPMDestinationPrinter) { - - status = PMSessionGetCurrentPrinter(printSession, & currentPrinter); - if (status == noErr) { - CFArrayRef mimeTypes; - status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes); - if (status == noErr && mimeTypes != NULL) { - mimeType = CFSTR("application/pdf"); - if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) { - status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL); - CFRelease(urlFile); - return status; - } - } - } - } - - /* Destination is file. Determine how to handle. */ - if (status == noErr && printDestination == kPMDestinationFile) { - CFURLRef outputLocation = NULL; - - status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation); - if (status == noErr) { - /*Get the source file and target destination, convert to strings.*/ - CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); - CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle); - NSString * sourcePath = (NSString * ) sourceFile; - NSString * finalPath = (NSString * ) savePath; - NSString * pathExtension = [finalPath pathExtension]; - NSFileManager * fileManager = [NSFileManager defaultManager]; + if (urlFile == NULL) { + NSLog(@ "Could not get file to print."); + return noErr; + } + + fileName = file; + + CFURLRef printURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlFile, kCFURLPOSIXPathStyle, false); + + PMPrinter currentPrinter; + PMDestinationType printDestination; + + /*Get the intended destination.*/ + status = PMSessionGetDestinationType(printSession, printSettings, & printDestination); + + /*Destination is printer. Send file to printer.*/ + if (status == noErr && printDestination == kPMDestinationPrinter) { + + status = PMSessionGetCurrentPrinter(printSession, & currentPrinter); + if (status == noErr) { + CFArrayRef mimeTypes; + status = PMPrinterGetMimeTypes(currentPrinter, printSettings, & mimeTypes); + if (status == noErr && mimeTypes != NULL) { + mimeType = CFSTR("application/pdf"); + if (CFArrayContainsValue(mimeTypes, CFRangeMake(0, CFArrayGetCount(mimeTypes)), mimeType)) { + status = PMPrinterPrintWithFile(currentPrinter, printSettings, pageFormat, mimeType, printURL); + CFRelease(urlFile); + return status; + } + } + } + } + + /* Destination is file. Determine how to handle. */ + if (status == noErr && printDestination == kPMDestinationFile) { + CFURLRef outputLocation = NULL; + + status = PMSessionCopyDestinationLocation(printSession, printSettings, & outputLocation); + if (status == noErr) { + /*Get the source file and target destination, convert to strings.*/ + CFStringRef sourceFile = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); + CFStringRef savePath = CFURLCopyFileSystemPath(outputLocation, kCFURLPOSIXPathStyle); + NSString * sourcePath = (NSString * ) sourceFile; + NSString * finalPath = (NSString * ) savePath; + NSString * pathExtension = [finalPath pathExtension]; + NSFileManager * fileManager = [NSFileManager defaultManager]; NSError * error = nil; - /* + /* * Is the target file a PDF? If so, copy print file * to output location. */ - if ([pathExtension isEqualToString: @ "pdf"]) { + if ([pathExtension isEqualToString: @ "pdf"]) { /*Make sure no file conflict exists.*/ if ([fileManager fileExistsAtPath: finalPath]) { [fileManager removeItemAtPath: finalPath error: &error]; } - if ([fileManager fileExistsAtPath: sourcePath]) { - error = nil; - [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error]; - } + if ([fileManager fileExistsAtPath: sourcePath]) { + error = nil; + [fileManager copyItemAtPath: sourcePath toPath: finalPath error: & error]; + } return status; - } - - /* - * Is the target file PostScript? If so, run print file - * through CUPS filter to convert back to PostScript. - */ - - if ([pathExtension isEqualToString: @ "ps"]) { - char source[5012]; - char target[5012]; - [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding]; - [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding]; + } + + /* + * Is the target file PostScript? If so, run print file + * through CUPS filter to convert back to PostScript. + */ + + if ([pathExtension isEqualToString: @ "ps"]) { + char source[5012]; + char target[5012]; + [sourcePath getCString: source maxLength: (sizeof source) encoding: NSUTF8StringEncoding]; + [finalPath getCString: target maxLength: (sizeof target) encoding: NSUTF8StringEncoding]; /*Make sure no file conflict exists.*/ if ([fileManager fileExistsAtPath: finalPath]) { [fileManager removeItemAtPath: finalPath error: &error]; @@ -290,39 +290,39 @@ FinishPrint( } } - /* Destination is preview. Open file in default application for PDF. */ - if ((status == noErr) && (printDestination == kPMDestinationPreview)) { - CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); - NSString * path = (NSString * ) urlpath; - NSURL * url = [NSURL fileURLWithPath: path]; - NSWorkspace * ws = [NSWorkspace sharedWorkspace]; - [ws openURL: url]; - status = noErr; - return status; - } - - /* - * If destination is not printer, file or preview, - * we do not support it. Display alert. - */ + /* Destination is preview. Open file in default application for PDF. */ + if ((status == noErr) && (printDestination == kPMDestinationPreview)) { + CFStringRef urlpath = CFURLCopyFileSystemPath(printURL, kCFURLPOSIXPathStyle); + NSString * path = (NSString * ) urlpath; + NSURL * url = [NSURL fileURLWithPath: path]; + NSWorkspace * ws = [NSWorkspace sharedWorkspace]; + [ws openURL: url]; + status = noErr; + return status; + } + + /* + * If destination is not printer, file or preview, + * we do not support it. Display alert. + */ if (((status == noErr) && (printDestination != kPMDestinationPreview)) || ((status == noErr) && (printDestination != kPMDestinationFile)) || ((status == noErr) && (printDestination != kPMDestinationPrinter))) { - NSAlert * alert = [[[NSAlert alloc] init] autorelease]; - [alert addButtonWithTitle: @ "OK"]; + NSAlert * alert = [[[NSAlert alloc] init] autorelease]; + [alert addButtonWithTitle: @ "OK"]; - [alert setMessageText: @ "Unsupported Printing Operation"]; - [alert setInformativeText: @ "This printing operation is not supported."]; - [alert setAlertStyle: NSAlertStyleInformational]; - [alert runModal]; - return status; - } + [alert setMessageText: @ "Unsupported Printing Operation"]; + [alert setInformativeText: @ "This printing operation is not supported."]; + [alert setAlertStyle: NSAlertStyleInformational]; + [alert runModal]; + return status; + } } /* Return because cancel button was clicked. */ if (buttonValue == NSModalResponseCancel) { - PMRelease(printSession); - return status; + PMRelease(printSession); + return status; } return status; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index c4352a0..5143515 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -166,7 +166,7 @@ typedef union MacKeycode_t { #define ON_KEYPAD(virt) ((virt >= 0x41) && (virt <= 0x5C)) #define IS_PRINTABLE(keychar) ((keychar >= 0x20) && (keychar != 0x7f) && \ - ((keychar < 0xF700) || keychar >= 0xF8FF)) + ((keychar < 0xF700) || keychar >= 0xF8FF)) /* * An "index" is 2-bit bitfield showing the state of the Option and Shift @@ -389,7 +389,7 @@ VISIBILITY_HIDDEN - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void)handleURLEvent: (NSAppleEventDescriptor*)event - withReplyEvent: (NSAppleEventDescriptor*)replyEvent; + withReplyEvent: (NSAppleEventDescriptor*)replyEvent; @end VISIBILITY_HIDDEN diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index a66bba7..38ff385 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -169,10 +169,10 @@ TkpDisplayScale( Tcl_Preserve(scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); - if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, - scalePtr->value) < 0) { - string[TCL_DOUBLE_SPACE - 1] = '\0'; - } + if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, + scalePtr->value) < 0) { + string[TCL_DOUBLE_SPACE - 1] = '\0'; + } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE); Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); @@ -197,7 +197,7 @@ TkpDisplayScale( * vertical scales: border and traversal highlight. */ - if (scalePtr->highlightWidth != 0) { + if (scalePtr->highlightWidth > 0) { GC gc = Tk_GCForColor(scalePtr->highlightColorPtr, Tk_WindowId(tkwin)); Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index ec54d42..f5b25f1 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -284,7 +284,7 @@ TkpDisplayScrollbar( * Draw a 3D rectangle to provide a base for the native scrollbar. */ - if (scrollPtr->highlightWidth != 0) { + if (scrollPtr->highlightWidth > 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr, (Pixmap) macWin); @@ -649,8 +649,8 @@ UpdateControlValues( || height <= metrics.minHeight) { msPtr->info.enableState = kThemeTrackHideTrack; } else { - msPtr->info.enableState = kThemeTrackActive; - msPtr->info.attributes = + msPtr->info.enableState = kThemeTrackActive; + msPtr->info.attributes = kThemeTrackShowThumb | kThemeTrackThumbRgnIsNotGhost; } } diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 5a253e7..0d71236 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -78,15 +78,15 @@ XDestroyWindow( } if (macWin->visRgn) { CFRelease(macWin->visRgn); - macWin->visRgn = NULL; + macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); - macWin->aboveVisRgn = NULL; + macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); - macWin->drawRgn = NULL; + macWin->drawRgn = NULL; } if (macWin->toplevel->referenceCount == 0) { @@ -98,15 +98,15 @@ XDestroyWindow( } if (macWin->visRgn) { CFRelease(macWin->visRgn); - macWin->visRgn = NULL; + macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); - macWin->aboveVisRgn = NULL; + macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); - macWin->drawRgn = NULL; + macWin->drawRgn = NULL; } macWin->view = nil; macWin->winPtr->privatePtr = NULL; @@ -155,7 +155,7 @@ XMapWindow( static Bool initialized = NO; NSPoint mouse = [NSEvent mouseLocation]; int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; - //fprintf(stderr, "XMapWindow: %s\n", Tk_PathName(macWin->winPtr)); + //fprintf(stderr, "XMapWindow: %s\n", Tk_PathName(macWin->winPtr)); /* * Under certain situations it's possible for this function to be called diff --git a/macosx/tkMacOSXSysTray.c b/macosx/tkMacOSXSysTray.c index 76186cc..99ffc9b 100644 --- a/macosx/tkMacOSXSysTray.c +++ b/macosx/tkMacOSXSysTray.c @@ -205,7 +205,7 @@ MacSystrayObjCmd( static const char *modifyOptions[] = {"image", "text", "b1_callback", "b3_callback", NULL}; typedef enum {TRAY_IMAGE, TRAY_TEXT, TRAY_B1_CALLBACK, TRAY_B3_CALLBACK - } modifyOptionsEnum; + } modifyOptionsEnum; if ([NSApp macOSVersion] < 101000) { Tcl_AppendResult(interp, @@ -329,9 +329,9 @@ MacSystrayObjCmd( break; } - /* - * Modify the text for the tooltip. - */ + /* + * Modify the text for the tooltip. + */ case TRAY_TEXT: { NSString *tooltip = [NSString stringWithUTF8String:Tcl_GetString(objv[3])]; @@ -345,9 +345,9 @@ MacSystrayObjCmd( break; } - /* - * Modify the proc for the callback. - */ + /* + * Modify the proc for the callback. + */ case TRAY_B1_CALLBACK: { [statusItem setB1Callback : objv[3]]; @@ -365,14 +365,14 @@ MacSystrayObjCmd( /* * Set all properties to nil, and release statusItem. */ - [statusItem setImagewithImage: nil]; - [statusItem setTextwithString: nil]; - [statusItem setB1Callback : NULL]; - [statusItem setB3Callback : NULL]; - [statusItem release]; - *info = NULL; - statusItem = NULL; - break; + [statusItem setImagewithImage: nil]; + [statusItem setTextwithString: nil]; + [statusItem setB1Callback : NULL]; + [statusItem setB3Callback : NULL]; + [statusItem release]; + *info = NULL; + statusItem = NULL; + break; } } diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 19feb8d..b36c283 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -198,8 +198,8 @@ PressButtonObjCmd( } if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "x y"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "x y"); + return TCL_ERROR; } for (i = 1; i < objc; i++) { if (Tcl_GetIntFromObj(interp,objv[i],&value) != TCL_OK) { @@ -297,8 +297,8 @@ MoveMouseObjCmd( } if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "x y"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "x y"); + return TCL_ERROR; } for (i = 1; i < objc; i++) { if (Tcl_GetIntFromObj(interp,objv[i],&value) != TCL_OK) { @@ -359,12 +359,12 @@ InjectKeyEventObjCmd( if (objc < 3) { wrongArgs: - Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?"); + return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, - sizeof(char *), "option", 0, &index) != TCL_OK) { - return TCL_ERROR; + sizeof(char *), "option", 0, &index) != TCL_OK) { + return TCL_ERROR; } type = types[index]; if (Tcl_GetIntFromObj(interp, objv[2], &keysym) != TCL_OK) { @@ -376,37 +376,37 @@ InjectKeyEventObjCmd( macKC.uint = XKeysymToKeycode(NULL, keysym); for (i = 3; i < objc; i++) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], argStrings, - sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { - return TCL_ERROR; - } - switch ((enum args) index) { + sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { + return TCL_ERROR; + } + switch ((enum args) index) { case KEYEVENT_SHIFT: mods |= NSShiftKeyMask; - break; + break; case KEYEVENT_CONTROL: mods |= NSControlKeyMask; - break; + break; case KEYEVENT_OPTION: mods |= NSAlternateKeyMask; - break; + break; case KEYEVENT_COMMAND: mods |= NSCommandKeyMask; - break; + break; case KEYEVENT_FUNCTION: mods |= NSFunctionKeyMask; - break; + break; case KEYEVENT_X: if (++i >= objc) { - goto wrongArgs; - } + goto wrongArgs; + } if (Tcl_GetIntFromObj(interp,objv[i], &x) != TCL_OK) { return TCL_ERROR; } break; case KEYEVENT_Y: if (++i >= objc) { - goto wrongArgs; - } + goto wrongArgs; + } if (Tcl_GetIntFromObj(interp,objv[i], &y) != TCL_OK) { return TCL_ERROR; } @@ -434,7 +434,7 @@ InjectKeyEventObjCmd( } keyEvent = [NSEvent keyEventWithType:type location:NSMakePoint(x, y) - modifierFlags:mods + modifierFlags:mods timestamp:GetCurrentEventTime() windowNumber:0 context:nil diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index cffd1c5..8065962 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -150,7 +150,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } - (NSRect)windowWillUseStandardFrame:(NSWindow *)window - defaultFrame:(NSRect)newFrame + defaultFrame:(NSRect)newFrame { (void)window; @@ -286,7 +286,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #if 0 if (winPtr) { - Tk_UnmapWindow((Tk_Window)winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } #endif } @@ -398,7 +398,7 @@ static void RefocusGrabWindow(void *data) { } - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender - hasVisibleWindows:(BOOL)flag + hasVisibleWindows:(BOOL)flag { (void)sender; (void)flag; @@ -972,7 +972,7 @@ ConfigureRestrictProc( NSTrackingActiveAlways) owner:self userInfo:nil]; - [self addTrackingArea:trackingArea]; + [self addTrackingArea:trackingArea]; } return self; } @@ -1000,7 +1000,7 @@ ConfigureRestrictProc( /* * Run any pending widget display procs as part of the update. */ - + while(Tcl_DoOneEvent(TCL_IDLE_EVENTS)){} [self setTkNeedsDisplay:NO]; } @@ -1220,7 +1220,7 @@ static const char *const accentNames[] = { } NSString *accent = [preferences stringForKey:@"AppleAccentColor"]; NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"] - componentsSeparatedByString: @" "]; + componentsSeparatedByString: @" "]; NSString *highlight = [words count] > 3 ? [words objectAtIndex:3] : nil; const char *accentName = accent ? accentNames[1 + accent.intValue] : defaultColor; const char *highlightName = highlight ? highlight.UTF8String: defaultColor; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 04a3ce5..6eed301 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -112,7 +112,7 @@ static const struct { .forceOnAttrs = kWindowNoTitleBarAttribute | kWindowDoesNotCycleAttribute, .flags = WM_TOPMOST, - .styleMask = 0}, + .styleMask = 0}, [kSheetWindowClass] = { .validAttrs = kWindowResizableAttribute, .forceOnAttrs = kWindowNoTitleBarAttribute | @@ -622,7 +622,7 @@ static void placeAsTab(TKWindow *macWindow) { #endif - (NSSize)windowWillResize:(NSWindow *)sender - toSize:(NSSize)frameSize + toSize:(NSSize)frameSize { NSRect currentFrame = [sender frame]; TkWindow *winPtr = TkMacOSXGetTkWindow(sender); @@ -1101,7 +1101,7 @@ TkWmUnmapWindow( * This procedure is invoked when a top-level window is about to be * deleted. It cleans up the wm-related data structures for the window. * If the dead window contains the pointer, TkUpdatePointer is called - * to tell Tk which window will be the new pointer window. + * to tell Tk which window will be the new pointer window. * * Results: * None. @@ -1201,7 +1201,7 @@ TkWmDeadWindow( NSPoint mouse = [NSEvent mouseLocation]; [NSApp setTkPointerWindow:nil]; winPtr2 = NULL; - + for (w in [NSApp orderedWindows]) { if (w == deadNSWindow || w == NULL) { continue; @@ -1246,9 +1246,9 @@ TkWmDeadWindow( if (deadNSWindow && !Tk_IsEmbedded(winPtr)) { NSWindow *parent = [deadNSWindow parentWindow]; [deadNSWindow setTkWindow:None]; - if (winPtr->window) { - ((MacDrawable *)winPtr->window)->view = nil; - } + if (winPtr->window) { + ((MacDrawable *)winPtr->window)->view = nil; + } wmPtr->window = NULL; if (parent) { @@ -1780,7 +1780,7 @@ WmSetAttribute( } else if (![macWindow isKindOfClass: [NSPanel class]] && styleMaskBits[index].allowed == NSWindowClass_panel) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "styleMask bit \"%s\" can only be used with an NSPanel", + "styleMask bit \"%s\" can only be used with an NSPanel", styleMaskBits[index].bitname)); Tcl_SetErrorCode(interp, "TK", "INVALID_STYLEMASK_BIT", NULL); return TCL_ERROR; @@ -1825,7 +1825,7 @@ WmSetAttribute( fprintf(stderr, "Current styleMask: %lx\n", [macWindow styleMask]); fprintf(stderr, "Setting styleMask to %lx\n", styleMaskValue); #endif - macWindow.styleMask = (unsigned long) styleMaskValue; + macWindow.styleMask = (unsigned long) styleMaskValue; NSRect newFrame = [macWindow frame]; int heightDiff = newFrame.size.height - oldFrame.size.height; int newHeight = heightDiff < 0 ? newFrame.size.height : @@ -2578,16 +2578,16 @@ WmForgetCmd( RemapWindows(winPtr, (MacDrawable *)winPtr->parentPtr->window); - /* - * Make sure wm no longer manages this window - */ - Tk_ManageGeometry(frameWin, NULL, NULL); + /* + * Make sure wm no longer manages this window + */ + Tk_ManageGeometry(frameWin, NULL, NULL); winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); /* - * Flags (above) must be cleared before calling TkMapTopFrame (below). - */ + * Flags (above) must be cleared before calling TkMapTopFrame (below). + */ TkMapTopFrame(frameWin); } else { @@ -3673,7 +3673,7 @@ WmOverrideredirectCmd( win = TkMacOSXGetNSWindowForDrawable(winPtr->window); } - + if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; @@ -4357,12 +4357,12 @@ WmTransientCmd( RemoveTransient(winPtr); containerPtr = (TkWindow*) container; while (!Tk_TopWinHierarchy(containerPtr)) { - /* - * Ensure that the container window is actually a Tk toplevel. - */ + /* + * Ensure that the container window is actually a Tk toplevel. + */ - containerPtr = containerPtr->parentPtr; - } + containerPtr = containerPtr->parentPtr; + } Tk_MakeWindowExist((Tk_Window)containerPtr); if (wmPtr->iconFor != NULL) { @@ -5262,7 +5262,7 @@ Tk_GetRootCoords( */ winPtr = otherPtr; - continue; + continue; } winPtr = winPtr->parentPtr; } @@ -6303,7 +6303,7 @@ TkUnsupported1ObjCmd( case TKMWS_APPEARANCE: if ([NSApp macOSVersion] < 100900) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE)); + "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL); return TCL_ERROR; } @@ -6857,7 +6857,7 @@ TkMacOSXMakeRealWindowExist( } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { - /* + /* * Workaround for [Bug 2824538]: Textured windows are draggable from * opaque content. */ @@ -7642,9 +7642,9 @@ ApplyContainerOverrideChanges( wmPtr->attributes &= ~kWindowNoActivatesAttribute; if ([NSApp macOSVersion] == 100600) { styleMask = NSTitledWindowMask | - NSClosableWindowMask | - NSMiniaturizableWindowMask | - NSResizableWindowMask; + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask; } else { styleMask |= NSTitledWindowMask; } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index ff850f0..2d8d3da 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -214,9 +214,9 @@ static GrayPalette LookupGrayPalette( { const PaletteStateTable *entry = design->palettes; while ((state & entry->onBits) != entry->onBits || - (~state & entry->offBits) != entry->offBits) + (~state & entry->offBits) != entry->offBits) { - ++entry; + ++entry; } return isDark ? entry->dark : entry->light; } @@ -356,12 +356,12 @@ static void GetBackgroundColorRGBA( rgba[i] -= Ttk_ContrastDelta*contrast / 255.0; } } - if (save && winPtr->privatePtr) { - winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG; - for (int i = 0; i < 4; i++) { - winPtr->privatePtr->fillRGBA[i] = rgba[i]; - } - } + if (save && winPtr->privatePtr) { + winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG; + for (int i = 0; i < 4; i++) { + winPtr->privatePtr->fillRGBA[i] = rgba[i]; + } + } } } @@ -931,8 +931,8 @@ DrawHelpSymbol( NSColor *foreground = state & TTK_STATE_DISABLED ? [NSColor disabledControlTextColor] : [NSColor controlTextColor]; NSDictionary *attrs = @{ - NSForegroundColorAttributeName : foreground, - NSFontAttributeName : font + NSForegroundColorAttributeName : foreground, + NSFontAttributeName : font }; NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"?" @@ -1505,10 +1505,10 @@ DrawTab( if (!(state & TTK_STATE_SELECTED)) { DrawGrayButton(context, bounds, &tabDesign, state, tkwin); - /* - * Draw a separator line on the left side of the tab if it - * not first. - */ + /* + * Draw a separator line on the left side of the tab if it + * not first. + */ if (!(state & TTK_STATE_FIRST)) { CGContextSaveGState(context); @@ -1653,20 +1653,20 @@ static void ButtonElementMinSize( if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, minHeight); - /* - * The theme height does not include the 1-pixel border around - * the button, although it does include the 1-pixel shadow at - * the bottom. - */ + /* + * The theme height does not include the 1-pixel border around + * the button, although it does include the 1-pixel shadow at + * the bottom. + */ *minHeight += 2; - /* - * 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. - */ + /* + * 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. + */ if (params->widthMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->widthMetric, minWidth); @@ -1700,10 +1700,10 @@ static void ButtonElementSize( return; case TkGradientButton: *paddingPtr = Ttk_MakePadding(1, 1, 1, 1); - /* Fall through. */ + /* Fall through. */ case kThemeArrowButton: case kThemeRoundButtonHelp: - return; + return; /* Buttons which are sized like PushButtons but unknown to HITheme. */ case TkRoundedRectButton: case TkRecessedButton: @@ -1711,7 +1711,7 @@ static void ButtonElementSize( info.kind = kThemePushButton; break; default: - break; + break; } /* @@ -2152,14 +2152,14 @@ static void EntryElementDraw( .isFocused = state & TTK_STATE_FOCUS, }; - /* - * Earlier versions of the Aqua theme ignored the -fieldbackground - * option and used the -background as if it were -fieldbackground. - * Here we are enabling -fieldbackground. For backwards - * compatibility, if -fieldbackground is set to the default color and - * -background is set to a different color then we use -background as - * -fieldbackground. - */ + /* + * Earlier versions of the Aqua theme ignored the -fieldbackground + * option and used the -background as if it were -fieldbackground. + * Here we are enabling -fieldbackground. For backwards + * compatibility, if -fieldbackground is set to the default color and + * -background is set to a different color then we use -background as + * -fieldbackground. + */ if (0 != strcmp(Tcl_GetString(e->fieldbackgroundObj), defaultBG)) { backgroundPtr = @@ -2828,14 +2828,14 @@ static void ThumbElementDraw( CGRect troughBounds = {{macWin->xOff, macWin->yOff}, {Tk_Width(tkwin), Tk_Height(tkwin)}}; - /* - * The info struct has integer fields, which will be converted to - * floats in the drawing routine. All of values provided in the info - * struct, namely min, max, value, and viewSize are only defined up to - * an arbitrary scale factor. To avoid roundoff error we scale so - * that the viewSize is a large float which is smaller than the - * largest int. - */ + /* + * The info struct has integer fields, which will be converted to + * floats in the drawing routine. All of values provided in the info + * struct, namely min, max, value, and viewSize are only defined up to + * an arbitrary scale factor. To avoid roundoff error we scale so + * that the viewSize is a large float which is smaller than the + * largest int. + */ HIThemeTrackDrawInfo info = { .version = 0, @@ -2941,7 +2941,7 @@ static void SeparatorElementDraw( CGRect bounds = BoxToRect(d, b); const HIThemeSeparatorDrawInfo info = { .version = 0, - /* Separator only supports kThemeStateActive, kThemeStateInactive */ + /* Separator only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), }; @@ -3004,7 +3004,7 @@ static void SizegripElementDraw( CGRect bounds = BoxToRect(d, b); HIThemeGrowBoxDrawInfo info = { .version = 0, - /* Grow box only supports kThemeStateActive, kThemeStateInactive */ + /* Grow box only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), .kind = kHIThemeGrowBoxKindNormal, @@ -3295,10 +3295,10 @@ static void TreeHeaderElementDraw( BEGIN_DRAWING(d) if ([NSApp macOSVersion] > 100800) { - /* - * Compensate for the padding added in TreeHeaderElementSize, so - * the larger heading will be drawn at the top of the widget. - */ + /* + * Compensate for the padding added in TreeHeaderElementSize, so + * the larger heading will be drawn at the top of the widget. + */ bounds.origin.y -= 4; DrawListHeader(bounds, dc.context, tkwin, state); @@ -3484,13 +3484,13 @@ TTK_LAYOUT("TSpinbox", TTK_LAYOUT("TEntry", TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, - TTK_GROUP("Entry.padding", TTK_FILL_BOTH, + TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))) /* Searchbox */ TTK_LAYOUT("Searchbox", TTK_GROUP("Searchbox.field", TTK_FILL_BOTH|TTK_BORDER, - TTK_GROUP("Entry.padding", TTK_FILL_BOTH, + TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH)))) /* Progress bars -- track only */ diff --git a/macosx/ttkMacOSXTheme.h b/macosx/ttkMacOSXTheme.h index 1e2b7ae..2092b02 100644 --- a/macosx/ttkMacOSXTheme.h +++ b/macosx/ttkMacOSXTheme.h @@ -561,7 +561,7 @@ static ThemeFrameParams #define CHECK_RADIUS(radius, bounds) \ if ((radius) > (bounds).size.width / 2 || (radius) > (bounds).size.height / 2) { \ - return; \ + return; \ } /* |