fixing some redrawing bugs overpainting foreign window's area under OS9, reintroduced TransitionWindow calls

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-05-09 07:16:30 +00:00
parent 76a60a81b4
commit 1925be658c
2 changed files with 32 additions and 20 deletions

View File

@@ -666,20 +666,26 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
{ {
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
RgnHandle visRgn = NewRgn() ;
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
BeginUpdate( (WindowRef)m_macWindow ) ; BeginUpdate( (WindowRef)m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ; RgnHandle diffRgn = NewRgn() ;
if ( updateRgn && diffRgn ) if ( updateRgn && diffRgn )
{ {
#if 1 #if 1
// macos internal control redraws clean up areas we'd like to redraw ourselves // macos internal control redraws clean up areas we'd like to redraw ourselves
// therefore we pick the boundary rect and make sure we can redraw it // therefore we pick the boundary rect and make sure we can redraw it
// this has to be intersected by the visRgn in order to avoid drawing over its own
// boundaries
RgnHandle trueUpdateRgn = NewRgn() ; RgnHandle trueUpdateRgn = NewRgn() ;
Rect trueUpdateRgnBoundary ; Rect trueUpdateRgnBoundary ;
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn ); GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ; GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
RectRgn( (RgnHandle) updateRgn , &trueUpdateRgnBoundary ) ; RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
SectRgn( updateRgn , visRgn , updateRgn ) ;
if ( trueUpdateRgn ) if ( trueUpdateRgn )
DisposeRgn( trueUpdateRgn ) ; DisposeRgn( trueUpdateRgn ) ;
SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ; SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
@@ -696,6 +702,9 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
DisposeRgn( updateRgn ); DisposeRgn( updateRgn );
if ( diffRgn ) if ( diffRgn )
DisposeRgn( diffRgn ); DisposeRgn( diffRgn );
if ( visRgn )
DisposeRgn( visRgn ) ;
EndUpdate( (WindowRef)m_macWindow ) ; EndUpdate( (WindowRef)m_macWindow ) ;
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ; SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
m_macNeedsErasing = false ; m_macNeedsErasing = false ;
@@ -897,9 +906,7 @@ bool wxTopLevelWindowMac::Show(bool show)
if (show) if (show)
{ {
// this is leading to incorrect window layering in some situations ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
// ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
::ShowWindow( (WindowRef)m_macWindow ) ;
::SelectWindow( (WindowRef)m_macWindow ) ; ::SelectWindow( (WindowRef)m_macWindow ) ;
// no need to generate events here, they will get them triggered by macos // no need to generate events here, they will get them triggered by macos
// actually they should be , but apparently they are not // actually they should be , but apparently they are not
@@ -910,9 +917,7 @@ bool wxTopLevelWindowMac::Show(bool show)
} }
else else
{ {
// this is leading to incorrect window layering in some situations ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
// ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
::HideWindow( (WindowRef)m_macWindow ) ;
} }
if ( !show ) if ( !show )
@@ -1108,14 +1113,13 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
#endif #endif
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Support functions for shaped windows, based on Apple's CustomWindow sample at // Support functions for shaped windows, based on Apple's CustomWindow sample at
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm // http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#if TARGET_CARBON #if TARGET_CARBON
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
{ {
GetWindowPortBounds(window, inRect); GetWindowPortBounds(window, inRect);
@@ -1240,5 +1244,7 @@ static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16
return 0; return 0;
} }
#endif #endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -666,20 +666,26 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
{ {
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ; wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
RgnHandle visRgn = NewRgn() ;
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
BeginUpdate( (WindowRef)m_macWindow ) ; BeginUpdate( (WindowRef)m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ; RgnHandle diffRgn = NewRgn() ;
if ( updateRgn && diffRgn ) if ( updateRgn && diffRgn )
{ {
#if 1 #if 1
// macos internal control redraws clean up areas we'd like to redraw ourselves // macos internal control redraws clean up areas we'd like to redraw ourselves
// therefore we pick the boundary rect and make sure we can redraw it // therefore we pick the boundary rect and make sure we can redraw it
// this has to be intersected by the visRgn in order to avoid drawing over its own
// boundaries
RgnHandle trueUpdateRgn = NewRgn() ; RgnHandle trueUpdateRgn = NewRgn() ;
Rect trueUpdateRgnBoundary ; Rect trueUpdateRgnBoundary ;
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn ); GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ; GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
RectRgn( (RgnHandle) updateRgn , &trueUpdateRgnBoundary ) ; RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
SectRgn( updateRgn , visRgn , updateRgn ) ;
if ( trueUpdateRgn ) if ( trueUpdateRgn )
DisposeRgn( trueUpdateRgn ) ; DisposeRgn( trueUpdateRgn ) ;
SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ; SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
@@ -696,6 +702,9 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
DisposeRgn( updateRgn ); DisposeRgn( updateRgn );
if ( diffRgn ) if ( diffRgn )
DisposeRgn( diffRgn ); DisposeRgn( diffRgn );
if ( visRgn )
DisposeRgn( visRgn ) ;
EndUpdate( (WindowRef)m_macWindow ) ; EndUpdate( (WindowRef)m_macWindow ) ;
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ; SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
m_macNeedsErasing = false ; m_macNeedsErasing = false ;
@@ -897,9 +906,7 @@ bool wxTopLevelWindowMac::Show(bool show)
if (show) if (show)
{ {
// this is leading to incorrect window layering in some situations ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
// ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
::ShowWindow( (WindowRef)m_macWindow ) ;
::SelectWindow( (WindowRef)m_macWindow ) ; ::SelectWindow( (WindowRef)m_macWindow ) ;
// no need to generate events here, they will get them triggered by macos // no need to generate events here, they will get them triggered by macos
// actually they should be , but apparently they are not // actually they should be , but apparently they are not
@@ -910,9 +917,7 @@ bool wxTopLevelWindowMac::Show(bool show)
} }
else else
{ {
// this is leading to incorrect window layering in some situations ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
// ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
::HideWindow( (WindowRef)m_macWindow ) ;
} }
if ( !show ) if ( !show )
@@ -1108,14 +1113,13 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
#endif #endif
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Support functions for shaped windows, based on Apple's CustomWindow sample at // Support functions for shaped windows, based on Apple's CustomWindow sample at
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm // http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#if TARGET_CARBON #if TARGET_CARBON
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
{ {
GetWindowPortBounds(window, inRect); GetWindowPortBounds(window, inRect);
@@ -1240,5 +1244,7 @@ static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16
return 0; return 0;
} }
#endif #endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------