diff options
author | fvogel <fvogelnew1@free.fr> | 2021-02-07 14:13:12 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2021-02-07 14:13:12 (GMT) |
commit | 5ac177d8b7ba2c140be617fd51f93a47371010e0 (patch) | |
tree | 8f9ba952171d097a4f4690d2866f4ab1953da4dc /macosx | |
parent | be15eb0425347728672456a9bd76bad012ffaedd (diff) | |
parent | 9c29a905fa4d7ec4c5aa8528475f312dc3d39dab (diff) | |
download | tk-5ac177d8b7ba2c140be617fd51f93a47371010e0.zip tk-5ac177d8b7ba2c140be617fd51f93a47371010e0.tar.gz tk-5ac177d8b7ba2c140be617fd51f93a47371010e0.tar.bz2 |
Merge 8.6
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXBitmap.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXButton.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.h | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXCursor.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 29 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 52 | ||||
-rw-r--r-- | macosx/tkMacOSXEmbed.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXImage.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 40 | ||||
-rw-r--r-- | macosx/tkMacOSXKeysyms.h | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 19 | ||||
-rw-r--r-- | macosx/tkMacOSXMenubutton.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXNotify.c | 29 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXTest.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 22 | ||||
-rw-r--r-- | macosx/ttkMacOSXTheme.c | 24 |
21 files changed, 169 insertions, 136 deletions
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 4c77d92..4f51fc6 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -257,7 +257,7 @@ TkpGetNativeAppBitmap( if (iconBitmapTable.buckets && (hPtr = Tcl_FindHashEntry(&iconBitmapTable, name))) { OSType type; - IconBitmap *iconBitmap = Tcl_GetHashValue(hPtr); + IconBitmap *iconBitmap = (IconBitmap *)Tcl_GetHashValue(hPtr); name = NULL; size = NSMakeSize(iconBitmap->width, iconBitmap->height); switch (iconBitmap->kind) { @@ -403,7 +403,7 @@ TkMacOSXIconBitmapObjCmd( } hPtr = Tcl_CreateHashEntry(&iconBitmapTable, name, &isNew); if (!isNew) { - iconBitmap = Tcl_GetHashValue(hPtr); + iconBitmap = (IconBitmap *)Tcl_GetHashValue(hPtr); ckfree(iconBitmap->value); } else { iconBitmap = (IconBitmap *)ckalloc(sizeof(IconBitmap)); diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 857ce34..b083531 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -181,8 +181,8 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - MacButton *macButtonPtr = clientData; - TkButton *butPtr = clientData; + MacButton *macButtonPtr = (MacButton *)clientData; + TkButton *butPtr = (TkButton *)clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams* dpPtr = &macButtonPtr->drawParams; @@ -901,8 +901,8 @@ ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkButton *buttonPtr = clientData; - MacButton *mbPtr = clientData; + TkButton *buttonPtr = (TkButton *)clientData; + MacButton *mbPtr = (MacButton *)clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { @@ -957,7 +957,7 @@ TkMacOSXComputeButtonParams( *btnkind = kThemePushButton; } - if ((butPtr->image == None) && (butPtr->bitmap == None)) { + if ((butPtr->image == NULL) && (butPtr->bitmap == None)) { switch (butPtr->type) { case TYPE_BUTTON: *btnkind = kThemePushButton; @@ -1174,7 +1174,7 @@ TkMacOSXComputeButtonDrawParams( static void PulseDefaultButtonProc(ClientData clientData) { - MacButton *mbPtr = clientData; + MacButton *mbPtr = (MacButton *)clientData; TkpDisplayButton(clientData); /* diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 0f4518d..deffbbc 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -250,7 +250,7 @@ static SystemColorDatum systemColorData[] = { {"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL }, {"SeparatorColor", semantic, 0, "grayColor", 0, NULL }, {"UnemphasizedSelectedTextBackgroundColor", semantic, 0, "grayColor", 0, NULL }, -{NULL, 0, 0, NULL, 0, NULL } +{NULL, rgbColor, 0, NULL, 0, NULL } }; #endif diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 191aa7e..dc5b61a 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -551,7 +551,7 @@ TkpSetCursor( return; } - if (cursor == None) { + if (cursor == NULL) { /* * This is a little tricky. We can't really tell whether * gCurrentCursor is NULL because it was NULL last time around or diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 89035ab..4bcaedf 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -221,7 +221,7 @@ getFileURL( returnCode: (NSModalResponse) returnCode contextInfo: (void *) contextInfo { - FilePanelCallbackInfo *callbackInfo = contextInfo; + FilePanelCallbackInfo *callbackInfo = (FilePanelCallbackInfo *)contextInfo; if (returnCode == modalOK) { Tcl_Obj *resultObj; @@ -266,7 +266,7 @@ getFileURL( - (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo { - AlertCallbackInfo *callbackInfo = contextInfo; + AlertCallbackInfo *callbackInfo = (AlertCallbackInfo *)contextInfo; if (returnCode >= NSAlertFirstButtonReturn) { Tcl_Obj *resultObj = Tcl_NewStringObj(alertButtonStrings[ @@ -422,7 +422,7 @@ Tk_ChooseColorObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int result = TCL_ERROR; - Tk_Window parent, tkwin = clientData; + Tk_Window parent, tkwin = (Tk_Window)clientData; const char *title = NULL; int i; NSColor *color = nil, *initialColor = nil; @@ -677,7 +677,7 @@ Tk_GetOpenFileObjCmd( 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, multiple = 0; @@ -1679,10 +1679,10 @@ FontchooserEvent( if (!fontchooserInterp) { return; } - fcdPtr = Tcl_GetAssocData(fontchooserInterp, "::tk::fontchooser", NULL); + fcdPtr = (FontchooserData *)Tcl_GetAssocData(fontchooserInterp, "::tk::fontchooser", NULL); switch (kind) { case FontchooserClosed: - if (fcdPtr->parent != None) { + if (fcdPtr->parent != NULL) { TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL); fontchooserInterp = NULL; } @@ -1738,7 +1738,7 @@ FontchooserCget( switch(optionIndex) { case FontchooserParent: - if (fcdPtr->parent != None) { + if (fcdPtr->parent != NULL) { resObj = Tcl_NewStringObj( ((TkWindow *)fcdPtr->parent)->pathName, -1); } else { @@ -1801,7 +1801,7 @@ FontchooserConfigureCmd( Tcl_Obj *const objv[]) { Tk_Window tkwin = (Tk_Window)clientData; - FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", + FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); int i, r = TCL_OK; @@ -1858,7 +1858,7 @@ FontchooserConfigureCmd( Tk_Window parent = Tk_NameToWindow(interp, Tcl_GetString(objv[i+1]), tkwin); - if (parent == None) { + if (parent == NULL) { return TCL_ERROR; } if (fcdPtr->parent) { @@ -1885,7 +1885,7 @@ FontchooserConfigureCmd( fcdPtr->titleObj = NULL; } break; - case FontchooserFont: + case FontchooserFont: { Tcl_GetStringFromObj(objv[i+1], &len); if (len) { Tk_Font f = Tk_AllocFontFromObj(interp, tkwin, objv[i+1]); @@ -1919,6 +1919,7 @@ FontchooserConfigureCmd( "TkFontchooserFontChanged", NULL); } break; + } case FontchooserCmd: if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); @@ -1964,10 +1965,10 @@ FontchooserShowCmd( TCL_UNUSED(int), TCL_UNUSED(Tcl_Obj *const *)) { - FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", + FontchooserData *fcdPtr = (FontchooserData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); - if (fcdPtr->parent == None) { + if (fcdPtr->parent == NULL) { fcdPtr->parent = (Tk_Window)clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); @@ -2042,7 +2043,7 @@ FontchooserParentEventHandler( ClientData clientData, XEvent *eventPtr) { - FontchooserData *fcdPtr = clientData; + FontchooserData *fcdPtr = (FontchooserData *)clientData; if (eventPtr->type == DestroyNotify) { Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask, @@ -2074,7 +2075,7 @@ DeleteFontchooserData( ClientData clientData, Tcl_Interp *interp) { - FontchooserData *fcdPtr = clientData; + FontchooserData *fcdPtr = (FontchooserData *)clientData; if (fcdPtr->titleObj) { Tcl_DecrRefCount(fcdPtr->titleObj); diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 22b6a45..ac5c721 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1355,35 +1355,37 @@ TkMacOSXSetupDrawingContext( * Finish configuring the drawing context. */ - CGAffineTransform t = { - .a = 1, .b = 0, - .c = 0, .d = -1, - .tx = 0, - .ty = dc.portBounds.size.height - }; - - dc.portBounds.origin.x += macDraw->xOff; - dc.portBounds.origin.y += macDraw->yOff; - CGContextSaveGState(dc.context); - CGContextSetTextDrawingMode(dc.context, kCGTextFill); - CGContextConcatCTM(dc.context, t); - if (dc.clipRgn) { + { + CGAffineTransform t = { + .a = 1, .b = 0, + .c = 0, .d = -1, + .tx = 0, + .ty = dc.portBounds.size.height + }; -#ifdef TK_MAC_DEBUG_DRAWING + dc.portBounds.origin.x += macDraw->xOff; + dc.portBounds.origin.y += macDraw->yOff; CGContextSaveGState(dc.context); - ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); - CGContextEOFillPath(dc.context); - CGContextRestoreGState(dc.context); -#endif /* TK_MAC_DEBUG_DRAWING */ + CGContextSetTextDrawingMode(dc.context, kCGTextFill); + CGContextConcatCTM(dc.context, t); + if (dc.clipRgn) { - CGRect r; - CGRect b = CGRectApplyAffineTransform( - CGContextGetClipBoundingBox(dc.context), t); - if (!HIShapeIsRectangular(dc.clipRgn) || - !CGRectContainsRect(*HIShapeGetBounds(dc.clipRgn, &r), b)) { +#ifdef TK_MAC_DEBUG_DRAWING + CGContextSaveGState(dc.context); ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); - CGContextEOClip(dc.context); + CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); + CGContextEOFillPath(dc.context); + CGContextRestoreGState(dc.context); +#endif /* TK_MAC_DEBUG_DRAWING */ + + CGRect r; + CGRect b = CGRectApplyAffineTransform( + CGContextGetClipBoundingBox(dc.context), t); + if (!HIShapeIsRectangular(dc.clipRgn) || + !CGRectContainsRect(*HIShapeGetBounds(dc.clipRgn, &r), b)) { + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextEOClip(dc.context); + } } } if (gc) { diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index dc43726..4af2e75 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -739,7 +739,7 @@ EmbeddedEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); @@ -774,7 +774,7 @@ ContainerEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Container *containerPtr; Tk_ErrorHandler errHandler; @@ -882,7 +882,7 @@ EmbedStructureProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { @@ -891,7 +891,7 @@ EmbedStructureProc( * Send a ConfigureNotify to the embedded application. */ - if (containerPtr->embeddedPtr != None) { + if (containerPtr->embeddedPtr != NULL) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->embedded != None) { @@ -936,7 +936,7 @@ EmbedActivateProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; if (containerPtr->embeddedPtr != NULL) { if (eventPtr->type == ActivateNotify) { @@ -971,7 +971,7 @@ EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Display *display; XEvent event; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index ca370f3..2a28f73 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -112,7 +112,7 @@ static int CreateNamedSystemFont(Tcl_Interp *interp, self = [self init]; if (self) { Tcl_DStringInit(&_ds); - Tcl_UtfToUniCharDString(bytes, len, &_ds); + Tcl_UtfToUniCharDString((const char *)bytes, len, &_ds); _string = [[NSString alloc] initWithCharactersNoCopy:(unichar *)Tcl_DStringValue(&_ds) length:Tcl_DStringLength(&_ds)>>1 diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 74c0115..69967af 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -82,7 +82,7 @@ TkMacOSXCreateCGImageWithXImage( *destPtr++ = xBitReverseTable[(unsigned char)(*(srcPtr++))]; } } else { - data = memcpy(ckalloc(len), image->data + image->xoffset, len); + data = (char *)memcpy(ckalloc(len), image->data + image->xoffset, len); } if (data) { provider = CGDataProviderCreateWithData(data, data, len, @@ -112,7 +112,7 @@ TkMacOSXCreateCGImageWithXImage( bitmapInfo = (image->byte_order == MSBFirst ? kCGBitmapByteOrder32Little : kCGBitmapByteOrder32Big); bitmapInfo |= kCGImageAlphaLast; - data = memcpy(ckalloc(len), image->data + image->xoffset, len); + data = (char *)memcpy(ckalloc(len), image->data + image->xoffset, len); if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); @@ -332,7 +332,7 @@ XCreateImage( XImage *ximage; display->request++; - ximage = ckalloc(sizeof(XImage)); + ximage = (XImage *)ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; @@ -645,7 +645,7 @@ XGetImage( NSBitmapImageRep* bitmapRep = nil; NSUInteger bitmap_fmt = 0; XImage* imagePtr = NULL; - char* bitmap = NULL; + char *bitmap = NULL; char R, G, B, A; int depth = 32, offset = 0, bitmap_pad = 0; unsigned int bytes_per_row, size, row, n, m; @@ -668,7 +668,7 @@ XGetImage( bitmap_fmt = [bitmapRep bitmapFormat]; size = [bitmapRep bytesPerPlane]; bytes_per_row = [bitmapRep bytesPerRow]; - bitmap = ckalloc(size); + bitmap = (char *)ckalloc(size); if (!bitmap || (bitmap_fmt != 0 && bitmap_fmt != 1) || [bitmapRep samplesPerPixel] != 4 diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 1dc3982..8d93cd4 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -53,7 +53,7 @@ static NSUInteger textInputModifiers; TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr; Tk_Window tkwin = (Tk_Window)winPtr; NSEventType type = [theEvent type]; - NSUInteger virtual = [theEvent keyCode]; + NSUInteger virt = [theEvent keyCode]; NSUInteger modifiers = ([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask); XEvent xEvent; @@ -126,7 +126,7 @@ static NSUInteger textInputModifiers; TKLog(@"-[%@(%p) %s] repeat=%d mods=%x char=%x code=%lu c=%d type=%d", [self class], self, _cmd, (type == NSKeyDown) && [theEvent isARepeat], modifiers, keychar, - virtual, w, type); + virt, w, type); #endif } @@ -215,7 +215,7 @@ static NSUInteger textInputModifiers; macKC.v.o_s = ((modifiers & NSShiftKeyMask ? INDEX_SHIFT : 0) | (modifiers & NSAlternateKeyMask ? INDEX_OPTION : 0)); - macKC.v.virtual = virtual; + macKC.v.virt = virt; switch (type) { case NSFlagsChanged: @@ -349,9 +349,9 @@ static NSUInteger textInputModifiers; UniChar lowChar = [str characterAtIndex:++i]; macKC.v.keychar = CFStringGetLongCharacterForSurrogatePair( (UniChar)keychar, lowChar); - macKC.v.virtual = NON_BMP_VIRTUAL; + macKC.v.virt = NON_BMP_VIRTUAL; } else if (repRange.location == 0 || sendingIMEText) { - macKC.v.virtual = REPLACEMENT_VIRTUAL; + macKC.v.virt = REPLACEMENT_VIRTUAL; } else { macKC.uint = TkMacOSXAddVirtual(macKC.uint); xEvent.xkey.state |= INDEX2STATE(macKC.x.xvirtual); diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index b9bf3be..9aca9e1 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -143,7 +143,7 @@ static BOOL keyboardChanged = YES; static void InitHashTables(void); static void UpdateKeymaps(void); static int KeyDataToUnicode(UniChar *uniChars, int maxChars, - UInt16 keyaction, UInt32 virtual, UInt32 modifiers, + UInt16 keyaction, UInt32 virt, UInt32 modifiers, UInt32 * deadKeyStatePtr); #pragma mark TKApplication(TKKeyboard) @@ -190,15 +190,15 @@ InitHashTables(void) Tcl_InitHashTable(&special2keysym, TCL_ONE_WORD_KEYS); Tcl_InitHashTable(&keysym2keycode, TCL_ONE_WORD_KEYS); - for (kPtr = keyArray; kPtr->virtual != 0; kPtr++) { + for (kPtr = keyArray; kPtr->virt != 0; kPtr++) { MacKeycode macKC; macKC.v.o_s = 0; - hPtr = Tcl_CreateHashEntry(&special2keysym, INT2PTR(kPtr->virtual), + hPtr = Tcl_CreateHashEntry(&special2keysym, INT2PTR(kPtr->virt), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(kPtr->keysym)); hPtr = Tcl_CreateHashEntry(&keysym2keycode, INT2PTR(kPtr->keysym), &dummy); - macKC.v.virtual = kPtr->virtual; + macKC.v.virt = kPtr->virt; macKC.v.keychar = kPtr->keychar; Tcl_SetHashValue(hPtr, INT2PTR(macKC.uint)); @@ -254,7 +254,7 @@ UpdateKeymaps() { static Bool keymapInitialized = false; Tcl_HashEntry *hPtr; - int virtual, index, dummy; + int virt, index, dummy; if (!keymapInitialized) { Tcl_InitHashTable(&unichar2xvirtual, TCL_ONE_WORD_KEYS); @@ -270,12 +270,12 @@ UpdateKeymaps() */ for (index = 3; index >= 0; index--) { - for (virtual = 0; virtual < 128; virtual++) { + for (virt = 0; virt < 128; virt++) { MacKeycode macKC; - macKC.v = (keycode_v) {.virtual = virtual, .o_s = index, .keychar = 0}; + macKC.v = (keycode_v) {.virt = virt, .o_s = index, .keychar = 0}; int modifiers = INDEX2CARBON(index), result; UniChar keychar = 0; - result = KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, virtual, + result = KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, virt, modifiers, NULL); if (keychar == 0x10) { @@ -286,7 +286,7 @@ UpdateKeymaps() continue; } macKC.v.keychar = keychar; - if (! ON_KEYPAD(virtual)) { + if (! ON_KEYPAD(virt)) { hPtr = Tcl_CreateHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(macKC.x.xvirtual)); @@ -328,7 +328,7 @@ KeyDataToUnicode( UniChar *uniChars, int maxChars, UInt16 keyaction, - UInt32 virtual, + UInt32 virt, UInt32 modifiers, UInt32 *deadKeyStatePtr) { @@ -357,14 +357,14 @@ KeyDataToUnicode( UInt32 dummyState; OSStatus err; - virtual &= 0xFF; + virt &= 0xFF; modifiers = (modifiers >> 8) & 0xFF; if (!deadKeyStatePtr) { options = kUCKeyTranslateNoDeadKeysMask; dummyState = 0; deadKeyStatePtr = &dummyState; } - err = ChkErr(UCKeyTranslate, layoutData, virtual, keyaction, modifiers, + err = ChkErr(UCKeyTranslate, (const UCKeyboardLayout *)layoutData, virt, keyaction, modifiers, keyboardType, options, deadKeyStatePtr, maxChars, &actuallength, uniChars); if (!actuallength && *deadKeyStatePtr) { @@ -426,7 +426,7 @@ XkbKeycodeToKeysym( * an Fn function key or Tab, Backspace, Home, End, etc. */ - hPtr = Tcl_FindHashEntry(&special2keysym, INT2PTR(macKC.v.virtual)); + hPtr = Tcl_FindHashEntry(&special2keysym, INT2PTR(macKC.v.virt)); if (hPtr != NULL) { return (KeySym) Tcl_GetHashValue(hPtr); } @@ -437,7 +437,7 @@ XkbKeycodeToKeysym( * keysym. */ - if (macKC.v.virtual > 127) { + if (macKC.v.virt > 127) { hPtr = Tcl_FindHashEntry(&unichar2keysym, INT2PTR(macKC.v.keychar)); if (hPtr != NULL) { return (KeySym) Tcl_GetHashValue(hPtr); @@ -452,7 +452,7 @@ XkbKeycodeToKeysym( */ modifiers = INDEX2CARBON(macKC.v.o_s); - result = KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, macKC.v.virtual, + result = KeyDataToUnicode(&keychar, 1, kUCKeyActionDown, macKC.v.virt, modifiers, NULL); if (result) { hPtr = Tcl_FindHashEntry(&unichar2keysym, INT2PTR(keychar)); @@ -639,7 +639,7 @@ XKeysymToKeycode( hPtr = Tcl_FindHashEntry(&keysym2keycode, INT2PTR(keysym)); if (hPtr != NULL) { - return (KeyCode) Tcl_GetHashValue(hPtr); + return (KeyCode) PTR2INT(Tcl_GetHashValue(hPtr)); } /* @@ -647,7 +647,7 @@ XKeysymToKeycode( * else. */ - macKC.v.virtual = NO_VIRTUAL; + macKC.v.virt = NO_VIRTUAL; macKC.v.o_s = 0; macKC.v.keychar = 0; @@ -721,7 +721,7 @@ TkpSetKeycodeAndState( if (macKC.v.keychar < 0xF700) { UniChar keychar = macKC.v.keychar; NSString *str, *lower, *upper; - if (macKC.v.virtual != NO_VIRTUAL) { + if (macKC.v.virt != NO_VIRTUAL) { macKC.x.keychar = xvirtual2unichar[macKC.x.xvirtual]; } else { str = [[NSString alloc] initWithCharacters:&keychar length:1]; @@ -783,7 +783,7 @@ TkpGetKeySym( */ if (macKC.v.keychar == MOD_KEYCHAR) { - switch (macKC.v.virtual) { + switch (macKC.v.virt) { case 54: return XK_Meta_R; case 55: @@ -955,7 +955,7 @@ TkMacOSXAddVirtual( unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } else { - macKC.v.virtual = NO_VIRTUAL; + macKC.v.virt = NO_VIRTUAL; } return macKC.uint; } diff --git a/macosx/tkMacOSXKeysyms.h b/macosx/tkMacOSXKeysyms.h index da364ea..0b528f3 100644 --- a/macosx/tkMacOSXKeysyms.h +++ b/macosx/tkMacOSXKeysyms.h @@ -31,7 +31,7 @@ */ typedef struct { - int virtual; /* value of [NSEvent keyCode] */ + int virt; /* value of [NSEvent keyCode] */ KeySym keysym; /* X11 keysym */ KeyCode keychar; /* XEvent keycode & 0xFFFF */ } KeyInfo; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 0604708..1af18c4 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -236,7 +236,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (TkMenu *) tkMenu { - return _tkMenu; + return (TkMenu *)_tkMenu; } - (int) tkIndexOfItem: (NSMenuItem *) menuItem @@ -413,7 +413,7 @@ TKBackgroundLoop *backgroundLoop = nil; (void)menu; if (_tkMenu) { - RecursivelyClearActiveMenu(_tkMenu); + RecursivelyClearActiveMenu((TkMenu *)_tkMenu); } } @@ -437,7 +437,7 @@ TKBackgroundLoop *backgroundLoop = nil; Tcl_Preserve(interp); Tcl_Preserve(menuPtr); - int result = TkPostCommand(_tkMenu); + int result = TkPostCommand(menuPtr); if (result!=TCL_OK && result!=TCL_CONTINUE && result!=TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (menu preprocess)"); @@ -695,7 +695,7 @@ TkpConfigureMenuEntry( Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight); image = TkMacOSXGetNSImageFromTkImage(mePtr->menuPtr->display, mePtr->image, imageWidth, imageHeight); - } else if (mePtr->bitmapPtr != None) { + } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin, mePtr->bitmapPtr); @@ -708,9 +708,14 @@ TkpConfigureMenuEntry( [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && mePtr->labelLength) { - title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr) - length:mePtr->labelLength encoding:NSUTF8StringEncoding] - autorelease]; + Tcl_DString ds; + Tcl_DStringInit(&ds); + Tcl_UtfToUniCharDString(Tcl_GetString(mePtr->labelPtr), + mePtr->labelLength, &ds); + title = [[NSString alloc] + initWithCharacters:(unichar *)Tcl_DStringValue(&ds) + length:Tcl_DStringLength(&ds)>>1]; + Tcl_DStringFree(&ds); if ([title hasSuffix:@"..."]) { title = [NSString stringWithFormat:@"%@%C", [title substringToIndex:[title length] - 3], 0x2026]; diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 2fad3cb..6291596 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -165,8 +165,8 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - MacMenuButton *mbPtr = clientData; - TkMenuButton *butPtr = clientData; + MacMenuButton *mbPtr = (MacMenuButton *)clientData; + TkMenuButton *butPtr = (TkMenuButton *)clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams *dpPtr = &mbPtr->drawParams; @@ -240,8 +240,8 @@ TkpDestroyMenuButton( */ void -TkpComputeMenuButtonGeometry(butPtr) - TkMenuButton *butPtr; /* Widget record for menu button. */ +TkpComputeMenuButtonGeometry( + TkMenuButton *butPtr) /* Widget record for menu button. */ { int width, height, avgWidth, haveImage = 0, haveText = 0; int txtWidth, txtHeight; @@ -689,8 +689,8 @@ MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenuButton *buttonPtr = clientData; - MacMenuButton *mbPtr = clientData; + TkMenuButton *buttonPtr = (TkMenuButton *)clientData; + MacMenuButton *mbPtr = (MacMenuButton *)clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 4b65fd8..f32fa76 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -16,7 +16,32 @@ #include "tkMacOSXPrivate.h" #include "tkMacOSXEvent.h" #include "tkMacOSXConstants.h" -#include <tclInt.h> + +#ifdef USE_TCL_STUBS +#ifdef __cplusplus +extern "C" { +#endif +/* Little hack to eliminate the need for "tclInt.h" here: + Just copy a small portion of TclIntPlatStubs, just + enough to make it work. See [600b72bfbc] */ +typedef struct { + int magic; + void *hooks; + void (*dummy[19]) (void); /* dummy entries 0-18, not used */ + void (*tclMacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 19 */ +} TclIntPlatStubs; +extern const TclIntPlatStubs *tclIntPlatStubsPtr; +#ifdef __cplusplus +} +#endif +#define TclMacOSXNotifierAddRunLoopMode \ + (tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode) /* 19 */ +#elif TCL_MINOR_VERSION < 7 + extern void TclMacOSXNotifierAddRunLoopMode(const void *runLoopMode); +#else + extern void Tcl_MacOSXNotifierAddRunLoopMode(const void *runLoopMode); +# define TclMacOSXNotifierAddRunLoopMode Tcl_MacOSXNotifierAddRunLoopMode +#endif #import <objc/objc-auto.h> /* This is not used for anything at the moment. */ @@ -25,7 +50,7 @@ typedef struct ThreadSpecificData { } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; -#define TSD_INIT() ThreadSpecificData *tsdPtr = \ +#define TSD_INIT() ThreadSpecificData *tsdPtr = (ThreadSpecificData *) \ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)) static void TkMacOSXNotifyExitHandler(ClientData clientData); diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ea53e5f..ed24255 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -135,7 +135,7 @@ typedef struct keycode_v_t { unsigned keychar: 22; /* UCS-32 character */ unsigned o_s: 2; /* State of Option and Shift keys. */ - unsigned virtual: 8; /* 8-bit virtual keycode - identifies a key. */ + unsigned virt: 8; /* 8-bit virtual keycode - identifies a key. */ } keycode_v; typedef struct keycode_x_t { @@ -157,7 +157,7 @@ typedef union MacKeycode_t { * Note that 0x7f is del and 0xF8FF is the Apple Logo character. */ -#define ON_KEYPAD(virtual) ((virtual >= 0x41) && (virtual <= 0x5C)) +#define ON_KEYPAD(virt) ((virt >= 0x41) && (virt <= 0x5C)) #define IS_PRINTABLE(keychar) ((keychar >= 0x20) && (keychar != 0x7f) && \ ((keychar < 0xF700) || keychar >= 0xF8FF)) diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 2d9a038..b6e3298 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -246,7 +246,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; @@ -456,10 +456,10 @@ TkpDestroyScrollbar( { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; - if (macScrollPtr->troughGC != None) { + if (macScrollPtr->troughGC != NULL) { Tk_FreeGC(scrollPtr->display, macScrollPtr->troughGC); } - if (macScrollPtr->copyGC != None) { + if (macScrollPtr->copyGC != NULL) { Tk_FreeGC(scrollPtr->display, macScrollPtr->copyGC); } } @@ -769,7 +769,7 @@ ScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; switch (eventPtr->type) { case UnmapNotify: @@ -783,10 +783,10 @@ ScrollbarEventProc( case ButtonRelease: case EnterNotify: case LeaveNotify: - ScrollbarEvent(clientData, eventPtr); + ScrollbarEvent(scrollPtr, eventPtr); break; default: - TkScrollbarEventProc(clientData, eventPtr); + TkScrollbarEventProc(scrollPtr, eventPtr); } } diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index d220895..2a6a04c 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -982,7 +982,7 @@ InvalViewRect( void *ref) { static CGAffineTransform t; - TKContentView *view = ref; + TKContentView *view = (TKContentView *)ref; NSRect dirtyRect; if (!view) { @@ -1467,7 +1467,7 @@ Tk_FreePixmap( display->request++; if (macPix->context) { - char *data = CGBitmapContextGetData(macPix->context); + char *data = (char *)CGBitmapContextGetData(macPix->context); if (data) { ckfree(data); diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 7981f7e..5d7e626 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -376,7 +376,7 @@ InjectKeyEventObjCmd( characters:chars charactersIgnoringModifiers:unmod isARepeat:NO - keyCode:macKC.v.virtual]; + keyCode:macKC.v.virt]; [NSApp postEvent:keyEvent atStart:NO]; return TCL_OK; } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 045d8d2..3c23308 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1482,7 +1482,7 @@ WmSetAttribute( } break; case WMATT_TITLEPATH: { - const char *path = Tcl_FSGetNativePath(value); + const char *path = (const char *)Tcl_FSGetNativePath(value); NSString *filename = @""; if (path && *path) { @@ -1636,7 +1636,7 @@ WmAttributesCmd( Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(NULL, result, - WmGetAttribute(winPtr, macWindow, attribute)); + WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute)); } Tcl_SetObjResult(interp, result); } else if (objc == 4) { /* wm attributes $win -attribute */ @@ -1644,7 +1644,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, attribute)); + Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute)); } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ int i; @@ -1653,7 +1653,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - if (WmSetAttribute(winPtr, macWindow, interp, attribute, objv[i+1]) + if (WmSetAttribute(winPtr, macWindow, interp, (WmAttribute)attribute, objv[i+1]) != TCL_OK) { return TCL_ERROR; } @@ -4128,7 +4128,7 @@ TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE; if (eventPtr->type == DestroyNotify) { @@ -4214,7 +4214,7 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; @@ -5593,8 +5593,8 @@ TkMacOSXZoomToplevel( void *whichWindow, /* The Macintosh window to zoom. */ short zoomPart) /* Either inZoomIn or inZoomOut */ { - NSWindow *window = whichWindow; - TkWindow *winPtr = TkMacOSXGetTkWindow(window); + NSWindow *window = (NSWindow *)whichWindow; + TkWindow *winPtr = (TkWindow *)TkMacOSXGetTkWindow(window); WmInfo *wmPtr; if (!winPtr || !winPtr->wmInfoPtr) { @@ -5651,7 +5651,7 @@ TkUnsupported1ObjCmd( enum SubCmds { TKMWS_STYLE, TKMWS_TABID, TKMWS_APPEARANCE, TKMWS_ISDARK }; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; int index; @@ -6717,7 +6717,7 @@ TkWmStackorderToplevel( for (NSWindow *w in backToFront) { hPtr = Tcl_FindHashEntry(&table, (char*) w); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *windowPtr++ = childWinPtr; } } @@ -7042,7 +7042,7 @@ ApplyContainerOverrideChanges( [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } - if (wmPtr->container != None) { + if (wmPtr->container != NULL) { TkWindow *containerWinPtr = (TkWindow *)wmPtr->container; if (containerWinPtr && (containerWinPtr->window != None) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 1d65b3c..92c5156 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -1379,7 +1379,7 @@ static void ButtonElementSize( int *minHeight, Ttk_Padding *paddingPtr) { - ThemeButtonParams *params = clientData; + ThemeButtonParams *params = (ThemeButtonParams *)clientData; const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, 0, tkwin); static const CGRect scratchBounds = {{0, 0}, {100, 100}}; @@ -1425,7 +1425,7 @@ static void ButtonElementDraw( Ttk_Box b, Ttk_State state) { - ThemeButtonParams *params = clientData; + ThemeButtonParams *params = (ThemeButtonParams *)clientData; CGRect bounds = BoxToRect(d, b); HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, state, tkwin); @@ -1769,7 +1769,7 @@ static void EntryElementDraw( Ttk_Box b, Ttk_State state) { - EntryElement *e = elementRecord; + EntryElement *e = (EntryElement *)elementRecord; Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3)); CGRect bounds = BoxToRect(d, inner); NSColor *background; @@ -2142,8 +2142,8 @@ static void TrackElementDraw( Ttk_Box b, Ttk_State state) { - TrackElementData *data = clientData; - TrackElement *elem = elementRecord; + TrackElementData *data = (TrackElementData *)clientData; + TrackElement *elem = (TrackElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; CGRect bounds; @@ -2288,7 +2288,7 @@ static void PbarElementDraw( Ttk_Box b, Ttk_State state) { - PbarElement *pbar = elementRecord; + PbarElement *pbar = (PbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL, phase = 0, kind; /* @@ -2387,7 +2387,7 @@ static void TroughElementSize( int *minHeight, Ttk_Padding *paddingPtr) { - ScrollbarElement *scrollbar = elementRecord; + ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; @@ -2428,7 +2428,7 @@ static void TroughElementDraw( Ttk_Box b, TCL_UNUSED(Ttk_State)) { - ScrollbarElement *scrollbar = elementRecord; + ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; @@ -2470,7 +2470,7 @@ static void ThumbElementSize( int *minHeight, TCL_UNUSED(Ttk_Padding *)) { - ScrollbarElement *scrollbar = elementRecord; + ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); @@ -2491,7 +2491,7 @@ static void ThumbElementDraw( Ttk_Box b, Ttk_State state) { - ScrollbarElement *scrollbar = elementRecord; + ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); @@ -2906,7 +2906,7 @@ static void FieldElementDraw( Ttk_Box b, TCL_UNUSED(Ttk_State)) { - FieldElement *e = elementRecord; + FieldElement *e = (FieldElement *)elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); @@ -2998,7 +2998,7 @@ static void TreeHeaderElementDraw( Ttk_Box b, Ttk_State state) { - ThemeButtonParams *params = clientData; + ThemeButtonParams *params = (ThemeButtonParams *)clientData; CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, |