diff options
-rw-r--r-- | macosx/tkMacOSXDraw.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 11 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 12 |
3 files changed, 20 insertions, 15 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 5512669..a9364fa 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -145,7 +145,7 @@ BitmapRepFromDrawableRect( NSBitmapImageRep *bitmap_rep=NULL; NSView *view=NULL; if ( mac_drawable->flags & TK_IS_PIXMAP ) { - /* + /* This means that the MacDrawable is functioning as a Tk Pixmap, so its view field is NULL. It's context field should point to a CGImage. */ @@ -1478,7 +1478,7 @@ TkScrollWindow( TkRegion damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); - MacDrawable *macDraw = (MacDrawable *) drawable; + MacDrawable *macDraw = (MacDrawable *) drawable; NSView *view = TkMacOSXDrawableView(macDraw); CGRect visRect, srcRect, dstRect, scroll_src, scroll_dst; HIShapeRef dmgRgn = NULL; @@ -1489,7 +1489,7 @@ TkScrollWindow( /* Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; scroll_src = CGRectMake( - macDraw->xOff + x, + macDraw->xOff + x, bounds.size.height - height - (macDraw->yOff + y), width, height); scroll_dst = CGRectOffset(scroll_src, dx, -dy); @@ -1516,7 +1516,7 @@ TkScrollWindow( /* Scroll the rectangle. */ [view scrollRect:NSRectFromCGRect(scroll_src) by:NSMakeSize(dx, -dy)]; [view displayRect:NSRectFromCGRect(scroll_dst)]; - + /* * When a Text widget contains embedded images, scrolling generates * lots of artifacts involving multiple copies of the images @@ -1535,7 +1535,7 @@ TkScrollWindow( * them as damaged. Use Tk coordinates, shifted to account for the * future scrolling. */ - + for (NSView *subview in [view subviews] ) { NSRect frame = [subview frame]; CGRect subviewRect = CGRectMake( @@ -1553,14 +1553,12 @@ TkScrollWindow( CFRelease(dstRgn); } } - } } if ( dmgRgn == NULL ) { dmgRgn = HIShapeCreateEmpty(); } - //TkMacOSXInvalidateViewRegion(view, dmgRgn); TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; CFRelease(dmgRgn); diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 7116050..380d3a7 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -683,15 +683,18 @@ TkpConfigureMenuEntry( int i = 0; NSArray *itemArray = [submenu itemArray]; for (NSMenuItem *item in itemArray) { - TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; - [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; - i++; + TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; + /* Work around an apparent bug where itemArray can have + more items than the menu's entries[] array. */ + if (i >= menuRefPtr->menuPtr->numEntries) break; + [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; + i++; } } - } } } + [menuItem setSubmenu:submenu]; return TCL_OK; diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index a08c56e..d557db3 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -651,7 +651,7 @@ XConfigureWindow( * * TkMacOSXUpdateClipRgn -- * - * This function updates the cliping regions for a given window and all of + * This function updates the clipping regions for a given window and all of * its children. Once updated the TK_CLIP_INVALID flag in the subwindow * data structure is unset. The TK_CLIP_INVALID flag should always be * unset before any drawing is attempted. @@ -817,7 +817,7 @@ TkMacOSXUpdateClipRgn( * * TkMacOSXVisableClipRgn -- * - * This function returns the Macintosh cliping region for the given + * This function returns the Macintosh clipping region for the given * window. The caller is responsible for disposing of the returned * region via TkDestroyRegion(). * @@ -912,7 +912,7 @@ TkMacOSXInvalidateWindow( * TK_PARENT_WINDOW */ { #ifdef TK_MAC_DEBUG_CLIP_REGIONS - TkMacOSXDbgMsg("%s", winPtr->pathName); + TkMacOSXDbgMsg("%s", macWin->winPtr->pathName); #endif if (macWin->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macWin->winPtr); @@ -1070,7 +1070,7 @@ TkMacOSXGetRootControl( * None. * * Side effects: - * The cliping regions for the window and its children are mark invalid. + * The clipping regions for the window and its children are marked invalid. * (Make sure they are valid before drawing.) * *---------------------------------------------------------------------- @@ -1089,6 +1089,10 @@ TkMacOSXInvalClipRgns( * be marked. */ +#ifdef TK_MAC_DEBUG_CLIP_REGIONS + TkMacOSXDbgMsg("%s", winPtr->pathName); +#endif + if (!macWin || macWin->flags & TK_CLIP_INVALID) { return; } |