diff options
author | fvogel <fvogelnew1@free.fr> | 2021-04-24 20:53:10 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2021-04-24 20:53:10 (GMT) |
commit | 6473e4dfc9b2c58fd9625f4d5ade3acf9b91793d (patch) | |
tree | 82f357a486f2070b829e8d4cae10016c9f0ed634 /macosx | |
parent | ac33a82c8bcfde7c5fc782bfab34c2dfc21cbab5 (diff) | |
parent | 8c01d5fea4cbdd448a644bfaf18e9dfc96843b61 (diff) | |
download | tk-6473e4dfc9b2c58fd9625f4d5ade3acf9b91793d.zip tk-6473e4dfc9b2c58fd9625f4d5ade3acf9b91793d.tar.gz tk-6473e4dfc9b2c58fd9625f4d5ade3acf9b91793d.tar.bz2 |
merge core-8-6-branch
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/GNUmakefile | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXDefault.h | 18 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 78 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXRegion.c | 49 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 3 | ||||
-rw-r--r-- | macosx/ttkMacOSXTheme.c | 11 |
8 files changed, 112 insertions, 62 deletions
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile index ff028b5..dd4c025 100644 --- a/macosx/GNUmakefile +++ b/macosx/GNUmakefile @@ -46,12 +46,6 @@ TK_X11 ?= # Checks and overrides for subframework builds ifeq (${SUBFRAMEWORK}_${TK_X11},1_) -ifeq (${DYLIB_INSTALL_DIR},) - @echo "Cannot install subframework with empty DYLIB_INSTALL_DIR !" && false -endif -ifeq (${DESTDIR},) - @echo "Cannot install subframework with empty DESTDIR !" && false -endif override BUILD_DIR = ${DESTDIR}/build override INSTALL_PATH = /Frameworks endif @@ -145,9 +139,9 @@ wish := ${wish}-X11 override EMBEDDED_BUILD := endif -INSTALL_TARGETS = install-binaries install-libraries +INSTALL_TARGETS = install-binaries install-libraries install-headers ifeq (${EMBEDDED_BUILD},) -INSTALL_TARGETS += install-private-headers install-headers install-demos +INSTALL_TARGETS += install-private-headers install-demos endif ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment) INSTALL_TARGETS += html-tk diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index edcd5d3..f82305e 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -326,7 +326,7 @@ GetRGBA( #endif } else if (entry->index == selectedTabTextIndex) { int OSVersion = [NSApp macOSVersion]; - if (OSVersion > 100600 && OSVersion < 110000) { + if (OSVersion > 100600 && OSVersion < 101600) { color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; } else { color = [[NSColor textColor] colorUsingColorSpace:sRGB]; diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index af0a06b..15677a1 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -124,7 +124,7 @@ #define DEF_CANVAS_CURSOR "" #define DEF_CANVAS_HEIGHT "7c" #define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG -#define DEF_CANVAS_HIGHLIGHT BLACK +#define DEF_CANVAS_HIGHLIGHT NORMAL_FG #define DEF_CANVAS_HIGHLIGHT_WIDTH "3" #define DEF_CANVAS_INSERT_BG BLACK #define DEF_CANVAS_INSERT_BD_COLOR "0" @@ -174,7 +174,7 @@ #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG -#define DEF_ENTRY_HIGHLIGHT BLACK +#define DEF_ENTRY_HIGHLIGHT NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" #define DEF_ENTRY_INSERT_BG NORMAL_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" @@ -212,7 +212,7 @@ #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG -#define DEF_FRAME_HIGHLIGHT BLACK +#define DEF_FRAME_HIGHLIGHT NORMAL_FG #define DEF_FRAME_HIGHLIGHT_WIDTH "0" #define DEF_FRAME_PADX "0" #define DEF_FRAME_PADY "0" @@ -248,7 +248,7 @@ #define DEF_LISTBOX_FG NORMAL_FG #define DEF_LISTBOX_HEIGHT "10" #define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG -#define DEF_LISTBOX_HIGHLIGHT BLACK +#define DEF_LISTBOX_HIGHLIGHT NORMAL_FG #define DEF_LISTBOX_HIGHLIGHT_WIDTH "0" #define DEF_LISTBOX_JUSTIFY "left" #define DEF_LISTBOX_RELIEF "solid" @@ -343,7 +343,7 @@ #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO -#define DEF_MENUBUTTON_HIGHLIGHT BLACK +#define DEF_MENUBUTTON_HIGHLIGHT NORMAL_FG #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "1" @@ -373,7 +373,7 @@ #define DEF_MESSAGE_FG NORMAL_FG #define DEF_MESSAGE_FONT "TkDefaultFont" #define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG -#define DEF_MESSAGE_HIGHLIGHT BLACK +#define DEF_MESSAGE_HIGHLIGHT NORMAL_FG #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX "-1" @@ -439,7 +439,7 @@ #define DEF_SCALE_FROM "0" #define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR #define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO -#define DEF_SCALE_HIGHLIGHT BLACK +#define DEF_SCALE_HIGHLIGHT NORMAL_FG #define DEF_SCALE_HIGHLIGHT_WIDTH "0" #define DEF_SCALE_LABEL "" #define DEF_SCALE_LENGTH "100" @@ -474,7 +474,7 @@ #define DEF_SCROLLBAR_CURSOR "" #define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1" #define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG -#define DEF_SCROLLBAR_HIGHLIGHT BLACK +#define DEF_SCROLLBAR_HIGHLIGHT NORMAL_FG #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" @@ -501,7 +501,7 @@ #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" #define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG -#define DEF_TEXT_HIGHLIGHT BLACK +#define DEF_TEXT_HIGHLIGHT NORMAL_FG #define DEF_TEXT_HIGHLIGHT_WIDTH "3" #define DEF_TEXT_INSERT_BG NORMAL_FG #define DEF_TEXT_INSERT_BD_COLOR "0" diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index ac5c721..bf6a4a7 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -513,7 +513,7 @@ XDrawSegments( * * XFillPolygon -- * - * Draws a filled polygon. + * Draws a filled polygon using the even-odd fill algorithm, * * Results: * None. @@ -531,7 +531,7 @@ XFillPolygon( GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ - TCL_UNUSED(int), /* Shape to draw. */ + TCL_UNUSED(int), /* Shape to draw. */ int mode) /* Drawing mode. */ { MacDrawable *macWin = (MacDrawable *)d; @@ -1300,7 +1300,6 @@ TkMacOSXSetupDrawingContext( dc.portBounds = CGContextGetClipBoundingBox(dc.context); } else { NSRect drawingBounds, currentBounds; - dc.view = view; dc.context = GET_CGCONTEXT; dc.portBounds = NSRectToCGRect([view bounds]); @@ -1355,37 +1354,46 @@ TkMacOSXSetupDrawingContext( * Finish configuring the drawing context. */ - { - CGAffineTransform t = { - .a = 1, .b = 0, - .c = 0, .d = -1, - .tx = 0, - .ty = dc.portBounds.size.height - }; + 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) { + 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) { #ifdef TK_MAC_DEBUG_DRAWING - 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); + 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 */ + if (!HIShapeIsRectangular(dc.clipRgn)) { + + /* + * We expect the clipping path dc.clipRgn to consist of the + * bounding rectangle of the drawable window, together with + * disjoint smaller rectangles inside of it which bound its + * geometric children. In that case the even-odd rule will + * clip to the region inside the large rectangle and outside + * of the smaller rectangles. + */ + + ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); + CGContextEOClip(dc.context); + } + else { 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); - } + HIShapeGetBounds(dc.clipRgn, &r); + CGContextClipToRect(dc.context, r); } } if (gc) { @@ -1405,8 +1413,8 @@ TkMacOSXSetupDrawingContext( TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); if (view) { - CGContextSetPatternPhase(dc.context, CGSizeMake( - dc.portBounds.size.width, dc.portBounds.size.height)); + CGContextSetPatternPhase(dc.context, + CGSizeMake(dc.portBounds.size.width, dc.portBounds.size.height)); } if (gc->function != GXcopy) { TkMacOSXDbgMsg("Logical functions other than GXcopy are " @@ -1446,13 +1454,9 @@ TkMacOSXSetupDrawingContext( end: #ifdef TK_MAC_DEBUG_DRAWING - if (!canDraw && win != NULL) { - TkWindow *winPtr = TkMacOSXGetTkWindow(win); - - if (winPtr) { - fprintf(stderr, "Cannot draw in %s - postponing.\n", - Tk_PathName(winPtr)); - } + if (!canDraw && macDraw->winPtr != NULL) { + fprintf(stderr, "Cannot draw in %s - postponing.\n", + Tk_PathName(macDraw->winPtr)); } #endif diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ed24255..0bd46c6 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -231,7 +231,8 @@ MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape, const CGRect *inRect); MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1, HIShapeRef inShape2, HIMutableShapeRef outResult); - +MODULE_SCOPE int TkMacOSXCountRectsInRegion(HIShapeRef shape); +MODULE_SCOPE void TkMacOSXPrintRectsInRegion(HIShapeRef shape); /* * Prototypes of TkAqua internal procs. */ diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 6c70a63..3c168f1 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -555,6 +555,55 @@ TkMacOSHIShapeUnion( return result; } +static OSStatus +rectCounter( + int msg, + TCL_UNUSED(HIShapeRef), + const CGRect *rect, + void *ref) +{ + int *count = (int *)ref; + (*count)++; + return noErr; +} + +static OSStatus +rectPrinter( + int msg, + TCL_UNUSED(HIShapeRef), + const CGRect *rect, + void *ref) +{ + if (rect) { + printf(" %s\n", NSStringFromRect(*rect).UTF8String); + } + return noErr; +} + +int +TkMacOSXCountRectsInRegion( + HIShapeRef shape) +{ + int rect_count = 0; + if (!HIShapeIsEmpty(shape)) { + ChkErr(HIShapeEnumerate, shape, + kHIShapeParseFromBottom|kHIShapeParseFromLeft, + rectCounter, &rect_count); + } + return rect_count; +} + +void +TkMacOSXPrintRectsInRegion( + HIShapeRef shape) +{ + if (!HIShapeIsEmpty(shape)) { + ChkErr(HIShapeEnumerate, shape, + kHIShapeParseFromBottom|kHIShapeParseFromLeft, + rectPrinter, NULL); + } +} + /* * Local Variables: * mode: objc diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 3c23308..4f073d8 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6309,8 +6309,7 @@ TkpRedrawWidget(Tk_Window tkwin) { [view bounds].size.height - tkBounds.bottom, tkBounds.right - tkBounds.left, tkBounds.bottom - tkBounds.top); - [view setTkNeedsDisplay:YES]; - [view setTkDirtyRect:bounds]; + [view addTkDirtyRect:bounds]; } } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 92c5156..8379812 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -36,10 +36,13 @@ * Macros for handling drawing contexts. */ -#define BEGIN_DRAWING(d) { \ - TkMacOSXDrawingContext dc; \ - if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) {return;} -#define END_DRAWING \ +#define BEGIN_DRAWING(d) { \ + TkMacOSXDrawingContext dc; \ + if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) { \ + return; \ + } \ + +#define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} #define HIOrientation kHIThemeOrientationNormal |