Fix scrollbars in macOS GAL canvases

This commit is contained in:
Jon Evans 2017-09-14 10:13:50 -04:00 committed by jean-pierre charras
parent 5364cd9681
commit 93de82f0b2
3 changed files with 6 additions and 13 deletions

View File

@ -71,12 +71,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
SwitchBackend( aGalType ); SwitchBackend( aGalType );
SetBackgroundStyle( wxBG_STYLE_CUSTOM ); SetBackgroundStyle( wxBG_STYLE_CUSTOM );
// Scrollbars broken in GAL on OSX
#ifdef __WXMAC__
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
#else
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
#endif
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
m_view = new KIGFX::VIEW( true ); m_view = new KIGFX::VIEW( true );
@ -169,10 +164,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_drawing = true; m_drawing = true;
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() ); KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
// Scrollbars broken in GAL on OSX
#ifndef __WXMAC__
m_viewControls->UpdateScrollbars(); m_viewControls->UpdateScrollbars();
#endif
m_view->UpdateItems(); m_view->UpdateItems();
@ -222,7 +214,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent ) void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
{ {
m_gal->ResizeScreen( aEvent.GetSize().x, aEvent.GetSize().y ); wxSize clientSize = GetClientSize();
m_gal->ResizeScreen( clientSize.x, clientSize.y );
m_view->MarkTargetDirty( KIGFX::TARGET_CACHED ); m_view->MarkTargetDirty( KIGFX::TARGET_CACHED );
m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); m_view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
} }

View File

@ -90,8 +90,8 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions,
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) );
#endif #endif
SetSize( aParent->GetSize() ); SetSize( aParent->GetClientSize() );
screenSize = VECTOR2I( aParent->GetSize() ); screenSize = VECTOR2I( aParent->GetClientSize() );
// Grid color settings are different in Cairo and OpenGL // Grid color settings are different in Cairo and OpenGL
SetGridColor( COLOR4D( 0.1, 0.1, 0.1, 0.8 ) ); SetGridColor( COLOR4D( 0.1, 0.1, 0.1, 0.8 ) );

View File

@ -120,8 +120,8 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) );
#endif #endif
SetSize( aParent->GetSize() ); SetSize( aParent->GetClientSize() );
screenSize = VECTOR2I( aParent->GetSize() ); screenSize = VECTOR2I( aParent->GetClientSize() );
// Grid color settings are different in Cairo and OpenGL // Grid color settings are different in Cairo and OpenGL
SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) ); SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) );