Skip to content

Commit

Permalink
Bump minimum macOS version to 10.14
Browse files Browse the repository at this point in the history
See #800 for immediate motivation.
  • Loading branch information
vslavik committed Aug 31, 2023
1 parent 1b0940b commit afe1fe8
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 62 deletions.
4 changes: 2 additions & 2 deletions Poedit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@
"$(DEPS_BUILD_DIR)/icu/include",
);
LIBRARY_SEARCH_PATHS = "$(DEPS_BUILD_DIR)/icu/lib";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "";
POEDIT_FEATURES = "";
Expand Down Expand Up @@ -1875,7 +1875,7 @@
);
LIBRARY_SEARCH_PATHS = "$(DEPS_BUILD_DIR)/icu/lib";
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.14;
POEDIT_FEATURES = "";
POEDIT_VERSION = 3.3.2;
SDKROOT = macosx;
Expand Down
2 changes: 1 addition & 1 deletion deps/custom_build/third_party.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

MACOSX_DEPLOYMENT_TARGET = 10.13
MACOSX_DEPLOYMENT_TARGET = 10.14

SKIP_INSTALL = YES
COPY_PHASE_STRIP = NO
Expand Down
2 changes: 1 addition & 1 deletion deps/custom_build/wxcocoa.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WXTOOLKITUPPER = COCOA

#include "wx.xcconfig"

MACOSX_DEPLOYMENT_TARGET = 10.13
MACOSX_DEPLOYMENT_TARGET = 10.14

GCC_VERSION =

Expand Down
16 changes: 3 additions & 13 deletions src/colorscheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,8 @@ inline wxColour sRGB(int r, int g, int b, double a = 1.0)

inline bool IsDarkAppearance(NSAppearance *appearance)
{
if (@available(macOS 10.14, *))
{
NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
return [appearanceName isEqualToString:NSAppearanceNameDarkAqua];
}
else
{
return false;
}
NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
return [appearanceName isEqualToString:NSAppearanceNameDarkAqua];
}

