diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-07-27 21:03:36 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-07-28 09:05:04 +0000 |
commit | 878c4f2490f0554cd0b261ff3699cb156e73b59e (patch) | |
tree | 706ad1b124d57ac3b70ba276524522d802e5bd6c | |
parent | 22c75d86db9351ab271942a755a2a75a76920943 (diff) |
vcl: remove Application::InsertIdleHdl() and ImplIdleMgr
This is obsolete since 5.0 introduced the new Idle scheduler.
Change-Id: I8555fe35e2befb0cc2a4c39ae469a5c32a32fcb9
Reviewed-on: https://gerrit.libreoffice.org/27598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | include/vcl/svapp.hxx | 18 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/inc/idlemgr.hxx | 49 | ||||
-rw-r--r-- | vcl/source/app/idlemgr.cxx | 124 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 20 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 6 |
6 files changed, 0 insertions, 218 deletions
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index f91d38afbe0c..9476fad9739c 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -791,24 +791,6 @@ public: */ static void RemoveUserEvent( ImplSVEvent * nUserEvent ); - /** Insert an idle handler into the application. - - If the idle event manager doesn't exist, then initialize it. - - @param rLink const reference to the idle handler - @param nPriority The priority of the idle handler - idle handlers of a higher - priority will be processed before this handler. - - @return true if the handler was inserted successfully, false if it couldn't be inserted. - */ - static bool InsertIdleHdl( const Link<Application*,void>& rLink, sal_uInt16 nPriority ); - - /** Remove an idle handler from the application. - - @param rLink const reference to the idle handler to remove - */ - static void RemoveIdleHdl( const Link<Application*,void>& rLink ); - /*** Get the DisplayConnection. It is a reference to XDisplayConnection, which allows toolkits to send display diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 0b26fdf4e3ac..c2837a19b2f1 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -331,7 +331,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/app/help \ vcl/source/app/i18nhelp \ vcl/source/app/idle \ - vcl/source/app/idlemgr \ vcl/source/app/salvtables \ vcl/source/app/scheduler \ vcl/source/app/session \ diff --git a/vcl/inc/idlemgr.hxx b/vcl/inc/idlemgr.hxx deleted file mode 100644 index d9b31cb04531..000000000000 --- a/vcl/inc/idlemgr.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VCL_INC_IDLEMGR_HXX -#define INCLUDED_VCL_INC_IDLEMGR_HXX - -#include <vcl/timer.hxx> -#include <vector> - -struct ImplIdleData; -typedef ::std::vector< ImplIdleData* > ImplIdleList; - -class ImplIdleMgr -{ -private: - ImplIdleList* mpIdleList; - AutoTimer maTimer; - bool mbInDestruction; - -public: - ImplIdleMgr(); - ~ImplIdleMgr(); - - bool InsertIdleHdl( const Link<Application*,void>& rLink, sal_uInt16 nPriority ); - void RemoveIdleHdl( const Link<Application*,void>& rLink ); - - // Timer* can be NULL - DECL_LINK_TYPED(TimeoutHdl, Timer *, void); -}; - -#endif // INCLUDED_VCL_INC_IDLEMGR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx deleted file mode 100644 index 5e7086e7ff43..000000000000 --- a/vcl/source/app/idlemgr.cxx +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vcl/svapp.hxx> - -#include <idlemgr.hxx> - -struct ImplIdleData -{ - Link<Application*,void> maIdleHdl; - sal_uInt16 mnPriority; - bool mbTimeout; -}; - -#define IMPL_IDLETIMEOUT 350 - -ImplIdleMgr::ImplIdleMgr(): - mbInDestruction(false) -{ - mpIdleList = new ImplIdleList(); - - maTimer.SetTimeout( IMPL_IDLETIMEOUT ); - maTimer.SetTimeoutHdl( LINK( this, ImplIdleMgr, TimeoutHdl ) ); -} - -ImplIdleMgr::~ImplIdleMgr() -{ - mbInDestruction = true; - // Liste loeschen - for (ImplIdleData* pIdleData : *mpIdleList) { - pIdleData->maIdleHdl.Call( GetpApp() ); - delete pIdleData; - } - mpIdleList->clear(); - delete mpIdleList; -} - -bool ImplIdleMgr::InsertIdleHdl( const Link<Application*,void>& rLink, sal_uInt16 nPriority ) -{ - size_t nPos = (size_t)-1; - size_t n = mpIdleList->size(); - for ( size_t i = 0; i < n; ++i ) { - // we need to check each element to verify that rLink isn't in the array - if ( (*mpIdleList)[ i ]->maIdleHdl == rLink ) { - return false; - } - if ( nPriority <= (*mpIdleList)[ i ]->mnPriority ) { - nPos = i; - } - } - - ImplIdleData* pIdleData = new ImplIdleData; - pIdleData->maIdleHdl = rLink; - pIdleData->mnPriority = nPriority; - pIdleData->mbTimeout = false; - - if ( nPos < mpIdleList->size() ) { - ImplIdleList::iterator it = mpIdleList->begin(); - ::std::advance( it, nPos ); - mpIdleList->insert( it, pIdleData ); - } else { - mpIdleList->push_back( pIdleData ); - } - - // if Timer was not started already then start it now - if ( !maTimer.IsActive() ) - maTimer.Start(); - - return true; -} - -void ImplIdleMgr::RemoveIdleHdl( const Link<Application*,void>& rLink ) -{ - if (mbInDestruction) - return; - - for ( ImplIdleList::iterator it = mpIdleList->begin(); it != mpIdleList->end(); ++it ) { - if ( (*it)->maIdleHdl == rLink ) { - delete *it; - mpIdleList->erase( it ); - break; - } - } - - // there are no more handlers... - if ( mpIdleList->empty() ) - maTimer.Stop(); -} - -IMPL_LINK_NOARG_TYPED(ImplIdleMgr, TimeoutHdl, Timer *, void) -{ - for ( size_t i = 0; i < mpIdleList->size(); ++i ) { - ImplIdleData* pIdleData = (*mpIdleList)[ i ]; - if ( !pIdleData->mbTimeout ) { - pIdleData->mbTimeout = true; - pIdleData->maIdleHdl.Call( GetpApp() ); - // May have been removed in the handler - for ( size_t j = 0; j < mpIdleList->size(); ++j ) { - if ( (*mpIdleList)[ j ] == pIdleData ) { - pIdleData->mbTimeout = false; - break; - } - } - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 78c494d70405..bd6bccba70be 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -63,7 +63,6 @@ #include "displayconnectiondispatch.hxx" #include "window.h" #include "accmgr.hxx" -#include "idlemgr.hxx" #include "svids.hrc" #include <com/sun/star/uno/Reference.h> @@ -1094,25 +1093,6 @@ void Application::RemoveUserEvent( ImplSVEvent * nUserEvent ) } } -bool Application::InsertIdleHdl( const Link<Application*,void>& rLink, sal_uInt16 nPrio ) -{ - ImplSVData* pSVData = ImplGetSVData(); - - // create if does not exist - if ( !pSVData->maAppData.mpIdleMgr ) - pSVData->maAppData.mpIdleMgr = new ImplIdleMgr; - - return pSVData->maAppData.mpIdleMgr->InsertIdleHdl( rLink, nPrio ); -} - -void Application::RemoveIdleHdl( const Link<Application*,void>& rLink ) -{ - ImplSVData* pSVData = ImplGetSVData(); - - if ( pSVData->maAppData.mpIdleMgr ) - pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink ); -} - WorkWindow* Application::GetAppWindow() { return ImplGetSVData()->maWinData.mpAppWin; diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index cc5a32c8b7a0..b3f4ed688d1e 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -61,7 +61,6 @@ #include <vcl/svmain.hxx> #include "dbggui.hxx" #include "accmgr.hxx" -#include "idlemgr.hxx" #include "outdev.h" #include "fontinstance.hxx" #include "PhysicalFontCollection.hxx" @@ -405,11 +404,6 @@ void DeInitVCL() pSVData->mpSettingsConfigItem = nullptr; } - if ( pSVData->maAppData.mpIdleMgr ) - { - delete pSVData->maAppData.mpIdleMgr; - pSVData->maAppData.mpIdleMgr = nullptr; - } Scheduler::ImplDeInitScheduler(); if ( pSVData->maWinData.mpMsgBoxImgList ) |