Skip to content
Snippets Groups Projects
Commit d9fe4817 authored by Seth Hillbrand's avatar Seth Hillbrand :flag_il:
Browse files

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 #10586

(cherry picked from commit 9722a058)
parent eeee5afd
No related branches found
No related tags found
No related merge requests found
Pipeline #498496144 passed
......@@ -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
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 )
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 )
{
if( aHeight == 0 )
......
......@@ -24,7 +24,10 @@
#ifndef KICAD_WX_GRID_H
#define KICAD_WX_GRID_H
#include <wx/event.h>
#include <wx/grid.h>
#include <wx/version.h>
class WX_GRID : public wxGrid
{
......@@ -119,6 +122,10 @@ protected:
void onGridColMove( wxGridEvent& aEvent );
void onGridCellSelect( wxGridEvent& aEvent );
#if wxCHECK_VERSION( 3, 1, 0 )
void onDPIChanged(wxDPIChangedEvent& event);
#endif
bool m_weOwnTable;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment