static long gs_lastWhen = 0;
+#if TARGET_CARBON
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
+#endif
// ============================================================================
// wxTopLevelWindowMac implementation
attr |= kWindowCloseBoxAttribute ;
}
+#if TARGET_CARBON
+#if 0 // having problems right now with that
if (HasFlag(wxSTAY_ON_TOP))
wclass = kUtilityWindowClass;
+#endif
+#endif
+#if TARGET_CARBON
if ( HasFlag(wxFRAME_SHAPED) )
{
WindowDefSpec customWindowDefSpec;
(WindowRef*) &m_macWindow);
}
else
+#endif
{
::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ;
}
m_macFocus = NULL ;
+#if TARGET_CARBON
if ( HasFlag(wxFRAME_SHAPED) )
{
// default shape matches the window size
wxRegion rgn(0, 0, m_width, m_height);
SetShape(rgn);
}
+#endif
}
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXHWND *window , wxWindowMac** rootwin)
{
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
+ RgnHandle visRgn = NewRgn() ;
+ GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
BeginUpdate( (WindowRef)m_macWindow ) ;
RgnHandle updateRgn = NewRgn();
RgnHandle diffRgn = NewRgn() ;
+
if ( updateRgn && diffRgn )
{
#if 1
// 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
+ // this has to be intersected by the visRgn in order to avoid drawing over its own
+ // boundaries
RgnHandle trueUpdateRgn = NewRgn() ;
Rect trueUpdateRgnBoundary ;
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
- RectRgn( (RgnHandle) updateRgn , &trueUpdateRgnBoundary ) ;
+ RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
+ SectRgn( updateRgn , visRgn , updateRgn ) ;
if ( trueUpdateRgn )
DisposeRgn( trueUpdateRgn ) ;
SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
DisposeRgn( updateRgn );
if ( diffRgn )
DisposeRgn( diffRgn );
+ if ( visRgn )
+ DisposeRgn( visRgn ) ;
+
EndUpdate( (WindowRef)m_macWindow ) ;
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
m_macNeedsErasing = false ;
// Early versions of MacOS X don't refresh backgrounds properly,
// so refresh the whole window on activation and deactivation.
long osVersion = UMAGetSystemVersion();
- if (osVersion >= 0x1000 && osVersion < 0x1020)
+ if (osVersion >= 0x1000 && osVersion < 0x1020 )
{
Refresh(TRUE);
}
if (show)
{
- // this is leading to incorrect window layering in some situations
- // ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
- ::ShowWindow( (WindowRef)m_macWindow ) ;
+ ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowShowTransitionAction,nil);
::SelectWindow( (WindowRef)m_macWindow ) ;
// no need to generate events here, they will get them triggered by macos
// actually they should be , but apparently they are not
}
else
{
- // this is leading to incorrect window layering in some situations
- // ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
- ::HideWindow( (WindowRef)m_macWindow ) ;
+ ::TransitionWindow((WindowRef)m_macWindow,kWindowZoomTransitionEffect,kWindowHideTransitionAction,nil);
}
if ( !show )
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
+#if TARGET_CARBON
// The empty region signifies that the shape should be removed from the
// window.
if ( region.IsEmpty() )
// Tell the window manager that the window has changed shape
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
return TRUE;
+#else
+ return FALSE;
+#endif
}
-
-
// ---------------------------------------------------------------------------
// 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
// ---------------------------------------------------------------------------
+#if TARGET_CARBON
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
{
return 0;
}
+#endif
// ---------------------------------------------------------------------------
+