From 278d98b2b673d778eb6077e7f030e99415a01a57 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 Jan 2020 23:21:08 +0000 Subject: [PATCH 1/3] OSX: Draw background in wxGrid cell when editor is open This was removed when Quick Draw was in use due to an issue, but Quick Draw has been removed, so re-enable it. --- src/generic/grid.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c1dbb96548..267b30cb39 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6106,15 +6106,9 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) // Note: However, only if it is really _shown_, i.e. not hidden! if ( isCurrent && IsCellEditControlShown() ) { - // NB: this "#if..." is temporary and fixes a problem where the - // edit control is erased by this code after being rendered. - // On wxMac (QD build only), the cell editor is a wxTextCntl and is rendered - // implicitly, causing this out-of order render. -#if !defined(__WXMAC__) wxGridCellEditor *editor = attr->GetEditor(this, row, col); editor->PaintBackground(dc, rect, *attr); editor->DecRef(); -#endif } else { From f5c3d9d1fbf3a3413cac035d96296540f9788f01 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 Jan 2020 23:23:18 +0000 Subject: [PATCH 2/3] OSX: Ignore wxHSCROLL and wxVSCROLL in wxDataViewCtrl Using these two style flags in wxDataViewCtrl causes the library to seg fault when trying to create the scrollbars. The wxDataViewCtrl has scrollbars already without these flags. Closes #17028 --- src/osx/dataview_osx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index 60e57b70f2..0bee2da4fa 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -365,6 +365,10 @@ bool wxDataViewCtrl::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { + // Remove wxVSCROLL and wxHSCROLL from the style, since the dataview panel has scrollbars + // by default, and wxControl::Create trys to make some but crashes in the process + style &= ~(wxVSCROLL | wxHSCROLL); + DontCreatePeer(); if (!(wxControl::Create(parent,id,pos,size,style,validator,name))) return false; From 654ef6d729a69718ea60ae6f97e64cfa084ce29b Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 24 Jan 2020 00:06:14 +0000 Subject: [PATCH 3/3] OSX: Only update the window level if it has changed Updating the level could lead to windows being reordered in that level on some OS versions, so for safety don't do it unless it is needed. --- src/osx/cocoa/nonownedwnd.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 95319f6ce5..c118d47b08 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -939,9 +939,13 @@ void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style ) level = NSModalPanelWindowLevel; else if (( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW )) level = NSFloatingWindowLevel; - - [m_macWindow setLevel: level]; - m_macWindowLevel = level; + + // Only update the level when it has changed, setting a level can cause the OS to reorder the windows in the level + if ( level != m_macWindowLevel ) + { + [m_macWindow setLevel: level]; + m_macWindowLevel = level; + } } }