From a5a75fd79518333976b2b5f8e0887b1eac08e72d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 2 Sep 2020 08:29:48 +0000 Subject: Eliminate MODULE_SCOPE wrapper function for TkMacOSXDrawable(). Rename (internal) TkMacOSXDrawableWindow() to TkMacOSXGetNSWindowForDrawable(). Code (type-cast) cleanup --- macosx/tkMacOSXDialog.c | 63 ++++++++++++----------- macosx/tkMacOSXDraw.c | 48 +++++++++--------- macosx/tkMacOSXEmbed.c | 8 +-- macosx/tkMacOSXFont.c | 2 +- macosx/tkMacOSXImage.c | 2 +- macosx/tkMacOSXInit.c | 2 +- macosx/tkMacOSXInt.h | 1 - macosx/tkMacOSXKeyEvent.c | 16 +++--- macosx/tkMacOSXMenubutton.c | 2 +- macosx/tkMacOSXMenus.c | 2 +- macosx/tkMacOSXMouseEvent.c | 16 +++--- macosx/tkMacOSXPrivate.h | 3 +- macosx/tkMacOSXScale.c | 2 +- macosx/tkMacOSXSubwindows.c | 45 +++++++---------- macosx/tkMacOSXTest.c | 2 +- macosx/tkMacOSXWindowEvent.c | 22 ++++---- macosx/tkMacOSXWm.c | 116 +++++++++++++++++++++---------------------- macosx/ttkMacOSXTheme.c | 2 +- 18 files changed, 177 insertions(+), 177 deletions(-) diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 026439f..c2b1b15 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -198,13 +198,17 @@ getFileURL( @implementation TKApplication(TKDialog) - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { + (void)sender; + (void)url; return YES; } - (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { + (void)sender; (void)url; } - (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError { + (void)sender; (void)url; *outError = nil; return YES; } @@ -233,7 +237,7 @@ getFileURL( callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, @@ -271,7 +275,7 @@ getFileURL( callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = resultObj; TkBackgroundEvalObjv(callbackInfo->interp, objc + 1, tmpv, @@ -804,7 +808,7 @@ Tk_GetOpenFileObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; @@ -814,7 +818,7 @@ Tk_GetOpenFileObjCmd( [openpanel setDirectoryURL:fileURL]; } if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -913,7 +917,7 @@ Tk_GetSaveFileObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int confirmOverwrite = 1; @@ -1080,7 +1084,7 @@ Tk_GetSaveFileObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; @@ -1100,7 +1104,7 @@ Tk_GetSaveFileObjCmd( [savepanel setNameFieldStringValue:@""]; } if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -1155,7 +1159,7 @@ Tk_ChooseDirectoryObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, len, mustexist = 0; @@ -1229,7 +1233,7 @@ Tk_ChooseDirectoryObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); + callbackInfo = (FilePanelCallbackInfo *)ckalloc(sizeof(FilePanelCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; @@ -1242,10 +1246,10 @@ Tk_ChooseDirectoryObjCmd( if (!directory) { directory = @"/"; } - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; if (haveParentOption) { - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); parentIsKey = parent && [parent isKeyWindow]; } else { parent = nil; @@ -1355,7 +1359,7 @@ TkAboutDlg(void) int TkMacOSXStandardAboutPanelObjCmd( - ClientData clientData, /* Unused. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1391,7 +1395,7 @@ Tk_MessageBoxObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; char *str; int i, result = TCL_ERROR, haveParentOption = 0; int index, typeIndex, iconIndex, indexDefaultOption = 0; @@ -1525,11 +1529,11 @@ Tk_MessageBoxObjCmd( } Tcl_IncrRefCount(cmdObj); } - callbackInfo = ckalloc(sizeof(AlertCallbackInfo)); + callbackInfo = (AlertCallbackInfo *)ckalloc(sizeof(AlertCallbackInfo)); callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->typeIndex = typeIndex; - parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); + parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 @@ -1626,6 +1630,7 @@ enum FontchooserOption { - (void) changeFont: (id) sender { NSFontManager *fm = [NSFontManager sharedFontManager]; + (void)sender; if ([fm currentFontAction] == NSViaPanelFontAction) { NSFont *font = [fm convertFont:fontPanelFont]; @@ -1649,14 +1654,16 @@ enum FontchooserOption { } } -- (NSUInteger) validModesForFontPanel: (NSFontPanel *) fontPanel +- (NSUInteger) validModesForFontPanel: (NSFontPanel *)fontPanel { + (void)fontPanel; + return (NSFontPanelStandardModesMask & ~NSFontPanelAllEffectsModeMask) | NSFontPanelUnderlineEffectModeMask | NSFontPanelStrikethroughEffectModeMask; } -- (void) windowDidOrderOffScreen: (NSNotification *) notification +- (void) windowDidOrderOffScreen: (NSNotification *)notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); @@ -1714,7 +1721,7 @@ FontchooserEvent( result = Tcl_ListObjGetElements(fontchooserInterp, fcdPtr->cmdObj, &objc, &objv); if (result == TCL_OK) { - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = fontObj; TkBackgroundEvalObjv(fontchooserInterp, objc + 1, tmpv, @@ -1756,7 +1763,7 @@ FontchooserCget( case FontchooserParent: if (fcdPtr->parent != None) { resObj = Tcl_NewStringObj( - ((TkWindow *) fcdPtr->parent)->pathName, -1); + ((TkWindow *)fcdPtr->parent)->pathName, -1); } else { resObj = Tcl_NewStringObj(".", 1); } @@ -1977,14 +1984,14 @@ static int FontchooserShowCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); if (fcdPtr->parent == None) { - fcdPtr->parent = (Tk_Window) clientData; + fcdPtr->parent = (Tk_Window)clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } @@ -2023,10 +2030,10 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ - Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(void *), /* Main window */ + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; @@ -2125,9 +2132,9 @@ DeleteFontchooserData( MODULE_SCOPE int TkInitFontchooser( Tcl_Interp *interp, - ClientData clientData) + TCL_UNUSED(void *)) { - FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData)); + FontchooserData *fcdPtr = (FontchooserData *)ckalloc(sizeof(FontchooserData)); bzero(fcdPtr, sizeof(FontchooserData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData, diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 15d1eb5..1c77af3 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -85,7 +85,7 @@ TkMacOSXInitCGDrawing( } if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit", - (char *) &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) { + (char *)&cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) { Tcl_ResetResult(interp); } cgAntiAliasLimit = limit; @@ -95,11 +95,11 @@ TkMacOSXInitCGDrawing( */ if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel", - (char *) &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) { + (char *)&useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame", - (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { + (char *)&useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } transparentColor = TkMacOSXClearPixel(); @@ -243,7 +243,7 @@ CGContextRef TkMacOSXGetCGContextForDrawable( Drawable drawable) { - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; @@ -261,7 +261,7 @@ TkMacOSXGetCGContextForDrawable( if (macDraw->flags & TK_IS_BW_PIXMAP) { bitsPerPixel = 8; - bitmapInfo = (CGBitmapInfo) kCGImageAlphaOnly; + bitmapInfo = (CGBitmapInfo)kCGImageAlphaOnly; } else { colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerPixel = 32; @@ -314,7 +314,7 @@ TkMacOSXDrawCGImage( CGRect srcBounds, CGRect dstBounds) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; if (macDraw && context && image) { CGImageRef subImage = NULL; @@ -410,7 +410,7 @@ XDrawLines( int npoints, /* Number of points. */ int mode) /* Line drawing mode. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; @@ -482,7 +482,7 @@ XDrawSegments( XSegment *segments, int nsegments) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i, lw = gc->line_width; @@ -534,7 +534,7 @@ XFillPolygon( TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int i; @@ -592,7 +592,7 @@ XDrawRectangle( unsigned int width, /* Width & height of rect. */ unsigned int height) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -650,7 +650,7 @@ XDrawRectangles( XRectangle *rectArr, int nRects) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i, lw = gc->line_width; @@ -703,7 +703,7 @@ XFillRectangles( XRectangle *rectangles, /* Rectangle array. */ int n_rectangles) /* Number of rectangles. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XRectangle * rectPtr; int i; @@ -805,7 +805,7 @@ XDrawArc( int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -879,7 +879,7 @@ XDrawArcs( XArc *arcArr, int nArcs) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc *arcPtr; int i, lw = gc->line_width; @@ -958,7 +958,7 @@ XFillArc( int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; int lw = gc->line_width; @@ -1035,7 +1035,7 @@ XFillArcs( XArc *arcArr, int nArcs) { - MacDrawable *macWin = (MacDrawable *) d; + MacDrawable *macWin = (MacDrawable *)d; TkMacOSXDrawingContext dc; XArc * arcPtr; int i, lw = gc->line_width; @@ -1139,7 +1139,7 @@ TkScrollWindow( TkRegion damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; TKContentView *view = TkMacOSXDrawableView(macDraw); CGRect srcRect, dstRect; HIShapeRef dmgRgn = NULL, extraRgn = NULL; @@ -1261,7 +1261,7 @@ TkMacOSXSetupDrawingContext( GC gc, TkMacOSXDrawingContext *dcPtr) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; Bool canDraw = true; TKContentView *view = nil; TkMacOSXDrawingContext dc = {}; @@ -1515,7 +1515,7 @@ HIShapeRef TkMacOSXGetClipRgn( Drawable drawable) /* Drawable. */ { - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *)drawable; HIShapeRef clipRgn = NULL; if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { @@ -1591,7 +1591,7 @@ TkpClipDrawableToRect( int x, int y, int width, int height) { - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *)d; if (macDraw->drawRgn) { CFRelease(macDraw->drawRgn); @@ -1638,10 +1638,10 @@ ClipToGC( HIShapeRef *clipRgnPtr) /* must point to initialized variable */ { if (gc && gc->clip_mask && - ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) { - TkRegion gcClip = ((TkpClipMask *) gc->clip_mask)->value.region; - int xOffset = ((MacDrawable *) d)->xOff + gc->clip_x_origin; - int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin; + ((TkpClipMask *)gc->clip_mask)->type == TKP_CLIP_REGION) { + TkRegion gcClip = ((TkpClipMask *)gc->clip_mask)->value.region; + int xOffset = ((MacDrawable *)d)->xOff + gc->clip_x_origin; + int yOffset = ((MacDrawable *)d)->yOff + gc->clip_y_origin; HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn; XOffsetRegion(gcClip, xOffset, yOffset); diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index e58cdd0..acf2e69 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -853,7 +853,7 @@ ContainerEventProc( * Here we are following unix, by destroying the container. */ - Tk_DestroyWindow((Tk_Window) winPtr); + Tk_DestroyWindow((Tk_Window)winPtr); } Tk_DeleteErrorHandler(errHandler); } @@ -902,8 +902,8 @@ EmbedStructureProc( errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, -1, -1, NULL, NULL); - Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0, - (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr), + Tk_MoveResizeWindow((Tk_Window)containerPtr->embeddedPtr, 0, 0, + (unsigned) Tk_Width((Tk_Window)containerPtr->parentPtr), (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr)); Tk_DeleteErrorHandler(errHandler); } @@ -1048,7 +1048,7 @@ EmbedGeometryRequest( * if the window's size didn't change then generate a configure event. */ - Tk_GeometryRequest((Tk_Window) winPtr, width, height); + Tk_GeometryRequest((Tk_Window)winPtr, width, height); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {} if ((winPtr->changes.width != width) || (winPtr->changes.height != height)) { diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index ac3bf20..4e383f1 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -451,7 +451,7 @@ TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { Tcl_Interp *interp = mainPtr->interp; - Tk_Window tkwin = (Tk_Window) mainPtr->winPtr; + Tk_Window tkwin = (Tk_Window)mainPtr->winPtr; const struct SystemFontMapEntry *systemFont = systemFontMap; NSFont *nsFont; TkFontAttributes fa; diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 2e6b5e7..38e14fa 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -767,7 +767,7 @@ XCopyArea( if (srcDraw->flags & TK_IS_PIXMAP) { img = CreateCGImageFromPixmap(src); - } else if (TkMacOSXDrawableWindow(src)) { + } else if (TkMacOSXGetNSWindowForDrawable(src)) { img = CreateCGImageFromDrawableRect(src, src_x, src_y, width, height); } else { TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index ab2400c..51c1e37 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -491,7 +491,7 @@ TkpGetAppName( static int TkMacOSXGetAppPathCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 2c2be0c..278fcac 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -195,7 +195,6 @@ MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable); -MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); /* * Include the stubbed internal platform-specific API. diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 014caa9..49d38a6 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -51,7 +51,7 @@ static NSUInteger textInputModifiers; #endif NSWindow *w = [theEvent window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; NSUInteger virtual = [theEvent keyCode]; NSUInteger modifiers = ([theEvent modifierFlags] & @@ -83,7 +83,7 @@ static NSUInteger textInputModifiers; if (winPtr->dispPtr->grabFlags || /* global grab */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* same application */ winPtr =winPtr->dispPtr->focusPtr; - tkwin = (Tk_Window) winPtr; + tkwin = (Tk_Window)winPtr; } } @@ -286,7 +286,7 @@ static NSUInteger textInputModifiers; XEvent xEvent; NSString *str, *keystr, *lower; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; Bool sendingIMEText = NO; str = ([aString isKindOfClass: [NSAttributedString class]]) ? @@ -322,7 +322,7 @@ static NSUInteger textInputModifiers; */ if (repRange.location == 0) { - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } @@ -393,7 +393,7 @@ static NSUInteger textInputModifiers; replacementRange: (NSRange)repRange { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; @@ -498,7 +498,7 @@ static NSUInteger textInputModifiers; processingCompose = NO; if (aSelector == @selector (deleteBackward:)) { TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; + Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr; TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL); } } @@ -687,7 +687,7 @@ XGrabKeyboard( TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture(); if (keyboardGrabWinPtr && captureWinPtr) { - NSWindow *w = TkMacOSXDrawableWindow(grab_window); + NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window); MacDrawable *macWin = (MacDrawable *) grab_window; if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) { @@ -789,7 +789,7 @@ Tk_SetCaretPos( { TkWindow *winPtr = (TkWindow *) tkwin; TkCaret *caretPtr = &(winPtr->dispPtr->caret); - NSWindow *w = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); + NSWindow *w = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); /* * Register this widget as being capable of text input, so we know we diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 320c070..2fad3cb 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -703,7 +703,7 @@ MenuButtonEventProc( mbPtr->flags &= ~ACTIVE; } if ((buttonPtr->flags & REDRAW_PENDING) == 0) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) buttonPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, buttonPtr); buttonPtr->flags |= REDRAW_PENDING; } } diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index 9b85e7a..a1519f5 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -415,7 +415,7 @@ GenerateEditEvent( if (!winPtr) { return; } - tkwin = (Tk_Window) winPtr->dispPtr->focusPtr; + tkwin = (Tk_Window)winPtr->dispPtr->focusPtr; if (!tkwin) { return; } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 99505ca..f2d7e32 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -111,7 +111,7 @@ enum { tkwin = TkMacOSXGetCapture(); if (tkwin) { winPtr = (TkWindow *) tkwin; - eventWindow = TkMacOSXDrawableWindow(winPtr->window); + eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (eventWindow) { local = [eventWindow tkConvertPointFromScreen: global]; } else { @@ -130,7 +130,7 @@ enum { tkwin = TkMacOSXGetCapture(); if (tkwin) { winPtr = (TkWindow *) tkwin; - eventWindow = TkMacOSXDrawableWindow(winPtr->window); + eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); } else { eventWindow = [NSApp mainWindow]; } @@ -149,7 +149,7 @@ enum { if (!tkwin) { winPtr = TkMacOSXGetTkWindow(eventWindow); - tkwin = (Tk_Window) winPtr; + tkwin = (Tk_Window)winPtr; } if (!tkwin) { @@ -179,11 +179,11 @@ enum { for (tkwin2 = tkEventWindow; !Tk_IsTopLevel(tkwin2); tkwin2 = Tk_Parent(tkwin2)) { - if (tkwin2 == (Tk_Window) grabWinPtr) { + if (tkwin2 == (Tk_Window)grabWinPtr) { break; } } - if (tkwin2 != (Tk_Window) grabWinPtr) { + if (tkwin2 != (Tk_Window)grabWinPtr) { return theEvent; } } @@ -432,7 +432,7 @@ XQueryPointer( if (getLocal) { MacDrawable *macWin = (MacDrawable *) w; - NSWindow *win = TkMacOSXDrawableWindow(w); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(w); if (win) { NSPoint local; @@ -522,7 +522,7 @@ TkGenerateButtonEvent( unsigned int state) /* Button Key state suitable for X event. */ { MacDrawable *macWin = (MacDrawable *) window; - NSWindow *win = TkMacOSXDrawableWindow(window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); MouseEventData med; bzero(&med, sizeof(MouseEventData)); @@ -648,7 +648,7 @@ TkpSetCapture( winPtr = winPtr->parentPtr; } [NSEvent stopPeriodicEvents]; - captureWinPtr = (Tk_Window) winPtr; + captureWinPtr = (Tk_Window)winPtr; } /* diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 1dc856c..5ac834c 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -257,7 +257,7 @@ MODULE_SCOPE void TkMacOSXRestoreDrawingContext( TkMacOSXDrawingContext *dcPtr); MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel, CGContextRef context); -MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable); +#define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow*)TkMacOSXDrawable(drawable)) #define TkMacOSXDrawableView(macWin) (TKContentView *)TkMacOSXGetRootControl((Drawable)(macWin)) MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds); MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable); @@ -291,6 +291,7 @@ MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData, MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode); MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, NSRect *bounds); +MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData); MODULE_SCOPE unsigned long TkMacOSXClearPixel(void); diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index b1e918b..15286d6 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -214,7 +214,7 @@ TkpDisplayScale( */ macDraw = (MacDrawable *) Tk_WindowId(tkwin); - windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); + windowRef = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); /* * Create Macintosh control. diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index a3c7469..24cd974 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -68,7 +68,7 @@ XDestroyWindow( if (!Tk_IsTopLevel(macWin->winPtr)) { TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); if (macWin->winPtr->parentPtr != NULL) { - TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)macWin->winPtr->parentPtr); } if (macWin->visRgn) { CFRelease(macWin->visRgn); @@ -141,7 +141,7 @@ XMapWindow( } MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; - NSWindow *win = TkMacOSXDrawableWindow(window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); XEvent event; /* @@ -187,11 +187,11 @@ XMapWindow( * the window. */ - TkMacOSXInvalClipRgns((Tk_Window) contWinPtr); + TkMacOSXInvalClipRgns((Tk_Window)contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } - TkMacOSXInvalClipRgns((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr); /* * We only need to send the MapNotify event for toplevel windows. @@ -221,7 +221,7 @@ XMapWindow( * and redisplay the window. */ - TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); } TKContentView *view = [win contentView]; @@ -300,7 +300,7 @@ XUnmapWindow( MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; - NSWindow *win = TkMacOSXDrawableWindow(window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); XEvent event; display->request++; @@ -309,7 +309,7 @@ XUnmapWindow( winPtr->wmInfoPtr->hints.initial_state!=IconicState) { [win orderOut:nil]; } - TkMacOSXInvalClipRgns((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr); /* * We only need to send the UnmapNotify event for toplevel windows. @@ -344,7 +344,7 @@ XUnmapWindow( TkMacOSXDrawableView(parentPtr->privatePtr), parentPtr->privatePtr->visRgn); } - TkMacOSXInvalClipRgns((Tk_Window) parentPtr); + TkMacOSXInvalClipRgns((Tk_Window)parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } winPtr->flags &= ~TK_MAPPED; @@ -515,7 +515,7 @@ MoveResizeWindow( { int deltaX = 0, deltaY = 0, parentBorderwidth = 0; MacDrawable *macParent = NULL; - NSWindow *macWindow = TkMacOSXDrawableWindow((Drawable)macWin); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable((Drawable)macWin); /* * Find the Parent window, for an embedded window it will be its container. @@ -552,7 +552,7 @@ MoveResizeWindow( if (macWindow) { TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); if (macParent) { - TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); + TkMacOSXInvalClipRgns((Tk_Window)macParent->winPtr); } } UpdateOffsets(macWin->winPtr, deltaX, deltaY); @@ -717,8 +717,8 @@ XConfigureWindow( NSView *view = TkMacOSXDrawableView(macWin); if (view) { - TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); - TkpRedrawWidget((Tk_Window) winPtr); + TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); + TkpRedrawWidget((Tk_Window)winPtr); } } @@ -870,7 +870,7 @@ TkMacOSXUpdateClipRgn( TkRegion r = TkCreateRegion(); HIShapeRef visRgn; - tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr, r); + tkMacOSXEmbedHandler->getClipProc((Tk_Window)winPtr, r); visRgn = TkMacOSXGetNativeRegion(r); ChkErr(HIShapeIntersect, visRgn, rgn, rgn); CFRelease(visRgn); @@ -1069,7 +1069,7 @@ TkMacOSXInvalidateWindow( /* *---------------------------------------------------------------------- * - * TkMacOSXDrawableWindow -- + * TkMacOSXGetNSWindowForDrawable -- * * This function returns the NSWindow for a given X drawable. * @@ -1082,8 +1082,8 @@ TkMacOSXInvalidateWindow( *---------------------------------------------------------------------- */ -NSWindow * -TkMacOSXDrawableWindow( +void * +TkMacOSXDrawable( Drawable drawable) { MacDrawable *macWin = (MacDrawable *) drawable; @@ -1102,18 +1102,11 @@ TkMacOSXDrawableWindow( TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { - result = TkMacOSXDrawableWindow((Drawable)contWinPtr->privatePtr); + result = TkMacOSXGetNSWindowForDrawable((Drawable)contWinPtr->privatePtr); } } return result; } - -void * -TkMacOSXDrawable( - Drawable drawable) -{ - return TkMacOSXDrawableWindow(drawable); -} /* *---------------------------------------------------------------------- @@ -1248,7 +1241,7 @@ TkMacOSXInvalClipRgns( childPtr = winPtr->childList; while (childPtr) { if (!Tk_IsTopLevel(childPtr)) { - TkMacOSXInvalClipRgns((Tk_Window) childPtr); + TkMacOSXInvalClipRgns((Tk_Window)childPtr); } childPtr = childPtr->nextPtr; } @@ -1261,7 +1254,7 @@ TkMacOSXInvalClipRgns( childPtr = TkpGetOtherWindow(winPtr); if (childPtr) { - TkMacOSXInvalClipRgns((Tk_Window) childPtr); + TkMacOSXInvalClipRgns((Tk_Window)childPtr); } /* diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index c70ecd5..434504f 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -266,7 +266,7 @@ PressButtonObjCmd( static int InjectKeyEventObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 1be213b..8b1e694 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -95,7 +95,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; */ flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY; - TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); + TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width, height, flags); } } @@ -111,7 +111,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; if (winPtr) { winPtr->wmInfoPtr->hints.initial_state = TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState; - Tk_MapWindow((Tk_Window) winPtr); + Tk_MapWindow((Tk_Window)winPtr); /* * Process all Tk events generated by Tk_MapWindow(). @@ -182,7 +182,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -194,7 +194,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - TkGenWMDestroyEvent((Tk_Window) winPtr); + TkGenWMDestroyEvent((Tk_Window)winPtr); } /* @@ -252,7 +252,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { - //Tk_UnmapWindow((Tk_Window) winPtr); + //Tk_UnmapWindow((Tk_Window)winPtr); } } @@ -823,7 +823,7 @@ TkWmProtocolEventProc( if (result != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (command for \"%s\" window manager protocol)", - Tk_GetAtomName((Tk_Window) winPtr, protocol))); + Tk_GetAtomName((Tk_Window)winPtr, protocol))); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); @@ -837,8 +837,8 @@ TkWmProtocolEventProc( * message then just destroy the window. */ - if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) { - Tk_DestroyWindow((Tk_Window) winPtr); + if (protocol == Tk_InternAtom((Tk_Window)winPtr, "WM_DELETE_WINDOW")) { + Tk_DestroyWindow((Tk_Window)winPtr); } } @@ -967,7 +967,7 @@ ConfigureRestrictProc( [super setFrameSize: newsize]; NSWindow *w = [self window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; if (![self inLiveResize] && [w respondsToSelector: @selector (tkLayoutChanged)]) { @@ -1109,7 +1109,7 @@ static const char *const accentNames[] = { - (void) viewDidChangeEffectiveAppearance { - Tk_Window tkwin = (Tk_Window) TkMacOSXGetTkWindow([self window]); + Tk_Window tkwin = (Tk_Window)TkMacOSXGetTkWindow([self window]); if (!tkwin) { return; } @@ -1179,7 +1179,7 @@ static const char *const accentNames[] = { XVirtualEvent event; int x, y; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); - Tk_Window tkwin = (Tk_Window) winPtr; + Tk_Window tkwin = (Tk_Window)winPtr; (void)sender; if (!winPtr){ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index faad78e..453f277 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -523,7 +523,7 @@ static void SetWindowSizeLimits( TkWindow *winPtr) { - NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); WmInfo *wmPtr = winPtr->wmInfoPtr; int minWidth, minHeight, maxWidth, maxHeight, base; @@ -729,7 +729,7 @@ TkWmNewWindow( * detect size and position changes caused by window managers. */ - Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask, + Tk_CreateEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); /* @@ -737,7 +737,7 @@ TkWmNewWindow( * window manager. */ - Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0); + Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL); } /* @@ -784,7 +784,7 @@ TkWmMapWindow( * Generate configure event when we first map the window. */ - TkGenWMConfigureEvent((Tk_Window) winPtr, wmPtr->x, wmPtr->y, -1, -1, + TkGenWMConfigureEvent((Tk_Window)winPtr, wmPtr->x, wmPtr->y, -1, -1, TK_LOCATION_CHANGED); /* @@ -896,8 +896,8 @@ TkWmDeadWindow( */ RemoveTransient(winPtr); - Tk_ManageGeometry((Tk_Window) winPtr, NULL, NULL); - Tk_DeleteEventHandler((Tk_Window) winPtr, StructureNotifyMask, + Tk_ManageGeometry((Tk_Window)winPtr, NULL, NULL); + Tk_DeleteEventHandler((Tk_Window)winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); if (wmPtr->hints.flags & IconPixmapHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); @@ -1094,7 +1094,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", @@ -1529,12 +1529,12 @@ WmAttributesCmd( NSWindow *macWindow; if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { TkMacOSXMakeRealWindowExist(winPtr); } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewObj(); @@ -1663,7 +1663,7 @@ WmColormapwindowsCmd( return TCL_ERROR; } if (objc == 3) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); resultObj = Tcl_NewObj(); for (i = 0; i < wmPtr->cmapCount; i++) { if ((i == (wmPtr->cmapCount-1)) @@ -1671,7 +1671,7 @@ WmColormapwindowsCmd( break; } Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj((Tk_Window) wmPtr->cmapList[i])); + TkNewWindowObj((Tk_Window)wmPtr->cmapList[i])); } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -1691,7 +1691,7 @@ WmColormapwindowsCmd( gotToplevel = 1; } if (winPtr2->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr2); + Tk_MakeWindowExist((Tk_Window)winPtr2); } cmapList[i] = winPtr2; } @@ -1800,7 +1800,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1931,7 +1931,7 @@ WmForgetCmd( TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window)winPtr; if (Tk_IsTopLevel(frameWin)) { MacDrawable *macWin; @@ -2007,7 +2007,7 @@ WmFrameCmd( } window = wmPtr->reparent; if (window == None) { - window = Tk_WindowId((Tk_Window) winPtr); + window = Tk_WindowId((Tk_Window)winPtr); } sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)window); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); @@ -2040,7 +2040,7 @@ WmGeometryCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); char xSign = '+', ySign = '+'; int width, height, x = wmPtr->x, y= wmPtr->y; char *argv3; @@ -2166,7 +2166,7 @@ WmGridCmd( errorMsg = "heightInc can't be <= 0"; goto error; } - Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc, + Tk_SetGrid((Tk_Window)winPtr, reqWidth, reqHeight, widthInc, heightInc); } wmPtr->flags |= WM_UPDATE_SIZE_HINTS; @@ -2287,12 +2287,12 @@ WmIconbitmapCmd( } str = Tcl_GetStringFromObj(objv[3], &len); if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { TkMacOSXMakeRealWindowExist(winPtr); } - if (WmSetAttribute(winPtr, TkMacOSXDrawableWindow(winPtr->window), interp, + if (WmSetAttribute(winPtr, TkMacOSXGetNSWindowForDrawable(winPtr->window), interp, WMATT_TITLEPATH, objv[3]) == TCL_OK) { if (!len) { if (wmPtr->hints.icon_pixmap != None) { @@ -2302,7 +2302,7 @@ WmIconbitmapCmd( wmPtr->hints.flags &= ~IconPixmapHint; } } else { - pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, Tk_GetUid(str)); + pixmap = Tk_GetBitmap(interp, (Tk_Window)winPtr, Tk_GetUid(str)); if (pixmap == None) { return TCL_ERROR; } @@ -2343,7 +2343,7 @@ WmIconifyCmd( return TCL_ERROR; } - if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { + if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); @@ -2725,7 +2725,7 @@ WmIconwindowCmd( if (wmPtr->icon != NULL) { TkWindow *oldIcon = (TkWindow *)wmPtr->icon; WmInfo *wmPtr3 = oldIcon->wmInfoPtr; - NSWindow *win = TkMacOSXDrawableWindow(oldIcon->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window); /* * The old icon should be withdrawn. @@ -2740,7 +2740,7 @@ WmIconwindowCmd( wmPtr->hints.icon_window = Tk_WindowId(tkwin2); wmPtr->hints.flags |= IconWindowHint; wmPtr->icon = tkwin2; - wmPtr2->iconFor = (Tk_Window) winPtr; + wmPtr2->iconFor = (Tk_Window)winPtr; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { /* * If the window is in normal or zoomed state, the icon should be @@ -2781,7 +2781,7 @@ WmManageCmd( TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window)winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { @@ -2800,7 +2800,7 @@ WmManageCmd( if (wmPtr == NULL) { TkWmNewWindow(winPtr); if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); macWin = (MacDrawable *) winPtr->window; } } @@ -2955,7 +2955,7 @@ WmOverrideredirectCmd( { int flag; XSetWindowAttributes atts; - TKWindow *win = (TKWindow *)TkMacOSXDrawableWindow(winPtr->window); + TKWindow *win = (TKWindow *)TkMacOSXGetNSWindowForDrawable(winPtr->window); if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2964,7 +2964,7 @@ WmOverrideredirectCmd( if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - Tk_Attributes((Tk_Window) winPtr)->override_redirect)); + Tk_Attributes((Tk_Window)winPtr)->override_redirect)); return TCL_OK; } @@ -2972,7 +2972,7 @@ WmOverrideredirectCmd( return TCL_ERROR; } atts.override_redirect = flag ? True : False; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); + Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); ApplyContainerOverrideChanges(winPtr, win); return TCL_OK; } @@ -3095,7 +3095,7 @@ WmProtocolCmd( return TCL_OK; } - protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3])); + protocol = Tk_InternAtom((Tk_Window)winPtr, Tcl_GetString(objv[3])); if (objc == 4) { /* * Return the command to handle a given protocol. @@ -3333,7 +3333,7 @@ WmStackorderCmd( resultObj = Tcl_NewObj(); for (windowPtr = windows; *windowPtr ; windowPtr++) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj((Tk_Window) *windowPtr)); + TkNewWindowObj((Tk_Window)*windowPtr)); } Tcl_SetObjResult(interp, resultObj); ckfree(windows); @@ -3482,7 +3482,7 @@ WmStateCmd( break; case OPT_ICONIC: - if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { + if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); @@ -3698,7 +3698,7 @@ WmTransientCmd( transient->flags |= WITHDRAWN_BY_CONTAINER; } - wmPtr->master = (Tk_Window) containerPtr; + wmPtr->master = (Tk_Window)containerPtr; } ApplyContainerOverrideChanges(winPtr, NULL); return TCL_OK; @@ -4039,7 +4039,7 @@ TopLevelEventProc( Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL); - Tk_DestroyWindow((Tk_Window) winPtr); + Tk_DestroyWindow((Tk_Window)winPtr); Tk_DeleteErrorHandler(handler); } if (wmTracing) { @@ -4253,7 +4253,7 @@ UpdateGeometryInfo( wmPtr->x = wmPtr->y = 0; wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); - Tk_GeometryRequest((Tk_Window) contWinPtr, width, height); + Tk_GeometryRequest((Tk_Window)contWinPtr, width, height); } return; } @@ -4543,7 +4543,7 @@ Tk_GetRootCoords( x -= winPtr->changes.x + winPtr->changes.border_width; y -= winPtr->changes.y + winPtr->changes.border_width; - tkMacOSXEmbedHandler->getOffsetProc((Tk_Window) winPtr, + tkMacOSXEmbedHandler->getOffsetProc((Tk_Window)winPtr, &theOffset); x += theOffset.h; @@ -4673,7 +4673,7 @@ Tk_CoordsToWindow( if (winPtr->mainPtr != ((TkWindow *)tkwin)->mainPtr) { return NULL; } - return (Tk_Window) winPtr; + return (Tk_Window)winPtr; } /* @@ -4766,7 +4766,7 @@ Tk_TopCoordsToWindow( } *newX = x; *newY = y; - return (Tk_Window) winPtr; + return (Tk_Window)winPtr; } /* @@ -4988,7 +4988,7 @@ TkWmRestackToplevel( wmPtr->hints.initial_state == WithdrawnState) { return; } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (macWindow == nil) { return; } @@ -5004,7 +5004,7 @@ TkWmRestackToplevel( otherWmPtr->hints.initial_state == WithdrawnState) { return; } - otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window); + otherMacWindow = TkMacOSXGetNSWindowForDrawable(otherPtr->window); if (otherMacWindow == nil) { return; } @@ -5346,7 +5346,7 @@ TkSetWMName( } NSString *title = [[NSString alloc] initWithUTF8String:titleUid]; - [TkMacOSXDrawableWindow(winPtr->window) setTitle:title]; + [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title]; [title release]; } @@ -5458,7 +5458,7 @@ MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { - NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); return [macWindow isZoomed]; } @@ -5613,7 +5613,7 @@ TkUnsupported1ObjCmd( return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - TkMacOSXInDarkMode((Tk_Window) winPtr))); + TkMacOSXInDarkMode((Tk_Window)winPtr))); return TCL_OK; default: return TCL_ERROR; @@ -5840,7 +5840,7 @@ WmWinTabbingId( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200) Tcl_Obj *result = NULL; NSString *idString; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (win) { idString = win.tabbingIdentifier; result = Tcl_NewStringObj(idString.UTF8String, [idString length]); @@ -5930,7 +5930,7 @@ WmWinAppearance( #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 const char *resultString = "unrecognized"; - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (win) { appearance = win.appearance.name; if (appearance == nil) { @@ -6042,7 +6042,7 @@ TkMacOSXMakeRealWindowExist( WmInfo *wmPtr = winPtr->wmInfoPtr; MacDrawable *macWin; WindowClass macClass; - Bool overrideRedirect = Tk_Attributes((Tk_Window) winPtr)->override_redirect; + Bool overrideRedirect = Tk_Attributes((Tk_Window)winPtr)->override_redirect; if (TkMacOSXHostToplevelExists(winPtr)) { return; @@ -6069,7 +6069,7 @@ TkMacOSXMakeRealWindowExist( Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container"); } if (tkMacOSXEmbedHandler->containerExistProc && - tkMacOSXEmbedHandler->containerExistProc((Tk_Window) winPtr) + tkMacOSXEmbedHandler->containerExistProc((Tk_Window)winPtr) != TCL_OK) { Tcl_Panic("ContainerExistProc could not make container"); } @@ -6158,7 +6158,7 @@ TkMacOSXMakeRealWindowExist( XSetWindowAttributes atts; atts.override_redirect = True; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); + Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts); ApplyContainerOverrideChanges(winPtr, NULL); } } @@ -6191,7 +6191,7 @@ TkpRedrawWidget(Tk_Window tkwin) { if ([NSApp isDrawing]) { return; } - w = TkMacOSXDrawableWindow(winPtr->window); + w = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (w) { TKContentView *view = [w contentView]; TkMacOSXWinBounds(winPtr, &tkBounds); @@ -6400,10 +6400,10 @@ TkpWmSetState( return; } - macWin = TkMacOSXDrawableWindow(winPtr->window); + macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window); if (state == WithdrawnState) { - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == IconicState) { /* @@ -6415,9 +6415,9 @@ TkpWmSetState( ![macWin isMiniaturized]) { [macWin miniaturize:NSApp]; } - Tk_UnmapWindow((Tk_Window) winPtr); + Tk_UnmapWindow((Tk_Window)winPtr); } else if (state == NormalState || state == ZoomState) { - Tk_MapWindow((Tk_Window) winPtr); + Tk_MapWindow((Tk_Window)winPtr); [macWin deminiaturize:NSApp]; [macWin orderFront:NSApp]; TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut); @@ -6576,7 +6576,7 @@ TkpChangeFocus( } if (Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr)) { - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window); TkWmRestackToplevel(winPtr, Above, NULL); if (force) { @@ -6631,7 +6631,7 @@ WmStackorderToplevelWrapperMap( if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr) && (winPtr->display == display)) { hPtr = Tcl_CreateHashEntry(table, - (char*) TkMacOSXDrawableWindow(winPtr->window), &newEntry); + (void *)TkMacOSXGetNSWindowForDrawable(winPtr->window), &newEntry); Tcl_SetHashValue(hPtr, winPtr); } @@ -6751,7 +6751,7 @@ ApplyWindowAttributeFlagChanges( if (!create) { return; } - Tk_MakeWindowExist((Tk_Window) winPtr); + Tk_MakeWindowExist((Tk_Window)winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { if (!create) { @@ -6759,7 +6759,7 @@ ApplyWindowAttributeFlagChanges( } TkMacOSXMakeRealWindowExist(winPtr); } - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); } if ((changedAttributes & kWindowCloseBoxAttribute) || initial) { [[macWindow standardWindowButton:NSWindowCloseButton] @@ -6931,7 +6931,7 @@ ApplyContainerOverrideChanges( if (!macWindow && winPtr->window != None && TkMacOSXHostToplevelExists(winPtr)) { - macWindow = TkMacOSXDrawableWindow(winPtr->window); + macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window); } styleMask = [macWindow styleMask]; @@ -7007,7 +7007,7 @@ ApplyContainerOverrideChanges( if (containerWinPtr && (containerWinPtr->window != None) && TkMacOSXHostToplevelExists(containerWinPtr)) { - NSWindow *containerMacWin = TkMacOSXDrawableWindow( + NSWindow *containerMacWin = TkMacOSXGetNSWindowForDrawable( containerWinPtr->window); /* diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 37d3631..95c72c4 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -547,7 +547,7 @@ static void DrawListHeader( * So we have to query the Apple window manager. */ - NSWindow *win = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); + NSWindow *win = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin)); CGFloat *bgRGBA = [win isKeyWindow] ? activeBgRGBA : inactiveBgRGBA; CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; -- cgit v0.12