From 221b0ab1245be6dba23b4ef3c516e846d95d2f71 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Thu, 20 Jul 2017 15:49:45 +0200 Subject: WIN use Reschedule instead of own dispatch loops Since we're filtering the wakeup timer event in the main dispatch loop, we should use Application::Reschedule in the Backend. Change-Id: Ie02c3533e8a6a7905281f129489e4f6f53f74692 --- vcl/win/app/salinst.cxx | 1 + vcl/win/gdi/salprn.cxx | 36 +++--------------------------------- vcl/win/window/salframe.cxx | 9 +-------- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 7e76cd921273..6833c546a5ce 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -732,6 +732,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i while ( PeekMessageW(&aMsg, nullptr, SAL_MSG_TIMER_CALLBACK, SAL_MSG_TIMER_CALLBACK, PM_REMOVE) ) assert( "Multiple timer messages in queue" ); + assert( 0 == wParam ); if ( 0 == wParam ) EmitTimerCallback(); break; diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 44cc665c94b4..153ec5c54928 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1288,24 +1288,12 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) { SalData* pSalData = GetSalData(); WinSalPrinter* pPrinter; - bool bWhile = TRUE; - int i = 0; + bool bWhile = true; do { // process messages - MSG aMsg; - if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_REMOVE ) ) - { - TranslateMessage( &aMsg ); - DispatchMessageW( &aMsg ); - - i++; - if ( i > 15 ) - bWhile = FALSE; - } - else - bWhile = FALSE; + bWhile = Application::Reschedule( true ); pPrinter = pSalData->mpFirstPrinter; while ( pPrinter ) @@ -1468,25 +1456,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, // As the Telecom Balloon Fax driver tends to send messages repeatedly // we try to process first all, and then insert a dummy message - bool bWhile = TRUE; - int i = 0; - do - { - // process messages - MSG aMsg; - if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_REMOVE ) ) - { - TranslateMessage( &aMsg ); - DispatchMessageW( &aMsg ); - - i++; - if ( i > 15 ) - bWhile = FALSE; - } - else - bWhile = FALSE; - } - while ( bWhile ); + while ( Application::Reschedule( true ) ); BOOL const ret = PostMessageW(GetSalData()->mpFirstInstance->mhComWnd, SAL_MSG_DUMMY, 0, 0); SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 268da1e2666f..e0ec83c37e4c 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5705,14 +5705,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP // messages in the message queue and dispatch them before we return control to the system. if ( nRet ) - { - MSG msg; - - while( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) - { - DispatchMessage( &msg ); - } - } + while ( Application::Reschedule( true ) ); } else { -- cgit v1.2.3