Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In aqua, add contrasting field backgrounds and focus rings to dark mode ttk::entry widgets. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | core-8-6-branch |
Files: | files | file ages | folders |
SHA3-256: |
55f9f7b5bde5c52f5174cf88958592ae |
User & Date: | culler 2019-06-01 18:11:14.240 |
Context
2019-06-05
| ||
07:23 | Use single-argument "expr" as much as possible. Not complete yet, but most trivial places are done. check-in: f7ecfdcb user: jan.nijtmans tags: core-8-6-branch | |
2019-06-03
| ||
18:59 | Fix bug [9ebc6fd168]: Aqua can report incorrect mouse coordinates. Closed-Leaf check-in: 6ebb742a user: culler tags: bug-9ebc6fd168 | |
2019-06-01
| ||
18:11 | In aqua, add contrasting field backgrounds and focus rings to dark mode ttk::entry widgets. check-in: 56e8b684 user: culler tags: trunk | |
18:11 | In aqua, add contrasting field backgrounds and focus rings to dark mode ttk::entry widgets. check-in: 55f9f7b5 user: culler tags: core-8-6-branch | |
03:30 | Fix bug [817d3ef132]: Aqua ttk::entry needs contrasting field background and focus ring in dark mode. Closed-Leaf check-in: b5497be5 user: culler tags: bug-817d3ef132 | |
2019-05-27
| ||
21:13 | Merge 8.5 check-in: d7d2f71f user: jan.nijtmans tags: core-8-6-branch | |
Changes
Changes to macosx/ttkMacOSXTheme.c.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | }; static CGFloat darkDisabledButtonFace[4] = { 86.0 / 255, 87.0 / 255, 89.0 / 255, 1.0 }; static CGFloat darkInactiveSelectedTab[4] = { 159.0 / 255, 160.0 / 255, 161.0 / 255, 1.0 }; static CGFloat darkTabSeparator[4] = {0.0, 0.0, 0.0, 0.25}; static CGFloat darkTrack[4] = {1.0, 1.0, 1.0, 0.25}; static CGFloat darkFrameTop[4] = {1.0, 1.0, 1.0, 0.0625}; static CGFloat darkFrameBottom[4] = {1.0, 1.0, 1.0, 0.125}; static CGFloat darkFrameAccent[4] = {0.0, 0.0, 0.0, 0.0625}; static CGFloat darkTopGradient[8] = { 1.0, 1.0, 1.0, 0.3, | > > > > > > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | }; static CGFloat darkDisabledButtonFace[4] = { 86.0 / 255, 87.0 / 255, 89.0 / 255, 1.0 }; static CGFloat darkInactiveSelectedTab[4] = { 159.0 / 255, 160.0 / 255, 161.0 / 255, 1.0 }; static CGFloat darkFocusRing[4] = { 38.0 / 255, 113.0 / 255, 159.0 / 255, 1.0 }; static CGFloat darkFocusRingTop[4] = { 50.0 / 255, 124.0 / 255, 171.0 / 255, 1.0 }; static CGFloat darkFocusRingBottom[4] = { 57.0 / 255, 130.0 / 255, 176.0 / 255, 1.0 }; static CGFloat darkTabSeparator[4] = {0.0, 0.0, 0.0, 0.25}; static CGFloat darkTrack[4] = {1.0, 1.0, 1.0, 0.25}; static CGFloat darkFrameTop[4] = {1.0, 1.0, 1.0, 0.0625}; static CGFloat darkFrameBottom[4] = {1.0, 1.0, 1.0, 0.125}; static CGFloat darkFrameAccent[4] = {0.0, 0.0, 0.0, 0.0625}; static CGFloat darkTopGradient[8] = { 1.0, 1.0, 1.0, 0.3, |
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | components: fill count:4]; CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGContextFillRect(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkFrame -- * * This is a standalone drawing procedure which draws various * types of borders in Dark Mode. */ static void DrawDarkFrame( CGRect bounds, CGContextRef context, HIThemeFrameKind kind) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint topPart[4] = { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | components: fill count:4]; CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGContextFillRect(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkFocusRing -- * * This is a standalone drawing procedure which draws a focus ring around * an Entry widget in Dark Mode. */ static void DrawDarkFocusRing( CGRect bounds, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *strokeColor; NSColor *fillColor = [NSColor colorWithColorSpace:deviceRGB components:darkFocusRing count:4]; CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint topPart[4] = { {x, y + h}, {x, y + 1}, {x + w - 1, y + 1}, {x + w - 1, y + h} }; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGRect outerRect = CGRectInset(bounds, -3, -3); CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); CGContextBeginPath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: darkFocusRingTop count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, topPart, 4); CGContextStrokePath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: darkFocusRingBottom count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); CGContextSetShouldAntialias(context, true); CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGPathRef path = CGPathCreateWithRoundedRect(outerRect, 4, 4, NULL); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextAddRect(context, bounds); CGContextEOFillPath(context); CGContextRestoreGState(context); } /*---------------------------------------------------------------------- * +++ DrawDarkFrame -- * * This is a standalone drawing procedure which draws various * types of borders in Dark Mode. */ static void DrawDarkFrame( CGRect bounds, CGContextRef context, HIThemeFrameKind kind) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint topPart[4] = { {x, y + h - 1}, {x, y + 1}, {x + w, y + 1}, {x + w, y + h - 1} }; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGPoint accent[2] = {{x, y + 1}, {x + w, y + 1}}; switch (kind) { case kHIThemeFrameTextFieldSquare: CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); |
︙ | ︙ | |||
1609 1610 1611 1612 1613 1614 1615 | void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { | | | 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 | void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(7, 5, 7, 6); } static void EntryElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, |
︙ | ︙ | |||
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 | static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND; if (TkMacOSXInDarkMode(tkwin)) { BEGIN_DRAWING(d) NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGFloat fill[4]; GetBackgroundColor(dc.context, tkwin, 1, fill); background = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; CGContextSetFillColorWithColor(dc.context, CGCOLOR(background)); CGContextFillRect(dc.context, bounds); | > > > > > > > > > > > | > | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND; if (TkMacOSXInDarkMode(tkwin)) { BEGIN_DRAWING(d) NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGFloat fill[4]; GetBackgroundColor(dc.context, tkwin, 1, fill); /* * Lighten the background to provide contrast. */ for (int i = 0; i < 3; i++) { fill[i] += 9.0 / 255.0; } background = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; CGContextSetFillColorWithColor(dc.context, CGCOLOR(background)); CGContextFillRect(dc.context, bounds); if (state & TTK_STATE_FOCUS) { DrawDarkFocusRing(bounds, dc.context); } else { DrawDarkFrame(bounds, dc.context, kHIThemeFrameTextFieldSquare); } END_DRAWING } else { const HIThemeFrameDrawInfo info = { .version = 0, .kind = kHIThemeFrameTextFieldSquare, .state = Ttk_StateTableLookup(ThemeStateTable, state), .isFocused = state & TTK_STATE_FOCUS, |
︙ | ︙ |