From 829d3fd09420de82429546d0216f283208049fdf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 May 2021 16:06:10 +0100 Subject: [PATCH 1/3] Restore wxGrid cursor visibility under non-Mac platforms The changes of 3c28244806 (Improve wxGrid appearance in dark mode under macOS, 2020-08-07) resulted in using white highlight colour over white background under at least MSW and probably elsewhere, making the grid cursor invisible by default. Fix this by using wxSYS_COLOUR_WINDOWTEXT which must contrast with wxSYS_COLOUR_WINDOW used for the background colour. --- src/generic/grid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 41a11ccda6..19f60c9803 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3012,7 +3012,7 @@ void wxGrid::Init() m_gridLinesEnabled = true; m_gridLinesClipHorz = m_gridLinesClipVert = true; - m_cellHighlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + m_cellHighlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); m_cellHighlightPenWidth = 2; m_cellHighlightROPenWidth = 1; if ( wxSystemSettings::GetAppearance().IsDark() ) From 092bd7051973eb99784922962152bfad4b45d25a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 May 2021 16:13:18 +0100 Subject: [PATCH 2/3] Restore lighter shadow colours for wxGrid row/column separators This was also changed in 3c28244806 (Improve wxGrid appearance in dark mode under macOS, 2020-08-07) but there doesn't appear to be any good reason to do it as wxSYS_COLOUR_3DDKSHADOW is the same as the previously used wxSYS_COLOUR_3DSHADOW (a.k.a. wxSYS_COLOUR_BTNSHADOW) under Mac, so this didn't change anything there -- but did make the shadows darker and hence more pronounced and more noticeable under MSW. Undo this change to restore the old and nicer looking appearance. --- src/generic/grid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 19f60c9803..362f4d242d 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -312,7 +312,7 @@ void wxGridRowHeaderRendererDefault::DrawBorder(const wxGrid& grid, wxDC& dc, wxRect& rect) const { - dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW))); + dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW))); dc.DrawLine(rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); @@ -344,7 +344,7 @@ void wxGridColumnHeaderRendererDefault::DrawBorder(const wxGrid& grid, wxDC& dc, wxRect& rect) const { - dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW))); + dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW))); dc.DrawLine(rect.GetRight(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); dc.DrawLine(rect.GetLeft(), rect.GetBottom(), @@ -373,7 +373,7 @@ void wxGridCornerHeaderRendererDefault::DrawBorder(const wxGrid& grid, wxDC& dc, wxRect& rect) const { - dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW))); + dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW))); dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1, rect.GetRight() - 1, rect.GetTop()); dc.DrawLine(rect.GetRight() - 1, rect.GetBottom() - 1, From c31b32d7563ac35d49688b10015d324b894f9782 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 May 2021 16:15:24 +0100 Subject: [PATCH 3/3] Group the same colours together in Mac wxSystemSettings code No real changes, just make it more obvious that wxSYS_COLOUR_BTNSHADOW and wxSYS_COLOUR_3DDKSHADOW are mapped to the same colour under Mac. --- src/osx/cocoa/settings.mm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm index de5f52860c..c819deeb0c 100644 --- a/src/osx/cocoa/settings.mm +++ b/src/osx/cocoa/settings.mm @@ -122,6 +122,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) sysColor = [NSColor controlBackgroundColor]; break; case wxSYS_COLOUR_BTNSHADOW: + case wxSYS_COLOUR_3DDKSHADOW: sysColor = [NSColor controlShadowColor]; break; case wxSYS_COLOUR_BTNTEXT: @@ -142,9 +143,6 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_GRAYTEXT: sysColor = [NSColor disabledControlTextColor]; break; - case wxSYS_COLOUR_3DDKSHADOW: - sysColor = [NSColor controlShadowColor]; - break; case wxSYS_COLOUR_3DLIGHT: sysColor = [NSColor controlHighlightColor]; break;