diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-11-13 09:56:53 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-11-13 14:03:31 +0000 |
commit | 12dcf5e6e770b1933252a1f919663ba45ded4cdf (patch) | |
tree | 2b084a51384735ec383cf52d7c6d72a13ac90eff /vcl | |
parent | ea6857f86b444fe7f87e74c41dbfe9ba8c02f942 (diff) |
slideshow: cleanup main-loop usage, post-yield listeners, etc.
This removes several attempts at reducing jitter in slideshow
animations. Now we have high-resolution (ie. not clamped to 10ms)
timers on Windows and a cleaner and simpler main-loop, we should
be able to use generic timer code-paths for all of this.
This also allows us to further cleanup and simplify the main-loop
removing the now redundent post-yield handler concept. If there is a
short enough timeout, we will take just 1ms of delay before executing
a short timer anyway.
Also removed some lingering comments from an old attempt to boost
priorities which broken audio playback.
Tested: tdf#32861 - still works, audio still plays, no new jitter
in animations that I tested.
Change-Id: Iadc5e2a48828a18a599a86a8df14cb2b75dd425e
Reviewed-on: https://gerrit.libreoffice.org/19947
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/svdata.hxx | 8 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 60 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.cxx | 2 |
4 files changed, 2 insertions, 73 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 5cac95e73312..fb0c28598683 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -105,11 +105,6 @@ public: typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners; -struct SVAppPostYieldListeners : public vcl::DeletionNotifier -{ - std::vector<Link<LinkParamNone*,void>> m_aListeners; -}; - struct ImplSVAppData { enum ImeStatusWindowMode @@ -134,7 +129,6 @@ struct ImplSVAppData VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung ImplEventHook* mpFirstEventHook; // Event-Hooks - SVAppPostYieldListeners* mpPostYieldListeners; // post yield listeners sal_uInt64 mnLastInputTime; // GetLastInputTime() sal_uInt16 mnDispatchLevel; // DispatchLevel sal_uInt16 mnModalMode; // ModalMode Count @@ -146,8 +140,6 @@ struct ImplSVAppData bool mbInAppExecute; // is Application::Execute() on stack bool mbAppQuit; // is Application::Quit() called bool mbSettingsInit; // true: Settings are initialized - bool mbNoYield; // Application::Yield will not wait for events if the queue is empty - // essentially that makes it the same as Application::Reschedule Application::DialogCancelMode meDialogCancel; // true: All Dialog::Execute() calls will be terminated immediately with return false /** Controls whether showing any IME status window is toggled on or off. diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b57b45e7f3b8..09bbf2d5f25c 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -492,7 +492,7 @@ inline void ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased // do not wait for events either if the app decided that it is too busy for timers // (feature added for the slideshow) pSVData->mpDefInst->DoYield( - i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, + i_bWait && !pSVData->maAppData.mbAppQuit, i_bAllEvents, nReleased); pSVData->maAppData.mnDispatchLevel--; @@ -501,31 +501,6 @@ inline void ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased // flush lazy deleted objects if( pSVData->maAppData.mnDispatchLevel == 0 ) vcl::LazyDelete::flush(); - - // the system timer events will not necessarily come in non waiting mode - // e.g. on OS X; need to trigger timer checks manually - if( pSVData->maAppData.mbNoYield ) - { - //Process all timers - Scheduler::ProcessTaskScheduling(true); - } - - // call post yield listeners - if( pSVData->maAppData.mpPostYieldListeners ) - { - vcl::DeletionListener aDel( pSVData->maAppData.mpPostYieldListeners ); - - auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners; - // Copy the list, because this can be destroyed when calling a Link... - std::vector<Link<LinkParamNone*,void>> aCopy( rYieldListeners ); - for( Link<LinkParamNone*,void>& rLink : aCopy ) - { - if (aDel.isDeleted()) break; - // check this hasn't been removed in some re-enterancy scenario fdo#47368 - if( std::find(rYieldListeners.begin(), rYieldListeners.end(), rLink) != rYieldListeners.end() ) - rLink.Call( nullptr ); - } - } } void Application::Reschedule( bool i_bAllEvents ) @@ -1096,39 +1071,6 @@ void Application::RemoveIdleHdl( const Link<Application*,void>& rLink ) pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink ); } -void Application::EnableNoYieldMode() -{ - ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mbNoYield = true; -} - -void Application::DisableNoYieldMode() -{ - ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mbNoYield = false; -} - -void Application::AddPostYieldListener( const Link<LinkParamNone*,void>& i_rListener ) -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maAppData.mpPostYieldListeners ) - pSVData->maAppData.mpPostYieldListeners = new SVAppPostYieldListeners(); - // ensure uniqueness - auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners; - if (std::find(rYieldListeners.begin(), rYieldListeners.end(), i_rListener) == rYieldListeners.end()) - rYieldListeners.push_back( i_rListener ); -} - -void Application::RemovePostYieldListener( const Link<LinkParamNone*,void>& i_rListener ) -{ - ImplSVData* pSVData = ImplGetSVData(); - if( pSVData->maAppData.mpPostYieldListeners ) - { - auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners; - rYieldListeners.erase( std::remove(rYieldListeners.begin(), rYieldListeners.end(), i_rListener ), rYieldListeners.end() ); - } -} - WorkWindow* Application::GetAppWindow() { return ImplGetSVData()->maWinData.mpAppWin; diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index ca2ae8245436..06f08114ee7d 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -508,11 +508,6 @@ void DeInitVCL() delete pSVData->maAppData.mpKeyListeners; pSVData->maAppData.mpKeyListeners = nullptr; } - if ( pSVData->maAppData.mpPostYieldListeners ) - { - delete pSVData->maAppData.mpPostYieldListeners; - pSVData->maAppData.mpPostYieldListeners = nullptr; - } if ( pSVData->maAppData.mpFirstHotKey ) ImplFreeHotKeyData(); diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 38f5435a1c0e..2dad164d9706 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -849,7 +849,7 @@ atk_object_wrapper_new( const ::com::sun::star::uno::Reference< ::com::sun::star uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY); if( xBroadcaster.is() ) xBroadcaster->addAccessibleEventListener( static_cast< accessibility::XAccessibleEventListener * > ( new AtkListener(pWrap) ) ); - else + else OSL_ASSERT( false ); } |