[Libreoffice-commits] .: 3 commits - vcl/inc vcl/source

David Tardon dtardon at kemper.freedesktop.org
Wed Apr 27 04:30:14 PDT 2011


 vcl/inc/vcl/cursor.hxx       |   18 +++++++----
 vcl/source/window/cursor.cxx |   70 +++++++++++++++++++++++++------------------
 vcl/source/window/window.cxx |    4 +-
 3 files changed, 55 insertions(+), 37 deletions(-)

New commits:
commit 7da791d9989aabcaaa9d562a43246b70a38b0bbb
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Apr 27 13:29:21 2011 +0200

    fdo#36404 real fix this time

diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx
index 536012c..0282a3a 100644
--- a/vcl/inc/vcl/cursor.hxx
+++ b/vcl/inc/vcl/cursor.hxx
@@ -69,8 +69,10 @@ public:
     SAL_DLLPRIVATE void			ImplDraw();
     SAL_DLLPRIVATE void			ImplRestore();
     DECL_DLLPRIVATE_LINK(       ImplTimerHdl, AutoTimer* );
-    SAL_DLLPRIVATE void			ImplShow( bool bDrawDirect = true, bool bRestore = false );
-    SAL_DLLPRIVATE bool			ImplHide();
+    SAL_DLLPRIVATE void			ImplShow( bool bDrawDirect = true );
+    SAL_DLLPRIVATE void			ImplHide();
+    SAL_DLLPRIVATE void			ImplResume( bool bRestore = false );
+    SAL_DLLPRIVATE bool			ImplSuspend();
     SAL_DLLPRIVATE void			ImplNew();
 
 public:
@@ -113,6 +115,10 @@ public:
     bool			operator==( const Cursor& rCursor ) const;
     bool			operator!=( const Cursor& rCursor ) const
                         { return !(Cursor::operator==( rCursor )); }
+
+private:
+    void ImplDoShow( bool bDrawDirect, bool bRestore );
+    bool ImplDoHide( bool bStop );
 };
 
 #endif	// _SV_CURSOR_HXX
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 6656c75..163ada9 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -170,9 +170,7 @@ void Cursor::ImplRestore()
     }
 }
 
-// -----------------------------------------------------------------------
-
-void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
+void Cursor::ImplDoShow( bool bDrawDirect, bool bRestore )
 {
     if ( mbVisible )
     {
@@ -215,9 +213,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
     }
 }
 
-// -----------------------------------------------------------------------
-
-bool Cursor::ImplHide()
+bool Cursor::ImplDoHide( bool bSuspend )
 {
     bool bWasCurVisible = false;
     if ( mpData && mpData->mpWindow )
@@ -225,12 +221,35 @@ bool Cursor::ImplHide()
         bWasCurVisible = mpData->mbCurVisible;
         if ( mpData->mbCurVisible )
             ImplRestore();
-        mpData->maTimer.Stop();
+
+        if ( !bSuspend )
+        {
+            mpData->maTimer.Stop();
+            mpData->mpWindow = NULL;
+        }
     }
     return bWasCurVisible;
 }
 
-// -----------------------------------------------------------------------
+void Cursor::ImplShow( bool bDrawDirect )
+{
+    ImplDoShow( bDrawDirect, false );
+}
+
+void Cursor::ImplHide()
+{
+    ImplDoHide( false );
+}
+
+void Cursor::ImplResume( bool bRestore )
+{
+    ImplDoShow( false, bRestore );
+}
+
+bool Cursor::ImplSuspend()
+{
+    ImplDoHide( true );
+}
 
 void Cursor::ImplNew()
 {
@@ -331,12 +350,6 @@ void Cursor::Hide()
     {
         mbVisible = false;
         ImplHide();
-
-        if( mpData )
-        {
-            mpData->maTimer.Stop();
-            mpData->mpWindow = NULL;
-        }
     }
 }
 
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c34ab78..010ec01 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2404,7 +2404,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
         {
             bool bRestoreCursor = false;
             if ( mpWindowImpl->mpCursor )
-                bRestoreCursor = mpWindowImpl->mpCursor->ImplHide();
+                bRestoreCursor = mpWindowImpl->mpCursor->ImplSuspend();
 
             mbInitClipRegion = sal_True;
             mpWindowImpl->mbInPaint = sal_True;
@@ -2451,7 +2451,7 @@ void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
             mbInitClipRegion = sal_True;
             mpWindowImpl->mpPaintRegion = NULL;
             if ( mpWindowImpl->mpCursor )
-                mpWindowImpl->mpCursor->ImplShow( false, bRestoreCursor );
+                mpWindowImpl->mpCursor->ImplResume( bRestoreCursor );
         }
     }
     else
commit aa117799f6e4d520a46f137e9bc1d012a7bff468
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Apr 27 09:45:45 2011 +0200

    no need to use if here

diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 196c0e4..6656c75 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -458,15 +458,14 @@ Cursor& Cursor::operator=( const Cursor& rCursor )
 
 bool Cursor::operator==( const Cursor& rCursor ) const
 {
-    if ( (maPos 		== rCursor.maPos)			&&
+    return
+        ((maPos 		== rCursor.maPos)			&&
          (maSize		== rCursor.maSize)			&&
          (mnSlant		== rCursor.mnSlant) 		&&
          (mnOrientation == rCursor.mnOrientation)	&&
          (mnDirection   == rCursor.mnDirection)	    &&
-         (mbVisible 	== rCursor.mbVisible) )
-        return true;
-    else
-        return false;
+         (mbVisible 	== rCursor.mbVisible))
+        ;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c017c51c9dd33c8fe09f4a18d2ca12a552bd184d
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Apr 27 09:43:45 2011 +0200

    use plain bool instead of sal_Bool

diff --git a/vcl/inc/vcl/cursor.hxx b/vcl/inc/vcl/cursor.hxx
index c7ebe9f..536012c 100644
--- a/vcl/inc/vcl/cursor.hxx
+++ b/vcl/inc/vcl/cursor.hxx
@@ -62,7 +62,7 @@ private:
     Point			maPos;				// Position
     short			mnOrientation;		// Rotation
     sal_uInt16			mnStyle;			// Style
-    sal_Bool			mbVisible;			// Ist Cursor sichtbar
+    bool			mbVisible;			// Ist Cursor sichtbar
     unsigned char	mnDirection;		// indicates direction
 
 public:
@@ -83,7 +83,7 @@ public:
 
     void			Show();
     void			Hide();
-    sal_Bool			IsVisible() const { return mbVisible; }
+    bool			IsVisible() const { return mbVisible; }
 
     void			SetWindow( Window* pWindow );
     Window* 		GetWindow() const { return mpWindow; }
@@ -110,8 +110,8 @@ public:
     unsigned char	GetDirection() const { return mnDirection; }
 
     Cursor& 		operator=( const Cursor& rCursor );
-    sal_Bool			operator==( const Cursor& rCursor ) const;
-    sal_Bool			operator!=( const Cursor& rCursor ) const
+    bool			operator==( const Cursor& rCursor ) const;
+    bool			operator!=( const Cursor& rCursor ) const
                         { return !(Cursor::operator==( rCursor )); }
 };
 
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 9aaccff..196c0e4 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -49,7 +49,7 @@ struct ImplCursorData
     short			mnOrientation;		// Pixel-Orientation
     unsigned char	mnDirection;		// indicates writing direction
     sal_uInt16			mnStyle;			// Cursor-Style
-    sal_Bool			mbCurVisible;		// Ist Cursor aktuell sichtbar
+    bool			mbCurVisible;		// Ist Cursor aktuell sichtbar
     Window* 		mpWindow;			// Zugeordnetes Windows
 };
 
@@ -58,8 +58,8 @@ struct ImplCursorData
 static void ImplCursorInvert( ImplCursorData* pData )
 {
     Window* pWindow  = pData->mpWindow;
-    sal_Bool	bMapMode = pWindow->IsMapModeEnabled();
-    pWindow->EnableMapMode( sal_False );
+    bool	bMapMode = pWindow->IsMapModeEnabled();
+    pWindow->EnableMapMode( false );
     sal_uInt16 nInvertStyle;
     if ( pData->mnStyle & CURSOR_SHADOW )
         nInvertStyle = INVERT_50;
@@ -155,7 +155,7 @@ void Cursor::ImplDraw()
 
         // Ausgabeflaeche berechnen und ausgeben
         ImplCursorInvert( mpData );
-        mpData->mbCurVisible = sal_True;
+        mpData->mbCurVisible = true;
     }
 }
 
@@ -166,7 +166,7 @@ void Cursor::ImplRestore()
     if ( mpData && mpData->mbCurVisible )
     {
         ImplCursorInvert( mpData );
-        mpData->mbCurVisible = sal_False;
+        mpData->mbCurVisible = false;
     }
 }
 
@@ -194,7 +194,7 @@ void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
             if ( !mpData )
             {
                 mpData = new ImplCursorData;
-                mpData->mbCurVisible = sal_False;
+                mpData->mbCurVisible = false;
                 mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) );
             }
 
@@ -270,7 +270,7 @@ Cursor::Cursor()
     mnOrientation	= 0;
     mnDirection 	= 0;
     mnStyle 		= 0;
-    mbVisible		= sal_False;
+    mbVisible		= false;
 }
 
 // -----------------------------------------------------------------------
@@ -318,7 +318,7 @@ void Cursor::Show()
 {
     if ( !mbVisible )
     {
-        mbVisible = sal_True;
+        mbVisible = true;
         ImplShow();
     }
 }
@@ -329,7 +329,7 @@ void Cursor::Hide()
 {
     if ( mbVisible )
     {
-        mbVisible = sal_False;
+        mbVisible = false;
         ImplHide();
 
         if( mpData )
@@ -456,7 +456,7 @@ Cursor& Cursor::operator=( const Cursor& rCursor )
 
 // -----------------------------------------------------------------------
 
-sal_Bool Cursor::operator==( const Cursor& rCursor ) const
+bool Cursor::operator==( const Cursor& rCursor ) const
 {
     if ( (maPos 		== rCursor.maPos)			&&
          (maSize		== rCursor.maSize)			&&
@@ -464,9 +464,9 @@ sal_Bool Cursor::operator==( const Cursor& rCursor ) const
          (mnOrientation == rCursor.mnOrientation)	&&
          (mnDirection   == rCursor.mnDirection)	    &&
          (mbVisible 	== rCursor.mbVisible) )
-        return sal_True;
+        return true;
     else
-        return sal_False;
+        return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list