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)
This commit is contained in:
jean-pierre charras 2014-07-20 17:23:48 +02:00
parent d6fbfbc001
commit 2196ed21c9
1 changed files with 14 additions and 6 deletions

View File

@ -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();