From bfea2ab9f419c02c80d1d4fa453f2a7f507b495e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 29 Dec 2020 10:32:22 +0100 Subject: [PATCH] Fix incorrect calculation of infobar width on Linux and Windows. The calculation was using the frame width, instead of the the GAL canvas width. Fixes #6865 https://gitlab.com/kicad/code/kicad/issues/6865 --- common/widgets/infobar.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/widgets/infobar.cpp b/common/widgets/infobar.cpp index e74ae93ea4..fdd8514ab3 100644 --- a/common/widgets/infobar.cpp +++ b/common/widgets/infobar.cpp @@ -161,11 +161,21 @@ void WX_INFOBAR::Dismiss() m_updateLock = false; } - +#include void WX_INFOBAR::onSize( wxSizeEvent& aEvent ) { int barWidth = GetSize().GetWidth(); + + // Calculate the horizontal size: because the infobar is shown on top of the draw canvas + // it is adjusted to the canvas width. + // On Mac, the canvas is the parent + // On other OS the parent is EDA_BASE_FRAME thta contains the canvas int parentWidth = m_parent->GetClientSize().GetWidth(); + EDA_BASE_FRAME* frame = dynamic_cast( m_parent ); + + if( frame && frame->GetToolCanvas() ) + parentWidth = frame->GetToolCanvas()->GetSize().GetWidth(); + if( barWidth != parentWidth ) SetSize( parentWidth, GetSize().GetHeight() );