[Libreoffice-commits] core.git: desktop/source vcl/osx

Jan-Marek Glogowski glogow at fbihome.de
Wed Sep 6 13:03:19 UTC 2017


 desktop/source/deployment/gui/dp_gui_dialog2.cxx |   28 ++++++++++++++---------
 desktop/source/deployment/gui/dp_gui_dialog2.hxx |    4 +--
 vcl/osx/salnativewidgets.cxx                     |    8 +++---
 3 files changed, 24 insertions(+), 16 deletions(-)

New commits:
commit bc3e0121b47cc601575b0a49f6ba4959130cf96e
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Aug 7 21:10:11 2017 +0200

    Don't poll the extension install progress bar
    
    Just start the Idle, if actually something changed.
    
    Quite probably we shouldn't rely on an Idle at all, but this
    fixes the busy loop while installing an extension waiting in
    a confirmation dialog.
    
    Change-Id: I3abbe2eb6651ce9320ef6e4d9c5251a23ab87216

diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 80a46523557b..8b311528e7ce 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -519,6 +519,7 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager,
     }
 
     m_aIdle.SetPriority(TaskPriority::LOWEST);
+    m_aIdle.SetDebugName( "ExtMgrDialog m_aIdle TimeOutHdl" );
     m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
 }
 
@@ -855,14 +856,18 @@ void ExtMgrDialog::showProgress( bool _bStart )
     }
 
     DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), reinterpret_cast<void*>(bStart) );
+    m_aIdle.Start();
 }
 
 
 void ExtMgrDialog::updateProgress( const long nProgress )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
-
-    m_nProgress = nProgress;
+    if ( m_nProgress != nProgress )
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        m_nProgress = nProgress;
+        m_aIdle.Start();
+    }
 }
 
 
@@ -874,6 +879,7 @@ void ExtMgrDialog::updateProgress( const OUString &rText,
     m_xAbortChannel = xAbortChannel;
     m_sProgressText = rText;
     m_bProgressChanged = true;
+    m_aIdle.Start();
 }
 
 
@@ -991,8 +997,6 @@ IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Timer *, void)
 
         if ( m_pProgressBar->IsVisible() )
             m_pProgressBar->SetValue( (sal_uInt16) m_nProgress );
-
-        m_aIdle.Start();
     }
 }
 
@@ -1079,6 +1083,7 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
     m_pCloseBtn->GrabFocus();
 
     m_aIdle.SetPriority( TaskPriority::LOWEST );
+    m_aIdle.SetDebugName( "UpdateRequiredDialog m_aIdle TimeOutHdl" );
     m_aIdle.SetInvokeHandler( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
 }
 
@@ -1195,14 +1200,18 @@ void UpdateRequiredDialog::showProgress( bool _bStart )
     }
 
     DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), reinterpret_cast<void*>(bStart) );
+    m_aIdle.Start();
 }
 
 
 void UpdateRequiredDialog::updateProgress( const long nProgress )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
-
-    m_nProgress = nProgress;
+    if ( m_nProgress != nProgress )
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        m_nProgress = nProgress;
+        m_aIdle.Start();
+    }
 }
 
 
@@ -1214,6 +1223,7 @@ void UpdateRequiredDialog::updateProgress( const OUString &rText,
     m_xAbortChannel = xAbortChannel;
     m_sProgressText = rText;
     m_bProgressChanged = true;
+    m_aIdle.Start();
 }
 
 
@@ -1301,8 +1311,6 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, TimeOutHdl, Timer *, void)
 
         if ( m_pProgressBar->IsVisible() )
             m_pProgressBar->SetValue( (sal_uInt16) m_nProgress );
-
-        m_aIdle.Start();
     }
 }
 
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 60a87d75b6e5..cf4f423b83f7 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -141,7 +141,7 @@ class ExtMgrDialog : public ModelessDialog,
     DECL_LINK( HandleCancelBtn, Button*, void );
     DECL_LINK( HandleCloseBtn, Button*, void );
     DECL_LINK( HandleExtTypeCbx, Button*, void );
-    DECL_LINK(TimeOutHdl, Timer *, void);
+    DECL_LINK( TimeOutHdl, Timer *, void );
     DECL_LINK( startProgress, void *, void );
     DECL_STATIC_LINK( ExtMgrDialog, Restart, void *, void );
 
@@ -214,7 +214,7 @@ class UpdateRequiredDialog : public ModalDialog,
     DECL_LINK( HandleUpdateBtn, Button*, void );
     DECL_LINK( HandleCloseBtn, Button*, void );
     DECL_LINK( HandleCancelBtn, Button*, void );
-    DECL_LINK(TimeOutHdl, Timer *, void);
+    DECL_LINK( TimeOutHdl, Timer *, void );
     DECL_LINK( startProgress, void *, void );
 
     static bool     isEnabled( const css::uno::Reference< css::deployment::XPackage > &xPackage );
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index 56ac7f2131bf..39cb514ddcbf 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -50,18 +50,18 @@ class AquaBlinker : public Timer
     tools::Rectangle           maInvalidateRect;
 
     AquaBlinker( AquaSalFrame* pFrame, const tools::Rectangle& rRect )
-    : mpFrame( pFrame ), maInvalidateRect( rRect )
+        : Timer( "AquaBlinker" )
+        , mpFrame( pFrame )
+        , maInvalidateRect( rRect )
     {
         mpFrame->maBlinkers.push_back( this );
     }
 
-    public:
-
+public:
     static void Blink( AquaSalFrame*, const tools::Rectangle&, int nTimeout = 80 );
 
     virtual void Invoke() override
     {
-        Stop();
         if( AquaSalFrame::isAlive( mpFrame ) && mpFrame->mbShown )
         {
             mpFrame->maBlinkers.remove( this );


More information about the Libreoffice-commits mailing list