summaryrefslogtreecommitdiffstats
path: root/macosx/ttkMacOSXTheme.c
diff options
context:
space:
mode:
authorculler <culler>2020-12-04 02:40:32 (GMT)
committerculler <culler>2020-12-04 02:40:32 (GMT)
commit07850a4b2aed6dbaa1b3b4764fbddca31e084b93 (patch)
treeffb1dfdd0c004edcddc6e1941a64d98de65dbb38 /macosx/ttkMacOSXTheme.c
parentf8572403aa0a51a44eb8944daddddac94bdbadf4 (diff)
downloadtk-07850a4b2aed6dbaa1b3b4764fbddca31e084b93.zip
tk-07850a4b2aed6dbaa1b3b4764fbddca31e084b93.tar.gz
tk-07850a4b2aed6dbaa1b3b4764fbddca31e084b93.tar.bz2
Fix [3ef77f434e]: Combobox focus ring is missing in Dark Mode.
Diffstat (limited to 'macosx/ttkMacOSXTheme.c')
-rw-r--r--macosx/ttkMacOSXTheme.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 1e7797d..b4ba894 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -1872,19 +1872,24 @@ static Ttk_ElementSpec EntryElementSpec = {
* 1 pixel to account for the fact that the button is not centered.
*/
-static Ttk_Padding ComboboxPadding = {4, 2, 20, 2};
+static Ttk_Padding ComboboxPadding = {4, 4, 20, 4};
+static Ttk_Padding DarkComboboxPadding = {6, 6, 22, 6};
static void ComboboxElementSize(
TCL_UNUSED(void *),
TCL_UNUSED(void *),
- TCL_UNUSED(Tk_Window),
+ Tk_Window tkwin,
int *minWidth,
int *minHeight,
Ttk_Padding *paddingPtr)
{
*minWidth = 24;
*minHeight = 23;
- *paddingPtr = ComboboxPadding;
+ if (TkMacOSXInDarkMode(tkwin)) {
+ *paddingPtr = DarkComboboxPadding;
+ } else {
+ *paddingPtr = ComboboxPadding;
+ }
}
static void ComboboxElementDraw(
@@ -1905,19 +1910,24 @@ static void ComboboxElementDraw(
};
BEGIN_DRAWING(d)
- bounds.origin.y += 1;
if (TkMacOSXInDarkMode(tkwin)) {
- bounds.size.height += 1;
+ bounds = CGRectInset(bounds, 3, 3);
+ if (state & TTK_STATE_FOCUS) {
+ DrawDarkFocusRing(bounds, dc.context);
+ }
DrawDarkButton(bounds, info.kind, state, dc.context);
- } else if ([NSApp macOSVersion] > 100800) {
- if ((state & TTK_STATE_BACKGROUND) &&
- !(state & TTK_STATE_DISABLED)) {
- NSColor *background = [NSColor textBackgroundColor];
- CGRect innerBounds = CGRectInset(bounds, 1, 2);
- SolidFillRoundedRectangle(dc.context, innerBounds, 4, background);
+ } else {
+ if ([NSApp macOSVersion] > 100800) {
+ if ((state & TTK_STATE_BACKGROUND) &&
+ !(state & TTK_STATE_DISABLED)) {
+ NSColor *background = [NSColor textBackgroundColor];
+ CGRect innerBounds = CGRectInset(bounds, 1, 4);
+ bounds.origin.y += 1;
+ SolidFillRoundedRectangle(dc.context, innerBounds, 4, background);
+ }
}
+ ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
}
- ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
END_DRAWING
}