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
This commit is contained in:
jean-pierre charras 2020-12-29 10:32:22 +01:00
parent aee23e991c
commit bfea2ab9f4
1 changed files with 11 additions and 1 deletions

View File

@ -161,11 +161,21 @@ void WX_INFOBAR::Dismiss()
m_updateLock = false;
}
#include <eda_base_frame.h>
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<EDA_BASE_FRAME*>( m_parent );
if( frame && frame->GetToolCanvas() )
parentWidth = frame->GetToolCanvas()->GetSize().GetWidth();
if( barWidth != parentWidth )
SetSize( parentWidth, GetSize().GetHeight() );