summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkFont.c66
-rw-r--r--generic/tkTextDisp.c11
-rw-r--r--macosx/tkMacOSXButton.c163
-rw-r--r--macosx/tkMacOSXDraw.c135
-rw-r--r--macosx/tkMacOSXFont.c2
-rw-r--r--macosx/tkMacOSXInt.h3
-rw-r--r--macosx/tkMacOSXMenu.c15
-rw-r--r--macosx/tkMacOSXRegion.c2
-rw-r--r--macosx/tkMacOSXSubwindows.c12
-rw-r--r--macosx/tkMacOSXXStubs.c4
10 files changed, 271 insertions, 142 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index cbc4cf4..a955c35 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -600,40 +600,40 @@ Tk_FontObjCmd(
return result;
}
case FONT_CONFIGURE: {
- int result;
- const char *string;
- Tcl_Obj *objPtr;
- NamedFont *nfPtr;
- Tcl_HashEntry *namedHashPtr;
-
- if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "fontname ?-option value ...?");
- return TCL_ERROR;
- }
- string = Tcl_GetString(objv[2]);
- namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
+ int result;
+ const char *string;
+ Tcl_Obj *objPtr;
+ NamedFont *nfPtr;
+ Tcl_HashEntry *namedHashPtr;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "fontname ?-option value ...?");
+ return TCL_ERROR;
+ }
+ string = Tcl_GetString(objv[2]);
+ namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
nfPtr = NULL; /* lint. */
- if (namedHashPtr != NULL) {
- nfPtr = Tcl_GetHashValue(namedHashPtr);
- }
- if ((namedHashPtr == NULL) || nfPtr->deletePending) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "named font \"%s\" doesn't exist", string));
- Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL);
- return TCL_ERROR;
- }
- if (objc == 3) {
- objPtr = NULL;
- } else if (objc == 4) {
- objPtr = objv[3];
- } else {
- result = ConfigAttributesObj(interp, tkwin, objc - 3, objv + 3,
- &nfPtr->fa);
- UpdateDependentFonts(fiPtr, tkwin, namedHashPtr);
- return result;
- }
- return GetAttributeInfoObj(interp, &nfPtr->fa, objPtr);
- }
+ if (namedHashPtr != NULL) {
+ nfPtr = Tcl_GetHashValue(namedHashPtr);
+ }
+ if ((namedHashPtr == NULL) || nfPtr->deletePending) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "named font \"%s\" doesn't exist", string));
+ Tcl_SetErrorCode(interp, "TK", "LOOKUP", "FONT", string, NULL);
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ objPtr = NULL;
+ } else if (objc == 4) {
+ objPtr = objv[3];
+ } else {
+ result = ConfigAttributesObj(interp, tkwin, objc - 3, objv + 3,
+ &nfPtr->fa);
+ UpdateDependentFonts(fiPtr, tkwin, namedHashPtr);
+ return result;
+ }
+ return GetAttributeInfoObj(interp, &nfPtr->fa, objPtr);
+ }
case FONT_CREATE: {
int skip = 3, i;
const char *name;
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index aebdcc6..8ceb3fa 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3970,6 +3970,15 @@ DisplayText(
UpdateDisplayInfo(textPtr);
dInfoPtr->dLinesInvalidated = 0;
+#ifdef MAC_OSX_TK
+ /*
+ * Make sure that unmapped subwindows really have been unmapped.
+ * If the unmap request is pending as an idle request, the window
+ * can get redrawn on top of the widget.
+ */
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {}
+#endif
+
/*
* See if it's possible to bring some parts of the screen up-to-date by
* scrolling (copying from other parts of the screen). We have to be
@@ -4035,7 +4044,7 @@ DisplayText(
*/
if ((y + height) > dInfoPtr->maxY) {
- height = dInfoPtr->maxY -y;
+ height = dInfoPtr->maxY - y;
}
oldY = dlPtr->oldY;
if (y < dInfoPtr->y) {
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 036624d..dd4cca7 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -7,6 +7,7 @@
* Copyright (c) 1996-1997 by Sun Microsystems, Inc.
* Copyright 2001-2009, Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright 2014 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -23,9 +24,59 @@
#endif
*/
+static NSRect TkMacOSXGetButtonFrame(TkButton *butPtr);
+
+/*
+ * A subclass of NSButton with sanity checking:
+ * NSButtons created by Tk will have their tag set to a pointer to the TkButton
+ * which manages the NSButton. This allows a TkNSButton to be aware of the
+ * state of its Tk parent. This subclass overrides the drawRect method
+ * so that it will not draw itself unless the NSButton frame matches
+ * the frame which was installed by DisplayButton, and the TkButton is
+ * mapped. Also, it will not draw anything if the widget is completely
+ * outside of its container.
+ */
+
+@interface TkNSButton: NSButton
+
+@end
+
+@implementation TkNSButton
+
+ - (void)drawRect:(NSRect)dirtyRect
+ {
+ NSInteger tag = [self tag];
+ if ( tag != -1) {
+ TkButton *butPtr = (TkButton *)tag;
+ MacDrawable* macWin = (MacDrawable *)butPtr;
+ NSRect Tkframe = TkMacOSXGetButtonFrame(butPtr);
+ Tk_Window tkwin = butPtr->tkwin;
+ /* Do not draw if the widget is misplaced or unmapped. */
+ if ( NSIsEmptyRect(Tkframe) ||
+ ! macWin->winPtr->flags & TK_MAPPED ||
+ ! NSEqualRects(Tkframe, [self frame])
+ ) {
+ return;
+ }
+ /* Do not draw if the widget is completely outside of its parent, or within 20 pixels of the lower border; this prevents buttons from being drawn on peer widgets as scrolling occurs. */
+ if (tkwin) {
+ int parent_height = Tk_Height(Tk_Parent(tkwin));
+ int widget_height = Tk_Height(tkwin);
+ int y = Tk_Y(tkwin);
+ if ( y > parent_height - 20 || y + widget_height < 0 ) {
+ return;
+ }
+ }
+ [super drawRect:dirtyRect];
+ }
+ }
+
+@end
+
+
typedef struct MacButton {
TkButton info;
- NSButton *button;
+ TkNSButton *button;
NSImage *image, *selectImage, *tristateImage;
#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS
int fix;
@@ -186,6 +237,45 @@ TkpDisplayButton(
/*
*----------------------------------------------------------------------
*
+ * TkpShiftButton --
+ *
+ * Moves the frame of an NSButton (or TkNSButton) and in case the tag is
+ * set, also adjusts the xOff and yOff of the controlling TkButton's
+ * MacDrawable. This is used to avoid jitter when scrolling.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * Moves the NSbutton after adjusting the associated MacDrawable.
+ *
+ *----------------------------------------------------------------------
+ */
+void
+TkpShiftButton(
+ NSButton *button,
+ NSPoint delta )
+ {
+ NSPoint origin = [button frame].origin;
+ NSInteger tag = [button tag];
+ if ( tag != -1) {
+ TkButton* butPtr = (TkButton *)tag;
+ TkWindow *winPtr = (TkWindow *) (butPtr->tkwin);
+ if (winPtr) {
+ MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ macWin->xOff += delta.x;
+ macWin->yOff += delta.y;
+ }
+ }
+ origin.x += delta.x;
+ origin.y -= delta.y;
+ [button setFrameOrigin:origin];
+ }
+
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpComputeButtonGeometry --
*
* After changes in a button's text or bitmap, this procedure
@@ -218,7 +308,8 @@ TkpComputeButtonGeometry(
case TYPE_CHECK_BUTTON:
case TYPE_RADIO_BUTTON:
if (!macButtonPtr->button) {
- NSButton *button = [[NSButton alloc] initWithFrame:NSZeroRect];
+ TkNSButton *button = [[TkNSButton alloc] initWithFrame:NSZeroRect];
+ [button setTag:(NSInteger)butPtr];
macButtonPtr->button = TkMacOSXMakeUncollectable(button);
}
ComputeNativeButtonGeometry(butPtr);
@@ -266,6 +357,52 @@ TkpButtonSetDefaults()
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXGetButtonFrame --
+ *
+ * Computes a frame for an NSButton that will correspond to where
+ * Tk thinks the button is located.
+ *
+ * Results:
+ * Returns an NSRect describing a frame for an NSButton.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+NSRect TkMacOSXGetButtonFrame(
+ TkButton *butPtr)
+{
+ MacButton *macButtonPtr = (MacButton *) butPtr;
+ Tk_Window tkwin = butPtr->tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ if (tkwin) {
+ MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ NSView *view = TkMacOSXDrawableView(macWin);
+ CGFloat viewHeight = [view bounds].size.height;
+ NSRect frame = NSMakeRect(macWin->xOff, macWin->yOff,
+ Tk_Width(tkwin), Tk_Height(tkwin));
+
+#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS
+ if (tkMacOSXUseCompatibilityMetrics) {
+ BoundsFix boundsFix = boundsFixes[macButtonPtr->fix];
+ frame = NSOffsetRect(frame, boundsFix.offsetX, boundsFix.offsetY);
+ frame.size.height -= boundsFix.shrinkH + NATIVE_BUTTON_EXTRA_H;
+ frame = NSInsetRect(frame, boundsFix.inset + NATIVE_BUTTON_INSET,
+ boundsFix.inset + NATIVE_BUTTON_INSET);
+ }
+#endif
+
+ frame.origin.y = viewHeight - (frame.origin.y + frame.size.height);
+ return frame;
+ } else {
+ return NSZeroRect;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* DisplayNativeButton --
*
* This procedure is invoked to display a button widget. It is
@@ -286,7 +423,7 @@ DisplayNativeButton(
TkButton *butPtr)
{
MacButton *macButtonPtr = (MacButton *) butPtr;
- NSButton *button = macButtonPtr->button;
+ TkNSButton *button = macButtonPtr->button;
Tk_Window tkwin = butPtr->tkwin;
TkWindow *winPtr = (TkWindow *) tkwin;
MacDrawable *macWin = (MacDrawable *) winPtr->window;
@@ -349,21 +486,8 @@ DisplayNativeButton(
} else {
[button setKeyEquivalent:@""];
}
- frame = NSMakeRect(macWin->xOff, macWin->yOff, Tk_Width(tkwin),
- Tk_Height(tkwin));
-#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS
- if (tkMacOSXUseCompatibilityMetrics) {
- BoundsFix boundsFix = boundsFixes[macButtonPtr->fix];
- frame = NSOffsetRect(frame, boundsFix.offsetX, boundsFix.offsetY);
- frame.size.height -= boundsFix.shrinkH + NATIVE_BUTTON_EXTRA_H;
- frame = NSInsetRect(frame, boundsFix.inset + NATIVE_BUTTON_INSET,
- boundsFix.inset + NATIVE_BUTTON_INSET);
- }
-#endif
- frame.origin.y = viewHeight - (frame.origin.y + frame.size.height);
- if (!NSEqualRects(frame, [button frame])) {
- [button setFrame:frame];
- }
+ frame = TkMacOSXGetButtonFrame(butPtr);
+ [button setFrame:frame];
[button displayRectIgnoringOpacity:[button bounds]];
TkMacOSXRestoreDrawingContext(&dc);
#ifdef TK_MAC_DEBUG_BUTTON
@@ -396,7 +520,7 @@ ComputeNativeButtonGeometry(
TkButton *butPtr) /* Button whose geometry may have changed. */
{
MacButton *macButtonPtr = (MacButton *) butPtr;
- NSButton *button = macButtonPtr->button;
+ TkNSButton *button = macButtonPtr->button;
NSButtonCell *cell = [button cell];
NSButtonType type = -1;
NSBezelStyle style = 0;
@@ -1169,6 +1293,7 @@ ComputeUnixButtonGeometry(
Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
}
+
/*
* Local Variables:
* mode: objc
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 6eef09d..ce8bf9b 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -17,7 +17,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXDebug.h"
#include "xbytes.h"
-
+#include "tkButton.h"
/*
#ifdef TK_MAC_DEBUG
@@ -146,7 +146,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.
*/
@@ -1482,87 +1482,66 @@ TkScrollWindow(
Drawable drawable = Tk_WindowId(tkwin);
MacDrawable *macDraw = (MacDrawable *) drawable;
NSView *view = TkMacOSXDrawableView(macDraw);
- CGRect visRect, srcRect, dstRect, scroll_src, scroll_dst;
- HIShapeRef dmgRgn = NULL;
- NSRect bounds;
+ CGRect srcRect, dstRect;
+ HIShapeRef dmgRgn = NULL, extraRgn;
+ NSRect bounds, visRect, scrollSrc, scrollDst;
+ NSPoint delta = NSMakePoint(dx, dy);
int result;
-
+
if ( view ) {
- /* Get the scroll area in NSView coordinates (origin at bottom left). */
- bounds = [view bounds];
- scroll_src = CGRectMake(
- macDraw->xOff + x,
- bounds.size.height - height - (macDraw->yOff + y),
- width, height);
- scroll_dst = CGRectOffset(scroll_src, dx, -dy);
- /* Limit scrolling to the window content area. */
- visRect = NSRectToCGRect([view visibleRect]);
- scroll_src = CGRectIntersection(scroll_src, visRect);
- scroll_dst = CGRectIntersection(scroll_dst, visRect);
-
- if ( !CGRectIsEmpty(scroll_src) && !CGRectIsEmpty(scroll_dst) ) {
-
- /*
- * Mark the difference between source and destination as damaged.
- * This region is described in the Tk coordinate system, after shifting by dy.
- */
-
- srcRect = CGRectMake(x - macDraw->xOff, y - macDraw->yOff,
- width, height);
- dstRect = CGRectOffset(srcRect, dx, dy);
- dmgRgn = HIShapeCreateMutableWithRect(&srcRect);
- HIShapeRef dstRgn = HIShapeCreateWithRect(&dstRect);
- ChkErr(HIShapeDifference, dmgRgn, dstRgn, (HIMutableShapeRef) dmgRgn);
- CFRelease(dstRgn);
-
- /* 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
- * displayed on top of each other. Extensive experimentation, with
- * very little help from the Apple documentation, indicates that
- * whenever an image is displayed it gets added as a subview, which
- * then gets automatically redisplayed in its original location.
- *
- * We do two things to combat this. First, each subview that meets
- * the scroll area is added as a damage rectangle. Second, we
- * redisplay the subviews after the scroll.
- */
-
- /*
- * Step 1: Find any subviews that meet the scroll area and mark
- * 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(
- frame.origin.x - macDraw->xOff + dx,
- (bounds.size.height - frame.origin.y - frame.size.height) - macDraw->yOff + dy,
- frame.size.width, frame.size.height);
- /* Rectangles with negative coordinates seem to cause trouble. */
- if (subviewRect.origin.y < 0 && subviewRect.origin.y + subviewRect.size.height > 0) {
- subviewRect.origin.y = 0;
- }
- CGRect intersection = CGRectIntersection(srcRect, subviewRect);
- if (! CGRectIsEmpty(intersection) ){
- dstRgn = HIShapeCreateWithRect(&subviewRect);
- ChkErr(HIShapeUnion, dmgRgn, dstRgn, (HIMutableShapeRef) dmgRgn);
- CFRelease(dstRgn);
- }
- }
-
- }
+ /* Get the scroll area in NSView coordinates (origin at bottom left). */
+ bounds = [view bounds];
+ scrollSrc = NSMakeRect(
+ macDraw->xOff + x,
+ bounds.size.height - height - (macDraw->yOff + y),
+ width, height);
+ scrollDst = NSOffsetRect(scrollSrc, dx, -dy);
+ /* Limit scrolling to the window content area. */
+ visRect = [view visibleRect];
+ scrollSrc = NSIntersectionRect(scrollSrc, visRect);
+ scrollDst = NSIntersectionRect(scrollDst, visRect);
+
+ if ( !NSIsEmptyRect(scrollSrc) && !NSIsEmptyRect(scrollDst) ) {
+
+ /*
+ * Mark the difference between source and destination as damaged.
+ * This region is described in the Tk coordinate system.
+ */
+
+ srcRect = CGRectMake(x, y, width, height);
+ dstRect = CGRectOffset(srcRect, dx, dy);
+ dmgRgn = HIShapeCreateMutableWithRect(&srcRect);
+ extraRgn = HIShapeCreateWithRect(&dstRect);
+ ChkErr(HIShapeDifference, dmgRgn, extraRgn, (HIMutableShapeRef) dmgRgn);
+ CFRelease(extraRgn);
+
+ /* Scroll the rectangle. */
+ [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)];
+
+ /*
+ * Adjust the positions of the button subwindows that meet the scroll
+ * area.
+ */
+
+ for (NSView *subview in [view subviews] ) {
+ if ( [subview isKindOfClass:[NSButton class]] == YES ) {
+ NSRect subframe = [subview frame];
+ if ( NSIntersectsRect(scrollSrc, subframe) ||
+ NSIntersectsRect(scrollDst, subframe) ) {
+ TkpShiftButton((NSButton *)subview, delta );
+ }
+ }
+ }
+
+ /* Redisplay the scrolled area. */
+ [view displayRect:scrollDst];
+
+ }
}
-
+
if ( dmgRgn == NULL ) {
- dmgRgn = HIShapeCreateEmpty();
+ dmgRgn = HIShapeCreateEmpty();
}
- //TkMacOSXInvalidateViewRegion(view, dmgRgn);
TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn);
result = HIShapeIsEmpty(dmgRgn) ? 0 : 1;
CFRelease(dmgRgn);
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index d800ae5..4c8ac30 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -293,7 +293,7 @@ InitFont(
[NSNumber numberWithInt:fmPtr->fixed ? 0 : 1],
NSLigatureAttributeName,
[NSNumber numberWithDouble:kern], NSKernAttributeName, nil];
- fontPtr->nsAttributes = TkMacOSXMakeUncollectableAndRetain(nsAttributes);
+ fontPtr->nsAttributes = TkMacOSXMakeUncollectableAndRetain(nsAttributes);
#undef nCh
}
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 813acce..249d5cf 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -24,6 +24,7 @@
#ifndef _TKMAC
#include "tkMacOSX.h"
+#import <Cocoa/Cocoa.h>
#endif
/*
@@ -196,7 +197,7 @@ MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
int y, int width, int height);
MODULE_SCOPE void TkpRetainRegion(TkRegion r);
MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
-
+MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
/*
* Include the stubbed internal platform-specific API.
*/
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 83ad47a..a8e9f2f 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -684,6 +684,9 @@ TkpConfigureMenuEntry(
NSArray *itemArray = [submenu itemArray];
for (NSMenuItem *item in itemArray) {
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++;
}
@@ -754,10 +757,18 @@ TkpPostMenu(
* to be posted. */
int y) /* The global y-coordinate */
{
- NSWindow *win = [NSApp keyWindow];
- if (!win) {
+
+
+ /* Get the object that holds this Tk Window.*/
+ Tk_Window root;
+ root = Tk_MainWindow(interp);
+ if (root == NULL) {
return TCL_ERROR;
}
+
+ Drawable d = Tk_WindowId(root);
+ NSView *rootview = TkMacOSXGetRootControl(d);
+ NSWindow *win = [rootview window];
inPostMenu = 1;
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index c716ab7..0f2a74a 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -207,7 +207,7 @@ TkRectInRegion(
if ( TkMacOSXIsEmptyRegion(region) ) {
return RectangleOut;
}
- else {
+ else {
const CGRect r = CGRectMake(x, y, width, height);
return HIShapeIntersectsRect((HIShapeRef) region, &r) ?
RectanglePart : RectangleOut;
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 9ba7100..1a71746 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.
@@ -818,7 +818,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().
*
@@ -913,7 +913,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);
@@ -1071,7 +1071,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.)
*
*----------------------------------------------------------------------
@@ -1090,6 +1090,10 @@ TkMacOSXInvalClipRgns(
* be marked.
*/
+#ifdef TK_MAC_DEBUG_CLIP_REGIONS
+ TkMacOSXDbgMsg("%s", winPtr->pathName);
+#endif
+
if (!macWin || macWin->flags & TK_CLIP_INVALID) {
return;
}
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index c0f7c7c..b16b582 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -884,7 +884,7 @@ XGetImage(
bitmap_rep = BitmapRepFromDrawableRect(d, x, y,width, height);
if ( bitmap_rep == Nil ||
- [bitmap_rep bitmapFormat] != 0 ||
+ [bitmap_rep bitmapFormat] != 0 ||
[bitmap_rep samplesPerPixel] != 4 ||
[bitmap_rep isPlanar] != 0 ) {
TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep");
@@ -894,7 +894,7 @@ XGetImage(
NSSize image_size = NSMakeSize(width, height);
NSImage* ns_image = [[NSImage alloc]initWithSize:image_size];
[ns_image addRepresentation:bitmap_rep];
-
+
/* Assume premultiplied nonplanar data with 4 bytes per pixel and alpha last.*/
if ( [bitmap_rep bitmapFormat] == 0 &&
[bitmap_rep isPlanar ] == 0 &&