Commit 2196ed21 authored by jean-pierre charras's avatar jean-pierre charras

Apply a workaround to fix a wxWidgets bug in versions 3.0.x relative to mouse...

Apply a workaround to fix a wxWidgets  bug in versions 3.0.x relative to mouse wheel event (Windows specific).
Therefore wxWidgets 3.0.1 can be used without need to patch it.
(This bug is fixed in wxWidgets 3.1)
parent d6fbfbc0
......@@ -389,12 +389,10 @@ void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
{
int id = event.GetEventType();
int dir;
int x, y;
int ppux, ppuy;
int csizeX, csizeY;
int unitsX, unitsY;
int maxX, maxY;
GetViewStart( &x, &y );
GetScrollPixelsPerUnit( &ppux, &ppuy );
......@@ -410,10 +408,18 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
unitsX /= ppux;
unitsY /= ppuy;
maxX = unitsX - csizeX;
maxY = unitsY - csizeY;
int dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
// On windows and on wxWidgets >= 2.9.5 and < 3.1,
// there is a bug in mousewheel event which always generates 2 scroll events
// (should be the case only for the default mousewheel event)
// with id = wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN
// so we skip these events.
// Note they are here just in case, because they are not actually used
// in Kicad
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || !defined (__WINDOWS__)
int maxX = unitsX - csizeX;
int maxY = unitsY - csizeY;
if( id == wxEVT_SCROLLWIN_LINEUP )
{
......@@ -448,7 +454,9 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
y = maxY;
}
}
else if( id == wxEVT_SCROLLWIN_THUMBTRACK )
else
#endif
if( id == wxEVT_SCROLLWIN_THUMBTRACK )
{
if( dir == wxHORIZONTAL )
x = event.GetPosition();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment