Attempt to fix the Mac DPI grid mixing
When moving windows between monitors on Mac that changes the DPI, we observe incorrect re-sizing of columns and rows. This attempts to rectify the situation by avoiding DPI changes for Mac builds. Fixes https://gitlab.com/kicad/code/kicad/issues/10586
This commit is contained in:
parent
e336a0e403
commit
9722a05820
|
@ -40,6 +40,11 @@ WX_GRID::WX_GRID( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxS
|
||||||
|
|
||||||
// Make sure the GUI font scales properly on GTK
|
// Make sure the GUI font scales properly on GTK
|
||||||
SetDefaultCellFont( KIUI::GetControlFont( this ) );
|
SetDefaultCellFont( KIUI::GetControlFont( this ) );
|
||||||
|
|
||||||
|
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
Connect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,9 +52,25 @@ WX_GRID::~WX_GRID()
|
||||||
{
|
{
|
||||||
if( m_weOwnTable )
|
if( m_weOwnTable )
|
||||||
DestroyTable( GetTable() );
|
DestroyTable( GetTable() );
|
||||||
|
|
||||||
|
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
Disconnect( wxEVT_DPI_CHANGED, wxDPIChangedEventHandler( WX_GRID::onDPIChanged ), nullptr, this );
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
void WX_GRID::onDPIChanged(wxDPIChangedEvent& aEvt)
|
||||||
|
{
|
||||||
|
/// This terrible hack is a way to avoid the incredibly disruptive resizing of grids that happens on Macs
|
||||||
|
/// when moving a window between monitors of different DPIs.
|
||||||
|
#ifndef __WXMAC__
|
||||||
|
aEvt.Skip();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void WX_GRID::SetColLabelSize( int aHeight )
|
void WX_GRID::SetColLabelSize( int aHeight )
|
||||||
{
|
{
|
||||||
if( aHeight == 0 )
|
if( aHeight == 0 )
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
#ifndef KICAD_WX_GRID_H
|
#ifndef KICAD_WX_GRID_H
|
||||||
#define KICAD_WX_GRID_H
|
#define KICAD_WX_GRID_H
|
||||||
|
|
||||||
|
#include <wx/event.h>
|
||||||
#include <wx/grid.h>
|
#include <wx/grid.h>
|
||||||
|
#include <wx/version.h>
|
||||||
|
|
||||||
|
|
||||||
class WX_GRID : public wxGrid
|
class WX_GRID : public wxGrid
|
||||||
{
|
{
|
||||||
|
@ -119,6 +122,10 @@ protected:
|
||||||
void onGridColMove( wxGridEvent& aEvent );
|
void onGridColMove( wxGridEvent& aEvent );
|
||||||
void onGridCellSelect( wxGridEvent& aEvent );
|
void onGridCellSelect( wxGridEvent& aEvent );
|
||||||
|
|
||||||
|
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||||
|
void onDPIChanged(wxDPIChangedEvent& event);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool m_weOwnTable;
|
bool m_weOwnTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue