diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 167c486c35..0533a5b6f2 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -417,7 +417,7 @@ public: void SetFlags(unsigned int flags); unsigned int GetFlags() const; - static bool AlwaysUsesLiveResize(); + static bool AlwaysUsesLiveResize(const wxWindow* window = nullptr); bool HasLiveResize() const; void SetManagedWindow(wxWindow* managedWnd); diff --git a/interface/wx/aui/framemanager.h b/interface/wx/aui/framemanager.h index 549492f354..832b0282c8 100644 --- a/interface/wx/aui/framemanager.h +++ b/interface/wx/aui/framemanager.h @@ -219,12 +219,16 @@ public: If this function returns true, ::wxAUI_MGR_LIVE_RESIZE flag is ignored and live resize is always used, whether it's specified or not. - Currently this is the case for wxOSX and wxGTK3 ports, as live resizing - is the only implemented method there. + Currently this is the case for wxOSX and wxGTK3 when using Wayland, as + live resizing is the only implemented method there. See + wxClientDC::CanBeUsedForDrawing() for more details. + + @param window The associated window, may be null (this parameter was + added in wxWidgets 3.3.0) @since 3.1.4 */ - static bool AlwaysUsesLiveResize(); + static bool AlwaysUsesLiveResize(const wxWindow* window); /** This function is used by controls to calculate the drop hint rectangle. diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 3d8af0aeb3..793e9498be 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -767,26 +767,17 @@ unsigned int wxAuiManager::GetFlags() const return m_flags; } -// With Core Graphics on Mac or GTK 3, it's not possible to show sash feedback, -// so we'll always use live update instead. -#if defined(__WXMAC__) || defined(__WXGTK3__) - #define wxUSE_AUI_LIVE_RESIZE_ALWAYS 1 -#else - #define wxUSE_AUI_LIVE_RESIZE_ALWAYS 0 -#endif - -/* static */ bool wxAuiManager::AlwaysUsesLiveResize() +/* static */ bool wxAuiManager::AlwaysUsesLiveResize(const wxWindow* window) { - return wxUSE_AUI_LIVE_RESIZE_ALWAYS; + // Not using live resize relies on wxClientDC being usable for drawing, so + // we have to use live resize if it can't be used on the current platform. + return !wxClientDC::CanBeUsedForDrawing(window); } bool wxAuiManager::HasLiveResize() const { -#if wxUSE_AUI_LIVE_RESIZE_ALWAYS - return true; -#else - return (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE; -#endif + return AlwaysUsesLiveResize(m_frame) || + (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE; } // don't use these anymore as they are deprecated @@ -3925,15 +3916,16 @@ void wxAuiManager::Repaint(wxDC* dc) // make a client dc if (!dc) { -#if wxUSE_AUI_LIVE_RESIZE_ALWAYS - // We can't use wxClientDC in these ports. - m_frame->Refresh() ; - m_frame->Update() ; - return ; -#else + if ( AlwaysUsesLiveResize(m_frame) ) + { + // We can't use wxClientDC in these ports. + m_frame->Refresh() ; + m_frame->Update() ; + return ; + } + client_dc.reset(new wxClientDC(m_frame)); dc = client_dc.get(); -#endif } int w, h;