X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/893727e58af91fdd8c16ed6236df8bddd96a1342..34b1fdebbf3d40caaffad62b5bf89604213afb4a:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index d45476496a..dec6597956 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -102,6 +102,7 @@ static const EventTypeSpec eventList[] = { kEventClassWindow , kEventWindowBoundsChanging } , { kEventClassWindow , kEventWindowBoundsChanged } , { kEventClassWindow , kEventWindowClose } , + { kEventClassWindow , kEventWindowGetRegion } , // we have to catch these events on the toplevel window level, // as controls don't get the raw mouse events anymore @@ -804,6 +805,36 @@ static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef hand } break ; + case kEventWindowGetRegion : + { + if ( toplevelWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) + { + WindowRegionCode windowRegionCode ; + + // Fetch the region code that is being queried + GetEventParameter( event, + kEventParamWindowRegionCode, + typeWindowRegionCode, NULL, + sizeof windowRegionCode, NULL, + &windowRegionCode ) ; + + // If it is the opaque region code then set the + // region to empty and return noErr to stop event + // propagation + if ( windowRegionCode == kWindowOpaqueRgn ) { + RgnHandle region; + GetEventParameter( event, + kEventParamRgnHandle, + typeQDRgnHandle, NULL, + sizeof region, NULL, + ®ion) ; + SetEmptyRgn(region) ; + result = noErr ; + } + } + } + break ; + default : break ; } @@ -1482,6 +1513,24 @@ void wxTopLevelWindowMac::SetExtraStyle(long exStyle) #endif } +bool wxTopLevelWindowMac::SetBackgroundStyle(wxBackgroundStyle style) +{ + if ( !wxTopLevelWindowBase::SetBackgroundStyle(style) ) + return false ; + + WindowRef windowRef = HIViewGetWindow( (HIViewRef)GetHandle() ); + + if ( GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) + { + OSStatus err = HIWindowChangeFeatures( windowRef, 0, kWindowIsOpaque ); + verify_noerr( err ); + err = ReshapeCustomWindow( windowRef ); + verify_noerr( err ); + } + + return true ; +} + // TODO: switch to structure bounds - // we are still using coordinates of the content view //