[Libreoffice-commits] core.git: Branch 'feature/priorities' - include/vcl vcl/inc vcl/source

Tobias Madl tobias.madl.dev at gmail.com
Fri Oct 31 03:27:17 PDT 2014


 include/vcl/timer.hxx         |    5 +++--
 vcl/inc/window.h              |    2 +-
 vcl/source/app/timer.cxx      |   14 +++++++++++++-
 vcl/source/window/paint.cxx   |   16 ++++++++--------
 vcl/source/window/window.cxx  |    8 ++++----
 vcl/source/window/winproc.cxx |    2 +-
 6 files changed, 30 insertions(+), 17 deletions(-)

New commits:
commit 74afbb7aa871c846f23c85cb1e1620b3b3590ab1
Author: Tobias Madl <tobias.madl.dev at gmail.com>
Date:   Fri Oct 31 10:25:49 2014 +0000

    Michael's patch implemented
    
    Change-Id: I3f0802d5001172fc7b8409274bc5a3632e5dad34

diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx
index 5c3a49a..10dd3fc 100644
--- a/include/vcl/timer.hxx
+++ b/include/vcl/timer.hxx
@@ -87,9 +87,10 @@ enum IdlePriority {
 
 // To port from Timer -> Idle switch class name,
 // s/Timeout/DoIdle/ etc. and select priority
-class VCL_DLLPUBLIC Idle : private Timer
+class VCL_DLLPUBLIC Idle : public Timer
 {
  public:
+    Idle();
     Idle( IdlePriority ePriority );
     virtual ~Idle();
 
@@ -103,7 +104,7 @@ class VCL_DLLPUBLIC Idle : private Timer
     void            Start() { Timer::Start(); }
     void            Stop()  { Timer::Stop();  }
 
-    virtual void    DoIdle() = 0;
+    virtual void    DoIdle();
 
     virtual void    Timeout() SAL_OVERRIDE { DoIdle(); }
 };
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 60a4489..2b2082e 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -128,7 +128,7 @@ struct ImplOverlapData
 struct ImplFrameData
 {
     Idle                maPaintIdle;            //< paint idle handler
-    Idle                maResizeTimer;          //< resize timer
+    Idle                maResizeIdle;          //< resize timer
     InputContext        maOldInputContext;      //< last set Input Context
     vcl::Window*        mpNextFrame;            //< next frame window
     vcl::Window*        mpFirstOverlap;         //< first overlap vcl::Window
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index e38c347..5f706ab 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -336,6 +336,12 @@ AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer )
     return *this;
 }
 
+Idle::Idle()
+    : Timer()
+{
+    SetPriority(VCL_IDLE_PRIORITY_LOWEST);
+}
+
 Idle::Idle( IdlePriority ePriority )
     : Timer()
 {
@@ -344,7 +350,7 @@ Idle::Idle( IdlePriority ePriority )
 
 void Idle::SetPriority( IdlePriority ePriority )
 {
-    sal_ulong nTimeoutMS = 0;
+    sal_uLong nTimeoutMS = 0;
 
     // Ultimately this will just be a sort key in a work queue.
     switch (ePriority) {
@@ -377,6 +383,12 @@ void Idle::SetPriority( IdlePriority ePriority )
     SetTimeout( nTimeoutMS );
 }
 
+void Idle::DoIdle()
+{
+    maTimeoutHdl.Call( this );
+}
+
+
 Idle::~Idle()
 {
 }
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index ce10aba..7ec329c 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -283,8 +283,8 @@ void Window::ImplCallOverlapPaint()
 
 void Window::ImplPostPaint()
 {
-    if ( !ImplDoTiledRendering() && !mpWindowImpl->mpFrameData->maPaintTimer.IsActive() )
-        mpWindowImpl->mpFrameData->maPaintTimer.Start();
+    if ( !ImplDoTiledRendering() && !mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
+        mpWindowImpl->mpFrameData->maPaintIdle.Start();
 }
 
 IMPL_LINK_NOARG(Window, ImplHandlePaintHdl)
@@ -292,14 +292,14 @@ IMPL_LINK_NOARG(Window, ImplHandlePaintHdl)
     // save paint events until layout is done
     if (!ImplDoTiledRendering() && IsSystemWindow() && static_cast<const SystemWindow*>(this)->hasPendingLayout())
     {
-        mpWindowImpl->mpFrameData->maPaintTimer.Start();
+        mpWindowImpl->mpFrameData->maPaintIdle.Start();
         return 0;
     }
 
     // save paint events until resizing is done
     if( !ImplDoTiledRendering() &&
-        mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeTimer.IsActive() )
-        mpWindowImpl->mpFrameData->maPaintTimer.Start();
+        mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
+        mpWindowImpl->mpFrameData->maPaintIdle.Start();
     else if ( mpWindowImpl->mbReallyVisible )
         ImplCallOverlapPaint();
     return 0;
@@ -314,10 +314,10 @@ IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl)
         {
             ImplHandlePaintHdl(NULL);
         }
-        else if( mpWindowImpl->mpFrameData->maPaintTimer.IsActive() )
+        else if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
         {
-            mpWindowImpl->mpFrameData->maPaintTimer.Stop();
-            mpWindowImpl->mpFrameData->maPaintTimer.GetTimeoutHdl().Call( NULL );
+            mpWindowImpl->mpFrameData->maPaintIdle.Stop();
+            mpWindowImpl->mpFrameData->maPaintIdle.GetIdleHdl().Call( NULL );
         }
     }
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index a1ac1a1..b446884 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1030,7 +1030,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
         if (!ImplDoTiledRendering())
         {
             mpWindowImpl->mpFrameData->maPaintIdle.SetPriority( VCL_IDLE_PRIORITY_REPAINT );
-            mpWindowImpl->mpFrameData->maPaintIDle.SetIdleHdl( LINK( this, Window, ImplHandlePaintHdl ) );
+            mpWindowImpl->mpFrameData->maPaintIdle.SetIdleHdl( LINK( this, Window, ImplHandlePaintHdl ) );
         }
         mpWindowImpl->mpFrameData->maResizeIdle.SetPriority( VCL_IDLE_PRIORITY_RESIZE );
         mpWindowImpl->mpFrameData->maResizeIdle.SetIdleHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) );
@@ -2476,11 +2476,11 @@ Size Window::GetSizePixel() const
     }
 
     // #i43257# trigger pending resize handler to assure correct window sizes
-    if( mpWindowImpl->mpFrameData->maResizeTimer.IsActive() )
+    if( mpWindowImpl->mpFrameData->maResizeIdle.IsActive() )
     {
         ImplDelData aDogtag( this );
-        mpWindowImpl->mpFrameData->maResizeTimer.Stop();
-        mpWindowImpl->mpFrameData->maResizeTimer.GetTimeoutHdl().Call( NULL );
+        mpWindowImpl->mpFrameData->maResizeIdle.Stop();
+        mpWindowImpl->mpFrameData->maResizeIdle.GetIdleHdl().Call( NULL );
         if( aDogtag.IsDead() )
             return Size(0,0);
     }
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index be88ec3e..483ab19 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1591,7 +1591,7 @@ void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight )
                     bStartTimer = false;
 
                 if( bStartTimer )
-                    pWindow->ImplGetWindowImpl()->mpFrameData->maResizeTimer.Start();
+                    pWindow->ImplGetWindowImpl()->mpFrameData->maResizeIdle.Start();
                 else
                     pWindow->ImplCallResize(); // otherwise menus cannot be positioned
             }


More information about the Libreoffice-commits mailing list