[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/Library_vcl.mk vcl/source

Michael Stahl mstahl at redhat.com
Thu Jul 28 09:05:39 UTC 2016


 include/vcl/svapp.hxx      |   18 ------
 vcl/Library_vcl.mk         |    1 
 vcl/inc/idlemgr.hxx        |   49 -----------------
 vcl/source/app/idlemgr.cxx |  124 ---------------------------------------------
 vcl/source/app/svapp.cxx   |   20 -------
 vcl/source/app/svmain.cxx  |    6 --
 6 files changed, 218 deletions(-)

New commits:
commit 878c4f2490f0554cd0b261ff3699cb156e73b59e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jul 27 21:03:36 2016 +0200

    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 at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index f91d38a..9476fad 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 0b26fdf..c2837a1 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 d9b31cb..0000000
--- 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 5e7086e..0000000
--- 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 78c494d..bd6bccb 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 cc5a32c..b3f4ed6 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 )


More information about the Libreoffice-commits mailing list