Allow overlay scrolling on GTK, except for GAL canvases.
This prevents glitches when both scrollbars
are visible and scrolling to the end.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10559
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9988
(cherry picked from commit 4c4089e836
)
This commit is contained in:
parent
42dfdf8c38
commit
73d0d7796c
|
@ -94,6 +94,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
|||
|
||||
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
|
||||
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
|
||||
KIPLATFORM::UI::SetOverlayScrolling( this, false ); // Prevent excessive repaint on GTK
|
||||
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), nullptr, this );
|
||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), nullptr,
|
||||
|
|
|
@ -39,10 +39,6 @@ void KIPLATFORM::ENV::Init()
|
|||
// required until wxWidgets supports the Wayland compositors
|
||||
wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "x11" ) );
|
||||
|
||||
// Disable overlay scrollbars as they mess up wxWidgets window sizing and cause
|
||||
// excessive redraw requests.
|
||||
wxSetEnv( wxT( "GTK_OVERLAY_SCROLLING" ), wxT( "0" ) );
|
||||
|
||||
// Set GTK2-style input instead of xinput2. This disables touchscreen and smooth
|
||||
// scrolling. It's needed to ensure that we are not getting multiple mouse scroll
|
||||
// events.
|
||||
|
|
|
@ -120,3 +120,17 @@ double KIPLATFORM::UI::GetSystemScaleFactor( const wxWindow* aWindow )
|
|||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||
{
|
||||
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
||||
aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
|
||||
{
|
||||
gtk_scrolled_window_set_overlay_scrolling( GTK_SCROLLED_WINDOW( aWindow->GetHandle() ),
|
||||
overlay );
|
||||
}
|
||||
|
|
|
@ -101,6 +101,21 @@ namespace KIPLATFORM
|
|||
* @return System scale factor in use, defaulting to the wxWidgets method
|
||||
*/
|
||||
double GetSystemScaleFactor( const wxWindow* aWindow );
|
||||
|
||||
/**
|
||||
* Tries to determine the size of the viewport of a scrollable widget
|
||||
* (wxDataViewCtrl, wxGrid) that won't be obscured by scrollbars.
|
||||
*
|
||||
* @param aWindow pointer to the scrollable widget to check
|
||||
* @return Viewport size that won't be obscured by scrollbars
|
||||
*/
|
||||
wxSize GetUnobscuredSize( const wxWindow* aWindow );
|
||||
|
||||
/**
|
||||
* Used to set overlay/non-overlay scrolling mode in a window.
|
||||
* Implemented only on GTK.
|
||||
*/
|
||||
void SetOverlayScrolling( const wxWindow* aWindow, bool overlay );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,3 +120,15 @@ double KIPLATFORM::UI::GetSystemScaleFactor( const wxWindow* aWindow )
|
|||
{
|
||||
return aWindow->GetContentScaleFactor();
|
||||
}
|
||||
|
||||
|
||||
wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||
{
|
||||
return aWindow->GetClientSize();
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
|
|
@ -119,3 +119,16 @@ double KIPLATFORM::UI::GetSystemScaleFactor( const wxWindow* aWindow )
|
|||
{
|
||||
return aWindow->GetContentScaleFactor();
|
||||
}
|
||||
|
||||
|
||||
wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||
{
|
||||
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
||||
aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue