static pascal long WindowMaskProc(short varCode, WindowRef window, short message, long param) { #pragma unused( varCode ) switch (message) { case kWindowMsgGetFeatures: *(OptionBits*) param = kWindowCanGetWindowRegion | kWindowDefSupportsColorGrafPort; return 1; case kWindowMsgGetRegion: { GetWindowRegionRec* rgnRec = (GetWindowRegionRec*) param; switch (rgnRec->regionCode) { case kWindowTitleBarRgn: case kWindowTitleTextRgn: case kWindowCloseBoxRgn: case kWindowZoomBoxRgn: case kWindowDragRgn: case kWindowGrowRgn: case kWindowCollapseBoxRgn: SetEmptyRgn(rgnRec->winRgn); break; case kWindowStructureRgn: case kWindowContentRgn: getWindowContentRegion(window, rgnRec->winRgn); break; case kWindowUpdateRgn: break; case kWindowOpaqueRgn: SetEmptyRgn(rgnRec -> winRgn); break; default: return errWindowRegionCodeInvalid; } return noErr; } case kWindowMsgHitTest: { Point hitPoint; static RgnHandle tempRgn = nil; if (!tempRgn) tempRgn = NewRgn(); SetPt(&hitPoint, LoWord(param), HiWord(param));//get the point clicked if (PtInRgn(hitPoint, getWindowContentRegion(window, tempRgn))) return wInContent; else return wNoHit; } break; default: break; } return 0; }
MODULE_SCOPE void TkMacOSXDebugFlashRegion( Drawable d, HIShapeRef rgn) { TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion, CGrafPtr port, RgnHandle region); CFShow(rgn); if (d && rgn && QDDebugFlashRegion && !HIShapeIsEmpty(rgn)) { CGrafPtr port = TkMacOSXGetDrawablePort(d); if (port) { static RgnHandle qdRgn = NULL; if (!qdRgn) { qdRgn = NewRgn(); } ChkErr(HIShapeGetAsQDRgn, rgn, qdRgn); /* * Carbon-internal region flashing SPI (c.f. Technote 2124) */ QDDebugFlashRegion(port, qdRgn); SetEmptyRgn(qdRgn); } } }
static void renderspu_SystemSetRootVisibleRegion(GLint cRects, GLint *pRects) { /* Remember the visible region of the root window if there is one */ if (render_spu.hRootVisibleRegion) { DisposeRgn(render_spu.hRootVisibleRegion); render_spu.hRootVisibleRegion = 0; } if (cRects>0) { int i; render_spu.hRootVisibleRegion = NewRgn(); SetEmptyRgn (render_spu.hRootVisibleRegion); RgnHandle tmpRgn = NewRgn(); for (i=0; i<cRects; ++i) { SetRectRgn (tmpRgn, pRects[4*i] , pRects[4*i+1], pRects[4*i+2], pRects[4*i+3]); UnionRgn (render_spu.hRootVisibleRegion, tmpRgn, render_spu.hRootVisibleRegion); } DisposeRgn (tmpRgn); } }
void renderspu_SystemWindowVisibleRegion(WindowInfo *window, GLint cRects, const GLint* pRects) { CRASSERT(window); CRASSERT(window->window); /* Remember any additional clipping stuff e.g. seamless regions */ if (window->hVisibleRegion) { DisposeRgn(window->hVisibleRegion); window->hVisibleRegion = 0; } if (cRects>0) { int i; /* Create some temporary regions */ RgnHandle rgn = NewRgn(); SetEmptyRgn (rgn); RgnHandle tmpRgn = NewRgn(); for (i=0; i<cRects; ++i) { SetRectRgn (tmpRgn, pRects[4*i] , pRects[4*i+1], pRects[4*i+2], pRects[4*i+3]); //DEBUG_MSG_POETZSCH (("visible rect %d %d %d %d\n", pRects[4*i] , pRects[4*i+1], // pRects[4*i+2], pRects[4*i+3])); UnionRgn (rgn, tmpRgn, rgn); } DisposeRgn (tmpRgn); window->hVisibleRegion = rgn; } renderspu_SystemWindowApplyVisibleRegion(window); }
RgnHandle getWindowCollapseBoxRegion(WindowRef window,RgnHandle collapseBoxRegion) { /*------------------------------------------------------ Define the region for the collapse box --------------------------------------------------------*/ SetEmptyRgn(collapseBoxRegion); return collapseBoxRegion; }
RgnHandle getWindowGrowBoxRegion(WindowRef window,RgnHandle growBoxRegion) { /*------------------------------------------------------ Define the region for the Grow Box --------------------------------------------------------*/ SetEmptyRgn(growBoxRegion); return growBoxRegion; }
RgnHandle getWindowTitleTextRegion(WindowRef window,RgnHandle titleTextRegion) { /*------------------------------------------------------ Define the region for the text in the title bar --------------------------------------------------------*/ SetEmptyRgn(titleTextRegion); return titleTextRegion; }
RgnHandle getWindowZoomBoxRegion(WindowRef window,RgnHandle zoomBoxRegion) { /*------------------------------------------------------ Define the region for the zoom box --------------------------------------------------------*/ SetEmptyRgn(zoomBoxRegion); return zoomBoxRegion; }
// The content region is left as a rectangle matching the window size, this is // so the origin in the paint event, and etc. still matches what the // programmer expects. static void wxShapedMacWindowContentRegion(WindowRef window, RgnHandle rgn) { SetEmptyRgn(rgn); wxTopLevelWindowMac* win = wxFindWinFromMacWindow(window); if (win) { wxRect r = win->GetRect(); SetRectRgn(rgn, r.GetLeft(), r.GetTop(), r.GetRight(), r.GetBottom()); } }
/*Assumes that all regions are in the guest coordinates system*/ static void renderspu_SystemWindowApplyVisibleRegion(WindowInfo *window) { ContextInfo *c = renderspuGetWindowContext(window); RgnHandle rgn; GLboolean result = true; DEBUG_MSG_POETZSCH (("ApplyVisibleRegion %x\n", window)); if (!c || !c->context) return; rgn = NewRgn(); SetEmptyRgn(rgn); if (render_spu.hRootVisibleRegion) { /* The render_spu.hRootVisibleRegion has coordinates from the root * window. We intersect it with the rect of the OpenGL window we * currently process. */ SetRectRgn(rgn, window->x, window->y, window->x + window->BltInfo.width, window->y + window->BltInfo.height); SectRgn(render_spu.hRootVisibleRegion, rgn, rgn); /* Because the clipping is done in the coordinate space of the OpenGL * window we have to remove the x/y position from the newly created * region. */ OffsetRgn (rgn, -window->x, -window->y); } else { /* If there is not root clipping region is available, create a base * region with the size of the target window. This covers all * needed/possible space. */ SetRectRgn(rgn, 0, 0, window->BltInfo.width, window->BltInfo.height); } /* Now intersect the window clipping region with a additional region e.g. * for the seamless mode. */ if (window->hVisibleRegion) SectRgn(rgn, window->hVisibleRegion, rgn); if (rgn && !EmptyRgn(rgn)) { /* Set the clip region to the context */ result = render_spu.ws.aglSetInteger(c->context, AGL_CLIP_REGION, (const GLint*)rgn); CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): SetInteger Failed"); result = render_spu.ws.aglEnable(c->context, AGL_CLIP_REGION); CHECK_AGL_RC (result, "Render SPU (renderspu_SystemWindowVisibleRegion): Enable Failed"); } /* Clear the region structure */ DisposeRgn (rgn); }
RgnHandle getWindowContentRegion(WindowRef window,RgnHandle contentRegion) { /*------------------------------------------------------ Define the content region of our window. --------------------------------------------------------*/ SetEmptyRgn(contentRegion); if(!IsWindowCollapsed(window)){ //only define the content region when the window is //not collapsed } return contentRegion; }
// The structure region is set to the shape given to the SetShape method. static void wxShapedMacWindowStructureRegion(WindowRef window, RgnHandle rgn) { RgnHandle cachedRegion = (RgnHandle) GetWRefCon(window); SetEmptyRgn(rgn); if (cachedRegion) { Rect windowRect; wxShapedMacWindowGetPos(window, &windowRect); //how big is the window CopyRgn(cachedRegion, rgn); //make a copy of our cached region OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size } }
void wxTopLevelWindowMac::MacUpdate( long timestamp) { 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( updateRgn , &trueUpdateRgnBoundary ) ; SectRgn( updateRgn , visRgn , updateRgn ) ; if ( trueUpdateRgn ) DisposeRgn( trueUpdateRgn ) ; SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ; #else GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ); #endif DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ; if ( !EmptyRgn( updateRgn ) ) { MacRedraw( updateRgn , timestamp , m_macNeedsErasing || !EmptyRgn( diffRgn ) ) ; } } if ( updateRgn ) DisposeRgn( updateRgn ); if ( diffRgn ) DisposeRgn( diffRgn ); if ( visRgn ) DisposeRgn( visRgn ) ; EndUpdate( (WindowRef)m_macWindow ) ; SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ; m_macNeedsErasing = false ; }
static SInt32 wxShapedMacWindowGetRegion(WindowRef window, SInt32 param) { GetWindowRegionPtr rgnRec=(GetWindowRegionPtr)param; switch(rgnRec->regionCode) { case kWindowStructureRgn: wxShapedMacWindowStructureRegion(window, rgnRec->winRgn); break; case kWindowContentRgn: wxShapedMacWindowContentRegion(window, rgnRec->winRgn); break; default: SetEmptyRgn(rgnRec->winRgn); } //switch return noErr; }
RgnHandle getWindowDragRegion(WindowRef window, RgnHandle dragRegion) { /*------------------------------------------------------ Define the drag region of our window. --------------------------------------------------------*/ RgnHandle structureRegion=NewRgn(); RgnHandle contentRegion=NewRgn(); SetEmptyRgn(dragRegion); getWindowStructureRegion(window,structureRegion); getWindowContentRegion(window,contentRegion); //our drag region is the difference between the structural and content regions DiffRgn(structureRegion,contentRegion,dragRegion); DisposeRgn(structureRegion); DisposeRgn(contentRegion); return dragRegion; }
static void mac_eventloop(void) { Boolean gotevent; EventRecord event; RgnHandle cursrgn; Point mousenow, mousethen; KeyState *ks; WindowPtr front; cursrgn = NewRgn(); GetMouse(&mousethen); for (;;) { mac_adjustcursor(cursrgn); gotevent = WaitNextEvent(everyEvent, &event, LONG_MAX, cursrgn); mac_adjustcursor(cursrgn); front = mac_frontwindow(); if (front != NULL) { ks = mac_windowkey(front); if (ks->collecting_entropy) { GetMouse(&mousenow); if (mousenow.h != mousethen.h || mousenow.v != mousethen.v) { ks->entropy[ks->entropy_got++] = *(unsigned *)&mousenow; ks->entropy[ks->entropy_got++] = TickCount(); if (ks->entropy_got >= ks->entropy_required) ks->collecting_entropy = 0; SetControlValue(ks->progress, ks->entropy_got); mousethen = mousenow; } SetEmptyRgn(cursrgn); } } if (gotevent) mac_event(&event); if (borednow) cleanup_exit(0); } DisposeRgn(cursrgn); }
RgnHandle getWindowStructureRegion(WindowRef window, RgnHandle structureRegion) { /*------------------------------------------------------ Define the structural region of our window. --------------------------------------------------------*/ static RgnHandle pictureRgn=NULL; static Rect pictureRect; Rect windowRect; SetEmptyRgn(structureRegion); if(!pictureRgn){//haven't Cached our region yet PicHandle myPicture=GetPicture(kMaskPictureID); GrafPtr origPort; GDHandle origDev; GWorldPtr pictMask; PixMapHandle maskBitMap; GetGWorld(&origPort,&origDev); pictureRgn=NewRgn(); pictureRect=(*myPicture)->picFrame; NewGWorld(&pictMask,1,&pictureRect,NULL,NULL,0); maskBitMap=GetPortPixMap(pictMask); LockPixels(maskBitMap); SetGWorld(pictMask,NULL); EraseRect(&pictureRect); DrawPicture(myPicture,&pictureRect); BitMapToRegion(pictureRgn,(BitMap*)*maskBitMap);//use the mask to create a region InsetRgn(pictureRgn,1,1); SetGWorld(origPort,origDev); UnlockPixels(maskBitMap); DisposeGWorld(pictMask); ReleaseResource((Handle)myPicture); } getCurrentPortBounds(&windowRect);//how big is the window CopyRgn(pictureRgn,structureRegion);//make a copy of our cached region MapRgn(structureRegion,&pictureRect,&windowRect);//scale it to our actual window size return structureRegion; }
Q_GUI_EXPORT RgnHandle qt_mac_get_rgn() { #ifdef RGN_CACHE_SIZE if(!rgncache_init) { rgncache_used = 0; rgncache_init = true; for(int i = 0; i < RGN_CACHE_SIZE; ++i) rgncache[i] = 0; qAddPostRoutine(qt_mac_cleanup_rgncache); } else if(rgncache_used) { for(int i = 0; i < RGN_CACHE_SIZE; ++i) { if(rgncache[i]) { RgnHandle ret = rgncache[i]; SetEmptyRgn(ret); rgncache[i] = 0; --rgncache_used; return ret; } } } #endif return NewRgn(); }
void TkMacOSXInvalidateWindow( MacDrawable *macWin, /* Make window that's causing damage. */ int flag) /* Should be TK_WINDOW_ONLY or * TK_PARENT_WINDOW */ { WindowRef windowRef; HIShapeRef rgn; windowRef = TkMacOSXDrawableWindow((Drawable)macWin); if (macWin->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macWin->winPtr); } rgn = (flag == TK_WINDOW_ONLY) ? macWin->visRgn : macWin->aboveVisRgn; if (!HIShapeIsEmpty(rgn)) { TkMacOSXCheckTmpQdRgnEmpty(); ChkErr(HIShapeGetAsQDRgn, rgn, tkMacOSXtmpQdRgn); InvalWindowRgn(windowRef, tkMacOSXtmpQdRgn); SetEmptyRgn(tkMacOSXtmpQdRgn); } #ifdef TK_MAC_DEBUG_CLIP_REGIONS TkMacOSXDebugFlashRegion((Drawable) macWin, rgn); #endif /* TK_MAC_DEBUG_CLIP_REGIONS */ }
int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ GC gc, /* GC for window to be scrolled. */ int x, /* Position rectangle to be scrolled. */ int y, int width, int height, int dx, /* Distance rectangle should be moved. */ int dy, TkRegion damageRgn) /* Region to accumulate damage in. */ { MacDrawable *destDraw = (MacDrawable *) Tk_WindowId(tkwin); RgnHandle rgn = (RgnHandle) damageRgn; CGrafPtr saveWorld; GDHandle saveDevice; GWorldPtr destPort; Rect srcRect, scrollRect; destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin)); GetGWorld(&saveWorld, &saveDevice); SetGWorld(destPort, NULL); TkMacSetUpClippingRgn(Tk_WindowId(tkwin)); /* * Due to the implementation below the behavior may be differnt * than X in certain cases that should never occur in Tk. The * scrollRect is the source rect extended by the offset (the union * of the source rect and the offset rect). Everything * in the extended scrollRect is scrolled. On X, it's possible * to "skip" over an area if the offset makes the source and * destination rects disjoint and non-aligned. */ SetRect(&srcRect, (short) (destDraw->xOff + x), (short) (destDraw->yOff + y), (short) (destDraw->xOff + x + width), (short) (destDraw->yOff + y + height)); scrollRect = srcRect; if (dx < 0) { scrollRect.left += dx; } else { scrollRect.right += dx; } if (dy < 0) { scrollRect.top += dy; } else { scrollRect.bottom += dy; } /* * Adjust clip region so that we don't copy any windows * that may overlap us. */ RectRgn(rgn, &srcRect); DiffRgn(rgn, destPort->visRgn, rgn); OffsetRgn(rgn, dx, dy); DiffRgn(destPort->clipRgn, rgn, destPort->clipRgn); SetEmptyRgn(rgn); /* * When a menu is up, the Mac does not expect drawing to occur and * does not clip out the menu. We have to do it ourselves. This * is pretty gross. */ if (tkUseMenuCascadeRgn == 1) { Point scratch = {0, 0}; MacDrawable *macDraw = (MacDrawable *) Tk_WindowId(tkwin); LocalToGlobal(&scratch); CopyRgn(tkMenuCascadeRgn, rgn); OffsetRgn(rgn, -scratch.h, -scratch.v); DiffRgn(destPort->clipRgn, rgn, destPort->clipRgn); SetEmptyRgn(rgn); macDraw->toplevel->flags |= TK_DRAWN_UNDER_MENU; } ScrollRect(&scrollRect, dx, dy, rgn); SetGWorld(saveWorld, saveDevice); /* * Fortunantly, the region returned by ScrollRect is symanticlly * the same as what we need to return in this function. If the * region is empty we return zero to denote that no damage was * created. */ if (EmptyRgn(rgn)) { return 0; } else { return 1; } }
static pascal OSStatus TransparentWindowHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus status = eventNotHandledErr; switch(GetEventKind(inEvent)) { case kEventWindowGetRegion: { WindowRegionCode code; RgnHandle rgn; // which region code is being queried? GetEventParameter(inEvent, kEventParamWindowRegionCode, typeWindowRegionCode, NULL, sizeof(code), NULL, &code); // if it is the opaque region code then set the region to Empty and return noErr to stop the propagation if (code == kWindowOpaqueRgn) { GetEventParameter(inEvent, kEventParamRgnHandle, typeQDRgnHandle, NULL, sizeof(rgn), NULL, &rgn); SetEmptyRgn(rgn); status = noErr; } break; } case kEventWindowDrawContent: { GrafPtr port; CGContextRef context; Rect portBounds; HIRect bounds; GetPort(&port); GetPortBounds(port, &portBounds); // we need a Quartz context so that we can use transparency QDBeginCGContext(port, &context); // make the whole content transparent bounds = CGRectMake(0, 0, portBounds.right, portBounds.bottom); CGContextClearRect(context, bounds); QDEndCGContext(port, &context); // we need to let the HIToolbox and the regular kEventWindowDrawContent handler do their work, // mainly draw the subviews, so we return eventNotHandledErr to propagate. status = eventNotHandledErr; break; } case kEventControlDraw: { CGContextRef context; HIRect bounds; GetEventParameter(inEvent, kEventParamCGContextRef, typeCGContextRef, NULL, sizeof(context), NULL, &context); HIViewGetBounds((HIViewRef)inUserData, &bounds); // make the whole content transparent CGContextClearRect(context, bounds); // we must not let the default draw handler of the content view be called (it would draw the default opaque theme) // so we return noErr to stop the propagation. status = noErr; break; } } return status; }
bool MCRegionSetEmpty(MCRegionRef self) { SetEmptyRgn((RgnHandle)self); return true; }
void TkMacOSXUpdateClipRgn( TkWindow *winPtr) { MacDrawable *macWin; if (winPtr == NULL) { return; } macWin = winPtr->privatePtr; if (macWin && macWin->flags & TK_CLIP_INVALID) { TkWindow *win2Ptr; if (Tk_IsMapped(winPtr)) { int rgnChanged = 0; CGRect bounds; HIMutableShapeRef rgn; /* * Start with a region defined by the window bounds. */ TkMacOSXWinCGBounds(winPtr, &bounds); rgn = TkMacOSXHIShapeCreateMutableWithRect(&bounds); /* * Clip away the area of any windows that may obscure this window. * For a non-toplevel window, first, clip to the parents visible * clip region. Second, clip away any siblings that are higher in * the stacking order. For an embedded toplevel, just clip to the * container's visible clip region. Remember, we only allow one * contained window in a frame, and don't support any other widgets * in the frame either. This is not currently enforced, however. */ if (!Tk_IsTopLevel(winPtr)) { TkMacOSXUpdateClipRgn(winPtr->parentPtr); if (winPtr->parentPtr) { ChkErr(HIShapeIntersect, winPtr->parentPtr->privatePtr->aboveVisRgn, rgn, rgn); } win2Ptr = winPtr; while ((win2Ptr = win2Ptr->nextPtr)) { if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) { continue; } TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); } } else if (Tk_IsEmbedded(winPtr)) { win2Ptr = TkpGetOtherWindow(winPtr); if (win2Ptr) { TkMacOSXUpdateClipRgn(win2Ptr); ChkErr(HIShapeIntersect, win2Ptr->privatePtr->aboveVisRgn, rgn, rgn); } else if (tkMacOSXEmbedHandler != NULL) { HIShapeRef visRgn; TkMacOSXCheckTmpQdRgnEmpty(); tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr, tkMacOSXtmpQdRgn); visRgn = HIShapeCreateWithQDRgn(tkMacOSXtmpQdRgn); SetEmptyRgn(tkMacOSXtmpQdRgn); ChkErr(HIShapeIntersect, visRgn, rgn, rgn); } /* * TODO: Here we should handle out of process embedding. */ } else if (winPtr->wmInfoPtr->attributes & kWindowResizableAttribute) { HIViewRef growBoxView; OSErr err = HIViewFindByID(HIViewGetRoot( TkMacOSXDrawableWindow(winPtr->window)), kHIViewWindowGrowBoxID, &growBoxView); if (err == noErr) { ChkErr(HIViewGetFrame, growBoxView, &bounds); bounds = CGRectOffset(bounds, -winPtr->wmInfoPtr->xInParent, -winPtr->wmInfoPtr->yInParent); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); } } macWin->aboveVisRgn = HIShapeCreateCopy(rgn); /* * The final clip region is the aboveVis region (or visible region) * minus all the children of this window. If the window is a * container, we must also subtract the region of the embedded * window. */ win2Ptr = winPtr->childList; while (win2Ptr) { if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) { win2Ptr = win2Ptr->nextPtr; continue; } TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); rgnChanged = 1; win2Ptr = win2Ptr->nextPtr; } if (Tk_IsContainer(winPtr)) { win2Ptr = TkpGetOtherWindow(winPtr); if (win2Ptr) { if (Tk_IsMapped(win2Ptr)) { TkMacOSXWinCGBounds(win2Ptr, &bounds); ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds); rgnChanged = 1; } } /* * TODO: Here we should handle out of process embedding. */ } if (rgnChanged) { HIShapeRef diffRgn = HIShapeCreateDifference( macWin->aboveVisRgn, rgn); if (!HIShapeIsEmpty(diffRgn)) { macWin->visRgn = HIShapeCreateCopy(rgn); } CFRelease(diffRgn); } CFRelease(rgn); } else { /* * An unmapped window has empty clip regions to prevent any * (erroneous) drawing into it or its children from becoming * visible. [Bug 940117] */ if (!Tk_IsTopLevel(winPtr)) { TkMacOSXUpdateClipRgn(winPtr->parentPtr); } else if (Tk_IsEmbedded(winPtr)) { win2Ptr = TkpGetOtherWindow(winPtr); if (win2Ptr) { TkMacOSXUpdateClipRgn(win2Ptr); } } macWin->aboveVisRgn = TkMacOSXHIShapeCreateEmpty(); } if (!macWin->visRgn) { macWin->visRgn = HIShapeCreateCopy(macWin->aboveVisRgn); } macWin->flags &= ~TK_CLIP_INVALID; #ifdef TK_MAC_DEBUG_CLIP_REGIONS TkMacOSXDebugFlashRegion((Drawable) macWin, macWin->visRgn); #endif /* TK_MAC_DEBUG_CLIP_REGIONS */ } }