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
This commit is contained in:
parent
a8486c5296
commit
4c4089e836
|
@ -94,6 +94,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||||
|
|
||||||
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
|
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
|
||||||
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
|
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_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), nullptr, this );
|
||||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), nullptr,
|
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
|
// required until wxWidgets supports the Wayland compositors
|
||||||
wxSetEnv( wxT( "GDK_BACKEND" ), wxT( "x11" ) );
|
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
|
// 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
|
// scrolling. It's needed to ensure that we are not getting multiple mouse scroll
|
||||||
// events.
|
// events.
|
||||||
|
|
|
@ -127,3 +127,10 @@ wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||||
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
||||||
aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
|
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 );
|
||||||
|
}
|
||||||
|
|
|
@ -109,6 +109,12 @@ namespace KIPLATFORM
|
||||||
* @return Viewport size that won't be obscured by scrollbars
|
* @return Viewport size that won't be obscured by scrollbars
|
||||||
*/
|
*/
|
||||||
wxSize GetUnobscuredSize( const wxWindow* aWindow );
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,3 +126,9 @@ wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||||
{
|
{
|
||||||
return aWindow->GetClientSize();
|
return aWindow->GetClientSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
|
||||||
|
{
|
||||||
|
// Not implemented
|
||||||
|
}
|
||||||
|
|
|
@ -126,3 +126,9 @@ wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
|
||||||
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
|
||||||
aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
|
aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
|
||||||
|
{
|
||||||
|
// Not implemented
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue