vcl119: #i80730# fix cursor paint behavior and timer

This commit is contained in:
Philipp Lohmann [pl] 2011-02-10 18:26:42 +01:00
parent 1a6359d24a
commit e86c363374
3 changed files with 18 additions and 13 deletions

View file

@ -64,15 +64,13 @@ private:
BOOL mbVisible; // Ist Cursor sichtbar
unsigned char mnDirection; // indicates direction
//#if 0 // _SOLAR__PRIVATE
public:
SAL_DLLPRIVATE void ImplDraw();
SAL_DLLPRIVATE void ImplRestore();
DECL_DLLPRIVATE_LINK( ImplTimerHdl, AutoTimer* );
SAL_DLLPRIVATE void ImplShow( BOOL bDrawDirect = TRUE );
SAL_DLLPRIVATE void ImplHide();
SAL_DLLPRIVATE void ImplShow( bool bDrawDirect = true, bool bRestore = false );
SAL_DLLPRIVATE bool ImplHide();
SAL_DLLPRIVATE void ImplNew();
//#endif
public:
Cursor();

View file

@ -171,7 +171,7 @@ void Cursor::ImplRestore()
// -----------------------------------------------------------------------
void Cursor::ImplShow( BOOL bDrawDirect )
void Cursor::ImplShow( bool bDrawDirect, bool bRestore )
{
if ( mbVisible )
{
@ -199,10 +199,10 @@ void Cursor::ImplShow( BOOL bDrawDirect )
mpData->mpWindow = pWindow;
mpData->mnStyle = mnStyle;
if ( bDrawDirect )
if ( bDrawDirect || bRestore )
ImplDraw();
if ( !mpWindow )
if ( !mpWindow && ! ( ! bDrawDirect && mpData->maTimer.IsActive()) )
{
mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
@ -216,16 +216,16 @@ void Cursor::ImplShow( BOOL bDrawDirect )
// -----------------------------------------------------------------------
void Cursor::ImplHide()
bool Cursor::ImplHide()
{
bool bWasCurVisible = false;
if ( mpData && mpData->mpWindow )
{
bWasCurVisible = mpData->mbCurVisible;
if ( mpData->mbCurVisible )
ImplRestore();
mpData->maTimer.Stop();
mpData->mpWindow = NULL;
}
return bWasCurVisible;
}
// -----------------------------------------------------------------------
@ -329,6 +329,12 @@ void Cursor::Hide()
{
mbVisible = FALSE;
ImplHide();
if( mpData )
{
mpData->maTimer.Stop();
mpData->mpWindow = NULL;
}
}
}

View file

@ -2409,8 +2409,9 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags )
mpWindowImpl->mnPaintFlags = 0;
if ( !mpWindowImpl->maInvalidateRegion.IsEmpty() )
{
bool bRestoreCursor = false;
if ( mpWindowImpl->mpCursor )
mpWindowImpl->mpCursor->ImplHide();
bRestoreCursor = mpWindowImpl->mpCursor->ImplHide();
mbInitClipRegion = TRUE;
mpWindowImpl->mbInPaint = TRUE;
@ -2457,7 +2458,7 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags )
mbInitClipRegion = TRUE;
mpWindowImpl->mpPaintRegion = NULL;
if ( mpWindowImpl->mpCursor )
mpWindowImpl->mpCursor->ImplShow( FALSE );
mpWindowImpl->mpCursor->ImplShow( FALSE, bRestoreCursor );
}
}
else