From c24b589a6b793f5112cd11f613af9aa7ae10b55f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 6 Aug 2020 16:16:16 +0000 Subject: Add stub entry for XLowerWindow() on MacOS (no idea why this was commented out, windows and X11 already had this) More use of TCL_UNUSED() --- generic/tkInt.decls | 3 +++ generic/tkIntXlibDecls.h | 8 +++++--- generic/tkStubInit.c | 2 +- macosx/tkMacOSXBitmap.c | 10 +++++----- macosx/tkMacOSXClipboard.c | 8 ++++---- macosx/tkMacOSXServices.c | 15 +++++++++------ macosx/tkMacOSXSubwindows.c | 19 +++++++++---------- macosx/tkMacOSXTest.c | 17 ++++++++--------- macosx/ttkMacOSXTheme.c | 6 +++--- 9 files changed, 47 insertions(+), 41 deletions(-) diff --git a/generic/tkInt.decls b/generic/tkInt.decls index f6e7ea9..37557f5 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1844,6 +1844,9 @@ declare 112 aqua { declare 114 aqua { VisualID XVisualIDFromVisual(Visual *visual) } +declare 129 aqua { + int XLowerWindow(Display *d, Window w) +} declare 137 aqua { int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index f1b0018..7626d9d 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -743,7 +743,8 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual); /* Slot 126 is reserved */ /* Slot 127 is reserved */ /* Slot 128 is reserved */ -/* Slot 129 is reserved */ +/* 129 */ +EXTERN int XLowerWindow(Display *d, Window w); /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ @@ -1074,7 +1075,7 @@ typedef struct TkIntXlibStubs { void (*reserved126)(void); void (*reserved127)(void); void (*reserved128)(void); - void (*reserved129)(void); + int (*xLowerWindow) (Display *d, Window w); /* 129 */ void (*reserved130)(void); void (*reserved131)(void); void (*reserved132)(void); @@ -1636,7 +1637,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; /* Slot 126 is reserved */ /* Slot 127 is reserved */ /* Slot 128 is reserved */ -/* Slot 129 is reserved */ +#define XLowerWindow \ + (tkIntXlibStubsPtr->xLowerWindow) /* 129 */ /* Slot 130 is reserved */ /* Slot 131 is reserved */ /* Slot 132 is reserved */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 4abc637..836f1d1 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -962,7 +962,7 @@ static const TkIntXlibStubs tkIntXlibStubs = { 0, /* 126 */ 0, /* 127 */ 0, /* 128 */ - 0, /* 129 */ + XLowerWindow, /* 129 */ 0, /* 130 */ 0, /* 131 */ 0, /* 132 */ diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 2b08235..c1b325a 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -44,7 +44,7 @@ static BuiltInIcon builtInIcons[] = { {"stop", kAlertStopIcon}, {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, - {NULL} + {NULL, 0} }; #define builtInIconSize 32 @@ -100,7 +100,7 @@ TkpDefineNativeBitmaps(void) name = Tk_GetUid(builtInPtr->name); predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew); if (isNew) { - TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap)); + TkPredefBitmap *predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = UINT2PTR(builtInPtr->iconType); predefPtr->width = builtInIconSize; @@ -343,7 +343,7 @@ TkpGetNativeAppBitmap( int TkMacOSXIconBitmapObjCmd( - ClientData clientData, /* Unused. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -398,7 +398,7 @@ TkMacOSXIconBitmapObjCmd( } } #endif - ib.value = ckalloc(len + 1); + ib.value = (char *)ckalloc(len + 1); strcpy(ib.value, value); if (!iconBitmapTable.buckets) { Tcl_InitHashTable(&iconBitmapTable, TCL_STRING_KEYS); @@ -408,7 +408,7 @@ TkMacOSXIconBitmapObjCmd( iconBitmap = Tcl_GetHashValue(hPtr); ckfree(iconBitmap->value); } else { - iconBitmap = ckalloc(sizeof(IconBitmap)); + iconBitmap = (IconBitmap *)ckalloc(sizeof(IconBitmap)); Tcl_SetHashValue(hPtr, iconBitmap); } *iconBitmap = ib; diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index be1f16c..bae2b89 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -177,7 +177,7 @@ XSetSelectionOwner( Display *display, /* X Display. */ Atom selection, /* What selection to own. */ Window owner, /* Window to be the owner. */ - Time time) /* The current time? */ + TCL_UNUSED(Time)) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); @@ -237,8 +237,8 @@ TkMacOSXSelDeadWindow( void TkSelUpdateClipboard( - TkWindow *winPtr, /* Window associated with clipboard. */ - TkClipboardTarget *targetPtr) + TCL_UNUSED(TkWindow *), /* Window associated with clipboard. */ + TCL_UNUSED(TkClipboardTarget *)) /* Info about the content. */ { NSPasteboard *pb = [NSPasteboard generalPasteboard]; @@ -294,7 +294,7 @@ TkSelEventProc( void TkSelPropProc( - XEvent *eventPtr) /* X PropertyChange event. */ + TCL_UNUSED(XEvent *)) /* X PropertyChange event. */ { } diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index 0434f10..59e3439 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -20,10 +20,11 @@ static int ServicesEventProc( - Tcl_Event *event, - int flags) + TCL_UNUSED(Tcl_Event *), + TCL_UNUSED(int)) { TkMainInfo *info = TkGetMainInfoList(); + Tcl_GlobalEval(info->interp, "::tk::mac::PerformService"); return 1; } @@ -43,8 +44,8 @@ ServicesEventProc( - (void) provideService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error; -- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard - types:(NSArray *)types; +- (BOOL) writeSelectionToPasteboard:(NSPasteboard *)pboard + types:(NSArray *)types; @end @@ -104,6 +105,8 @@ ServicesEventProc( NSString *pboardString = nil, *pboardType = nil; NSArray *types = [pboard types]; Tcl_Event *event; + (void)data; + (void)error; /* * Get a string from the private pasteboard and copy it to the general @@ -123,7 +126,7 @@ ServicesEventProc( [generalpasteboard declareTypes:[NSArray arrayWithObjects:pboardType, nil] owner:nil]; [generalpasteboard setString:pboardString forType:pboardType]; - event = ckalloc(sizeof(Tcl_Event)); + event = (Tcl_Event *)ckalloc(sizeof(Tcl_Event)); event->proc = ServicesEventProc; Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL); } @@ -137,7 +140,7 @@ ServicesEventProc( int TkMacOSXServices_Init( - Tcl_Interp *interp) + TCL_UNUSED(Tcl_Interp *)) { /* * Initialize an instance of TkService and register it with the NSApp. diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 8b316fa..899832b 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -51,7 +51,7 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr); int XDestroyWindow( - Display *display, /* Display. */ + TCL_UNUSED(Display *), /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; @@ -633,7 +633,6 @@ XRaiseWindow( return Success; } -#if 0 /* *---------------------------------------------------------------------- * @@ -650,7 +649,7 @@ XRaiseWindow( *---------------------------------------------------------------------- */ -void +int XLowerWindow( Display *display, /* Display. */ Window window) /* Window. */ @@ -661,12 +660,12 @@ XLowerWindow( if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Below, NULL); } else { - /* + /* * TODO: this should generate damage */ } + return Success; } -#endif /* *---------------------------------------------------------------------- @@ -691,7 +690,7 @@ XConfigureWindow( Display *display, /* Display. */ Window w, /* Window. */ unsigned int value_mask, - XWindowChanges *values) + TCL_UNUSED(XWindowChanges *)) { MacDrawable *macWin = (MacDrawable *) w; TkWindow *winPtr = macWin->winPtr; @@ -999,7 +998,7 @@ TkMacOSXVisableClipRgn( static OSStatus InvalViewRect( int msg, - HIShapeRef rgn, + TCL_UNUSED(HIShapeRef), const CGRect *rect, void *ref) { @@ -1134,7 +1133,7 @@ TkMacOSXDrawable( void * TkMacOSXGetDrawablePort( - Drawable drawable) + TCL_UNUSED(Drawable)) { return NULL; } @@ -1462,7 +1461,7 @@ UpdateOffsets( Pixmap Tk_GetPixmap( Display *display, /* Display for new pixmap (can be null). */ - Drawable d, /* Drawable where pixmap will be used (ignored). */ + TCL_UNUSED(Drawable), /* Drawable where pixmap will be used (ignored). */ int width, /* Dimensions of pixmap. */ int height, int depth) /* Bits per pixel for pixmap. */ @@ -1472,7 +1471,7 @@ Tk_GetPixmap( if (display != NULL) { display->request++; } - macPix = ckalloc(sizeof(MacDrawable)); + macPix = (MacDrawable *)ckalloc(sizeof(MacDrawable)); macPix->winPtr = NULL; macPix->xOff = 0; macPix->yOff = 0; diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index e5dcf5e..c70ecd5 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -26,11 +26,11 @@ static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #endif static int PressButtonObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); static int InjectKeyEventObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); static int MenuBarHeightObjCmd (ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + int objc, Tcl_Obj *const *objv); /* @@ -117,10 +117,10 @@ DebuggerObjCmd( static int MenuBarHeightObjCmd( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Not used. */ - int objc, /* Not used. */ - Tcl_Obj *const objv[]) /* Not used. */ + TCL_UNUSED(int), /* Not used. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Not used. */ { static int height = 0; if (height == 0) { @@ -188,10 +188,9 @@ TkTestLogDisplay( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int PressButtonObjCmd( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -267,7 +266,7 @@ PressButtonObjCmd( static int InjectKeyEventObjCmd( - ClientData clientData, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index f1b7b8e..b0be4e9 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -250,7 +250,7 @@ static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; */ static void GetBackgroundColor( - CGContextRef context, + TCL_UNUSED(CGContextRef), Tk_Window tkwin, int contrast, CGFloat *rgba) @@ -1039,7 +1039,7 @@ static void DrawDarkTab( static void DrawDarkSeparator( CGRect bounds, CGContextRef context, - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { static CGFloat fill[4] = {1.0, 1.0, 1.0, 0.3}; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; @@ -1165,7 +1165,7 @@ static void DrawDarkFrame( static void DrawDarkListHeader( CGRect bounds, CGContextRef context, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int state) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; -- cgit v0.12