include/sfx2/bindings.hxx | 7 +-- sfx2/source/control/bindings.cxx | 75 ++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 35 deletions(-)
New commits: commit f0bea419a5148aeade87046769f4355e333bfefd Author: László Németh <laszlo.nem...@collabora.com> Date: Wed May 25 02:01:45 2016 +0200 empty commit (repeat) Change-Id: I5ad3ae29ddd83760569ca7f02804e1e20e25f789 commit dcac2912b6653bd04214347344b8ee1a2041190b Author: László Németh <laszlo.nem...@collabora.com> Date: Wed May 25 02:01:34 2016 +0200 Revert "tdf#94236: Change Timer in SfxRequest to an Idle to improve feedback." This reverts commit 702718d3b49780c165afe59d2a7de950209dcaa8. diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx index 1daec4e..bbe5cc4 100644 --- a/include/sfx2/bindings.hxx +++ b/include/sfx2/bindings.hxx @@ -35,7 +35,6 @@ // forwards, typedefs, declarations -class Idle; class SystemWindow; class SfxSlot; class SfxSlotServer; @@ -45,6 +44,7 @@ class SfxItemSet; class SfxDispatcher; class SfxBindings; class SfxBindings_Impl; +class Timer; class SfxWorkWindow; class SfxUnoControllerItem; struct SfxFoundCache_Impl; @@ -131,9 +131,8 @@ private: const SfxPoolItem *pItem, SfxItemState eItemState ); SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, sal_uInt16 *pPos); - - DECL_DLLPRIVATE_LINK_TYPED(NextJob, Idle *, void); - SAL_DLLPRIVATE bool NextJob_Impl(Idle * pIdle); + DECL_DLLPRIVATE_LINK_TYPED( NextJob, Timer *, void ); + SAL_DLLPRIVATE bool NextJob_Impl(Timer * pTimer); public: SfxBindings(); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 49f4b17..98388a8 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -71,8 +71,15 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; +static sal_uInt16 nTimeOut = 300; + +#define TIMEOUT_FIRST nTimeOut +#define TIMEOUT_UPDATING 20 + typedef std::unordered_map< sal_uInt16, bool > InvalidateSlotMap; + + typedef std::vector<SfxStateCache*> SfxStateCacheArr_Impl; struct SfxFoundCache_Impl @@ -210,7 +217,7 @@ public: bool bAllMsgDirty; // Has a MessageServer been invalidated? bool bAllDirty; // After InvalidateAll bool bCtrlReleased; // while EnterRegistrations - Idle maIdle; // for volatile Slots + AutoTimer aTimer; // for volatile Slots bool bInUpdate; // for Assertions bool bInNextJob; // for Assertions bool bFirstRound; // First round in Update @@ -245,12 +252,11 @@ SfxBindings::SfxBindings() // all caches are valid (no pending invalidate-job) // create the list of caches pImp->pCaches = new SfxStateCacheArr_Impl; - - pImp->maIdle.SetPriority(SchedulerPriority::MEDIUM); - pImp->maIdle.SetIdleHdl(LINK(this, SfxBindings, NextJob)); + pImp->aTimer.SetTimeoutHdl( LINK(this, SfxBindings, NextJob) ); } + SfxBindings::~SfxBindings() /* [Description] @@ -271,9 +277,7 @@ SfxBindings::~SfxBindings() ENTERREGISTRATIONS(); - pImp->maIdle.SetIdleHdl(Link<Idle *, void>()); - pImp->maIdle.Stop(); - + pImp->aTimer.Stop(); DeleteControllers_Impl(); // Delete Caches @@ -698,11 +702,11 @@ void SfxBindings::InvalidateAll (*pImp->pCaches)[n]->Invalidate(bWithMsg); pImp->nMsgPos = 0; - if ( !nRegLevel ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); } } @@ -750,11 +754,11 @@ void SfxBindings::Invalidate // if not enticed to start update timer pImp->nMsgPos = 0; - if ( !nRegLevel ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); } } @@ -804,11 +808,11 @@ void SfxBindings::InvalidateShell pCache->Invalidate(false); } pImp->nMsgPos = 0; - if ( !nRegLevel ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); pImp->bFirstRound = true; pImp->nFirstShell = nLevel; } @@ -841,11 +845,11 @@ void SfxBindings::Invalidate { pCache->Invalidate(false); pImp->nMsgPos = std::min(GetSlotPos(nId), pImp->nMsgPos); - if ( !nRegLevel ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); } } } @@ -878,11 +882,11 @@ void SfxBindings::Invalidate return; pImp->nMsgPos = std::min(GetSlotPos(nId), pImp->nMsgPos); - if ( !nRegLevel ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); } } } @@ -1540,12 +1544,12 @@ void SfxBindings::UpdateControllers_Impl } } -IMPL_LINK_TYPED(SfxBindings, NextJob, Idle *, pIdle, void) +IMPL_LINK_TYPED( SfxBindings, NextJob, Timer *, pTimer, void ) { - NextJob_Impl(pIdle); + NextJob_Impl(pTimer); } -bool SfxBindings::NextJob_Impl(Idle * pIdle) +bool SfxBindings::NextJob_Impl(Timer * pTimer) { #ifdef DBG_UTIL // on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT @@ -1553,9 +1557,16 @@ bool SfxBindings::NextJob_Impl(Idle * pIdle) try { #endif + const unsigned MAX_INPUT_DELAY = 200; DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); + if ( Application::GetLastInputInterval() < MAX_INPUT_DELAY && pTimer ) + { + pImp->aTimer.SetTimeout(TIMEOUT_UPDATING); + return true; + } + SfxApplication *pSfxApp = SfxGetpApp(); if( pDispatcher ) @@ -1580,9 +1591,10 @@ bool SfxBindings::NextJob_Impl(Idle * pIdle) } pImp->bAllDirty = false; + pImp->aTimer.SetTimeout(TIMEOUT_UPDATING); // at least 10 loops and further if more jobs are available but no input - bool bPreEmptive = pIdle && !pSfxApp->Get_Impl()->nInReschedule; + bool bPreEmptive = pTimer && !pSfxApp->Get_Impl()->nInReschedule; sal_uInt16 nLoops = 10; pImp->bInNextJob = true; const sal_uInt16 nCount = pImp->pCaches->size(); @@ -1627,7 +1639,7 @@ bool SfxBindings::NextJob_Impl(Idle * pIdle) pImp->nMsgPos = 0; - pImp->maIdle.Stop(); + pImp->aTimer.Stop(); // Update round is finished pImp->bInNextJob = false; @@ -1674,7 +1686,7 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine) if ( ++nRegLevel == 1 ) { // stop background-processing - pImp->maIdle.Stop(); + pImp->aTimer.Stop(); // flush the cache pImp->nCachedFunc1 = 0; @@ -1742,8 +1754,9 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int return; if ( pImp->pCaches && !pImp->pCaches->empty() ) { - pImp->maIdle.Stop(); - pImp->maIdle.Start(); + pImp->aTimer.Stop(); + pImp->aTimer.SetTimeout(TIMEOUT_FIRST); + pImp->aTimer.Start(); } } @@ -1839,7 +1852,7 @@ void SfxBindings::StartUpdate_Impl( bool bComplete ) if ( !bComplete ) // Update may be interrupted - NextJob_Impl(&pImp->maIdle); + NextJob_Impl(&pImp->aTimer); else // Update all slots in a row NextJob_Impl(nullptr); commit bcdd9bed452dad5c071cd9de15c7ef2926ef5825 Author: László Németh <laszlo.nem...@collabora.com> Date: Wed May 25 02:00:14 2016 +0200 empty commit (no proc. idle) Change-Id: Ied7e9e03f12377ad87e3d374c7af684aeb61065b
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits