diff options
author | culler <culler> | 2020-08-15 13:01:48 (GMT) |
---|---|---|
committer | culler <culler> | 2020-08-15 13:01:48 (GMT) |
commit | 5bf62fe2ba4d3ca755030e190515a1e46c6e0bc7 (patch) | |
tree | 5bfc8cc1820208af2da4946837fbc1cc8b9ee470 /macosx/tkMacOSXColor.c | |
parent | e4bdb863a0201c96d5114bd18b4468c9e7f7dcc9 (diff) | |
parent | 03dc2a80af3462e288ad3d46ff9ea29be67e0a4c (diff) | |
download | tk-5bf62fe2ba4d3ca755030e190515a1e46c6e0bc7.zip tk-5bf62fe2ba4d3ca755030e190515a1e46c6e0bc7.tar.gz tk-5bf62fe2ba4d3ca755030e190515a1e46c6e0bc7.tar.bz2 |
Fix [315104a5c1] - corrects and extends the virtual event notifications of appearance changes.
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r-- | macosx/tkMacOSXColor.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index b5ca43f..671583b 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -723,6 +723,7 @@ TkpGetColor( TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; + NSView *view = nil; static Bool initialized = NO; static NSColorSpace* sRGB = NULL; @@ -733,6 +734,8 @@ TkpGetColor( } if (tkwin) { display = Tk_Display(tkwin); + MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin); + view = TkMacOSXDrawableView(macWin); } /* @@ -754,12 +757,13 @@ TkpGetColor( CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 NSAppearance *savedAppearance = [NSAppearance currentAppearance]; - NSAppearance *windowAppearance; - if (TkMacOSXInDarkMode(tkwin)) { - windowAppearance = darkAqua; + NSAppearance *windowAppearance = savedAppearance; + if (view) { + windowAppearance = [view effectiveAppearance]; + } + if ([windowAppearance name] == NSAppearanceNameDarkAqua) { colormap = darkColormap; } else { - windowAppearance = lightAqua; colormap = lightColormap; } [NSAppearance setCurrentAppearance:windowAppearance]; |