#else
Expand Down Expand Up @@ -264,10 +257,7 @@ ColorScheme::Mode ColorScheme::GetAppMode()
if (!s_appModeDetermined)
{
#ifdef __WXOSX__
if (@available(macOS 10.14, *))
s_appMode = IsDarkAppearance(NSApp.effectiveAppearance) ? Dark : Light;
else
s_appMode = Light;
s_appMode = IsDarkAppearance(NSApp.effectiveAppearance) ? Dark : Light;
#else
auto colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
#if wxCHECK_VERSION(3,1,3)
Expand Down
30 changes: 13 additions & 17 deletions src/custom_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
{
self.title = label;
self.heading = heading;
self.buttonType = NSMomentaryPushInButton;
self.bezelStyle = NSTexturedRoundedBezelStyle;
self.buttonType = NSButtonTypeMomentaryPushIn;
self.bezelStyle = NSBezelStyleTexturedRounded;
self.showsBorderOnlyWhileMouseInside = YES;
self.mouseHover = NO;
}
Expand All @@ -97,13 +97,9 @@
NSColor *bg = self.window.backgroundColor;
if (self.mouseHover)
{
if (@available(macOS 10.14, *)) {
NSColor *highlight = [bg colorWithSystemEffect:NSColorSystemEffectRollover];
// use only lighter version of the highlight by blending with the background
bg = [bg blendedColorWithFraction:0.2 ofColor:highlight];
} else {
bg = [NSColor colorWithWhite:0.9 alpha:1.0];
}
NSColor *highlight = [bg colorWithSystemEffect:NSColorSystemEffectRollover];
// use only lighter version of the highlight by blending with the background
bg = [bg blendedColorWithFraction:0.2 ofColor:highlight];
}
[StyleKit drawActionButtonWithFrame:self.bounds
buttonColor:bg
Expand Down Expand Up @@ -172,8 +168,8 @@ ActionButton::ActionButton(wxWindow *parent, wxWindowID winid, const wxString& s
if (self)
{
self.title = label;
self.bezelStyle = NSSmallSquareBezelStyle;
self.buttonType = NSOnOffButton;
self.bezelStyle = NSBezelStyleSmallSquare;
self.buttonType = NSButtonTypeOnOff;
self.font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]];
self.animationPosition = 0.0;
self.onColor = [NSColor colorWithCalibratedRed:0.302 green:0.847 blue:0.396 alpha:1.0];
Expand Down Expand Up @@ -221,13 +217,13 @@ ActionButton::ActionButton(wxWindow *parent, wxWindowID winid, const wxString& s
if (state == self.state)
return;
[super setState:state];
self.animationPosition = (state == NSOnState) ? 1.0 : 0.0;
self.animationPosition = (state == NSControlStateValueOn) ? 1.0 : 0.0;
}

- (void)controlAction:(id)sender
{
#pragma unused(sender)
double target = (self.state == NSOnState) ? 1.0 : 0.0;
double target = (self.state == NSControlStateValueOn) ? 1.0 : 0.0;

[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context)
{
Expand Down Expand Up @@ -261,12 +257,12 @@ class SwitchButton::impl

void SetValue(bool value)
{
m_view.state = value ? NSOnState : NSOffState;
m_view.state = value ? NSControlStateValueOn : NSControlStateValueOff;
}

bool GetValue() const
{
return m_view.state == NSOnState;
return m_view.state == NSControlStateValueOn;
}

private:
Expand Down Expand Up @@ -574,8 +570,8 @@ bool SwitchButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
if (self)
{
self.title = label;
self.bezelStyle = NSRoundRectBezelStyle;
self.buttonType = NSMomentaryPushInButton;
self.bezelStyle = NSBezelStyleRoundRect;
self.buttonType = NSButtonTypeMomentaryPushIn;
self.font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
}
return self;
Expand Down
25 changes: 10 additions & 15 deletions src/customcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,16 @@ LearnMoreLink::LearnMoreLink(wxWindow *parent, const wxString& url, wxString lab
wxHyperlinkCtrl::Create(parent, winid, label, url);

#ifdef __WXOSX__
if (@available(macOS 10.14, *))
{
wxColour normal(NSColor.linkColor);
wxColour hover([NSColor.linkColor colorWithSystemEffect:NSColorSystemEffectRollover]);
SetNormalColour(normal);
SetVisitedColour(normal);
SetHoverColour(hover);
}
else
wxColour normal(NSColor.linkColor);
wxColour hover([NSColor.linkColor colorWithSystemEffect:NSColorSystemEffectRollover]);
SetNormalColour(normal);
SetVisitedColour(normal);
SetHoverColour(hover);
#else
SetNormalColour("#2F79BE");
SetVisitedColour("#2F79BE");
SetHoverColour("#3D8DD5");
#endif
{
SetNormalColour("#2F79BE");
SetVisitedColour("#2F79BE");
SetHoverColour("#3D8DD5");
}

#ifdef __WXOSX__
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
Expand Down Expand Up @@ -470,7 +465,7 @@ ImageButton::ImageButton(wxWindow *parent, const wxString& bitmapName)
#ifdef __WXOSX__
// don't light up the background when clicked:
NSButton *view = (NSButton*)GetHandle();
view.buttonType = NSMomentaryChangeButton;
view.buttonType = NSButtonTypeMomentaryChange;
#else
// refresh template icons on theme change (macOS handles automatically):
if (bitmapName.EndsWith("Template"))
Expand Down
2 changes: 1 addition & 1 deletion src/fileviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ FileViewer::FileViewer(wxWindow*)

m_openInEditor = new wxButton(panel, wxID_ANY, MSW_OR_OTHER(_("Open in editor"), _("Open in Editor")));
#ifdef __WXOSX__
static_cast<NSButton*>(m_openInEditor->GetHandle()).bezelStyle = NSRoundRectBezelStyle;
static_cast<NSButton*>(m_openInEditor->GetHandle()).bezelStyle = NSBezelStyleRoundRect;
#endif
m_topBarSizer->Add(m_openInEditor, wxSizerFlags().Center().ReserveSpaceEvenIfHidden().Border(wxLEFT, PX(10)));

Expand Down
16 changes: 4 additions & 12 deletions src/sidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,10 @@ class SuggestionWidget : public wxWindow
{
#ifdef __WXOSX__
auto winbg = GetBackgroundColour();
wxColour highlight;
if (@available(macOS 10.14, *))
{
NSColor *bg = winbg.OSXGetNSColor();
NSColor *osHighlight = [bg colorWithSystemEffect:NSColorSystemEffectRollover];
// use only lighter version of the highlight by blending with the background
highlight = wxColour([bg blendedColorWithFraction:0.2 ofColor:osHighlight]);
}
else
{
highlight = winbg.ChangeLightness(95);
}
NSColor *bg = winbg.OSXGetNSColor();
NSColor *osHighlight = [bg colorWithSystemEffect:NSColorSystemEffectRollover];
// use only lighter version of the highlight by blending with the background
auto highlight = wxColour([bg blendedColorWithFraction:0.2 ofColor:osHighlight]);
#else
auto highlight = m_bgHighlight;
#endif
Expand Down

0 comments on commit afe1fe8

Please sign in to comment.