Fix 3D viewer canvas timer event clash.

Manual cherry-pick of commit f6297d328c.
This commit is contained in:
Wayne Stambaugh 2022-10-23 07:53:51 -04:00
parent bce8c95647
commit 0593663462
1 changed files with 40 additions and 26 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -89,30 +89,32 @@ END_EVENT_TABLE()
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera, BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera,
S3D_CACHE* a3DCachePointer ) S3D_CACHE* a3DCachePointer ) :
: HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize, HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE ), wxFULL_REPAINT_ON_RESIZE ),
m_eventDispatcher( nullptr ), m_eventDispatcher( nullptr ),
m_parentStatusBar( nullptr ), m_parentStatusBar( nullptr ),
m_parentInfoBar( nullptr ), m_parentInfoBar( nullptr ),
m_glRC( nullptr ), m_glRC( nullptr ),
m_is_opengl_initialized( false ), m_is_opengl_initialized( false ),
m_is_opengl_version_supported( true ), m_is_opengl_version_supported( true ),
m_mouse_is_moving( false ), m_editing_timeout_timer( this, wxID_HIGHEST + 1 ),
m_mouse_was_moved( false ), m_redraw_trigger_timer( this, wxID_HIGHEST + 2 ),
m_camera_is_moving( false ), m_mouse_is_moving( false ),
m_render_pivot( false ), m_mouse_was_moved( false ),
m_camera_moving_speed( 1.0f ), m_camera_is_moving( false ),
m_strtime_camera_movement( 0 ), m_render_pivot( false ),
m_animation_enabled( true ), m_camera_moving_speed( 1.0f ),
m_moving_speed_multiplier( 3 ), m_strtime_camera_movement( 0 ),
m_boardAdapter( aBoardAdapter ), m_animation_enabled( true ),
m_camera( aCamera ), m_moving_speed_multiplier( 3 ),
m_3d_render( nullptr ), m_boardAdapter( aBoardAdapter ),
m_opengl_supports_raytracing( true ), m_camera( aCamera ),
m_render_raytracing_was_requested( false ), m_3d_render( nullptr ),
m_accelerator3DShapes( nullptr ), m_opengl_supports_raytracing( true ),
m_currentRollOverItem( nullptr ) m_render_raytracing_was_requested( false ),
m_accelerator3DShapes( nullptr ),
m_currentRollOverItem( nullptr )
{ {
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::EDA_3D_CANVAS" ) ); wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::EDA_3D_CANVAS" ) );
@ -845,8 +847,14 @@ void EDA_3D_CANVAS::OnMiddleUp( wxMouseEvent& event )
} }
void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& /* event */ ) void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& aEvent )
{ {
if( aEvent.GetId() != m_editing_timeout_timer.GetId() )
{
aEvent.Skip();
return;
}
m_mouse_is_moving = false; m_mouse_is_moving = false;
m_mouse_was_moved = false; m_mouse_was_moved = false;
@ -867,8 +875,14 @@ void EDA_3D_CANVAS::restart_editingTimeOut_Timer()
} }
void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& event ) void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& aEvent )
{ {
if( aEvent.GetId() != m_redraw_trigger_timer.GetId() )
{
aEvent.Skip();
return;
}
Request_refresh( true ); Request_refresh( true );
} }