Kick the refresh timer for GAL on Win32 with a terrible hack

This commit is contained in:
Marek Roszko 2020-10-11 21:44:46 -04:00
parent 1739f1b6ea
commit 88102bca46
5 changed files with 35 additions and 0 deletions

View File

@ -40,6 +40,8 @@
#include <gal/opengl/opengl_gal.h>
#include <gal/cairo/cairo_gal.h>
#include <kiplatform/app.h>
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
@ -295,6 +297,10 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
void EDA_DRAW_PANEL_GAL::Refresh( bool aEraseBackground, const wxRect* aRect )
{
// Call to ensure the refresh timer eventually fires during rapid mouse moves
// Required for win32
KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary();
if( m_pendingRefresh )
return;

View File

@ -51,3 +51,8 @@ void KIPLATFORM::APP::RemoveShutdownBlockReason( wxWindow* aWindow )
void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString& aReason )
{
}
void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
{
}

View File

@ -64,6 +64,17 @@ namespace KIPLATFORM
* @param aWindow that has a shutdown block reason set
*/
void RemoveShutdownBlockReason( wxWindow* aWindow );
/**
* Forces wxTimers to fire more promptly on Win32.
*
* wxTimers on win32 are not real timers
* They live in the message pump at the absolute lowest priority (only when no other events are pending)
* This functions "peeks" the message pump which causes them to get queued immediately
*
* Call as needed in an application to ensure timers are dispatched
*/
void ForceTimerMessagesToBeCreatedIfNecessary();
}
}

View File

@ -72,3 +72,11 @@ void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString&
ShutdownBlockReasonCreate( aWindow->GetHandle(), aReason.wc_str() );
}
void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
{
// Taken from https://devblogs.microsoft.com/oldnewthing/20191108-00/?p=103080
MSG msg;
PeekMessage( &msg, nullptr, WM_TIMER, WM_TIMER, PM_NOREMOVE );
}

View File

@ -51,3 +51,8 @@ void KIPLATFORM::APP::RemoveShutdownBlockReason( wxWindow* aWindow )
void KIPLATFORM::APP::SetShutdownBlockReason( wxWindow* aWindow, const wxString& aReason )
{
}
void KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary()
{
}