From 93de82f0b2bae8afea54c49eae00f37c84c53704 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 14 Sep 2017 10:13:50 -0400 Subject: [PATCH] Fix scrollbars in macOS GAL canvases --- common/draw_panel_gal.cpp | 11 ++--------- common/gal/cairo/cairo_gal.cpp | 4 ++-- common/gal/opengl/opengl_gal.cpp | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 2a769ddcd7..61ef579b6b 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -71,12 +71,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin SwitchBackend( aGalType ); 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 ); -#endif EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas m_view = new KIGFX::VIEW( true ); @@ -169,10 +164,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) m_drawing = true; KIGFX::RENDER_SETTINGS* settings = static_cast( m_painter->GetSettings() ); -// Scrollbars broken in GAL on OSX -#ifndef __WXMAC__ m_viewControls->UpdateScrollbars(); -#endif m_view->UpdateItems(); @@ -222,7 +214,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( 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_NONCACHED ); } diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index e0748818ad..494042722a 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -90,8 +90,8 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); #endif - SetSize( aParent->GetSize() ); - screenSize = VECTOR2I( aParent->GetSize() ); + SetSize( aParent->GetClientSize() ); + screenSize = VECTOR2I( aParent->GetClientSize() ); // Grid color settings are different in Cairo and OpenGL SetGridColor( COLOR4D( 0.1, 0.1, 0.1, 0.8 ) ); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index cd75093827..26cb350e5d 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -120,8 +120,8 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); #endif - SetSize( aParent->GetSize() ); - screenSize = VECTOR2I( aParent->GetSize() ); + SetSize( aParent->GetClientSize() ); + screenSize = VECTOR2I( aParent->GetClientSize() ); // Grid color settings are different in Cairo and OpenGL SetGridColor( COLOR4D( 0.8, 0.8, 0.8, 0.1 ) );