summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2014-08-04 21:14:32 (GMT)
committerKevin Walzer <kw@codebykevin.com>2014-08-04 21:14:32 (GMT)
commitd24f33826b17128cb08fe53907f591fff8a0b3ee (patch)
tree943791fbf59c98a23a387b8661bd163865d1c0a7
parent3b16bf978b446c5eb9dd0d0769ec26e1b89c6cc3 (diff)
downloadtk-d24f33826b17128cb08fe53907f591fff8a0b3ee.zip
tk-d24f33826b17128cb08fe53907f591fff8a0b3ee.tar.gz
tk-d24f33826b17128cb08fe53907f591fff8a0b3ee.tar.bz2
Further refinement of Mac OS X scrolling; thanks to Marc Culler for an additional patch.
-rw-r--r--macosx/tkMacOSXDraw.c46
-rw-r--r--macosx/tkMacOSXSubwindows.c14
2 files changed, 14 insertions, 46 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 6eef09d..40400c2 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1460,12 +1460,12 @@ XMaxRequestSize(
* a damage region.
*
* Results:
- * Returns 0 if the scroll genereated no additional damage.
+ * Returns 0 if the scroll generated no additional damage.
* Otherwise, sets the region that needs to be repainted after
* scrolling and returns 1.
*
* Side effects:
- * Scrolls the bits in the window.
+ * Scrolls the rectangle in the window.
*
*----------------------------------------------------------------------
*/
@@ -1518,51 +1518,15 @@ 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
- * 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);
- }
- }
-
}
}
+
+
if ( dmgRgn == NULL ) {
dmgRgn = HIShapeCreateEmpty();
}
- //TkMacOSXInvalidateViewRegion(view, dmgRgn);
+
TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn);
result = HIShapeIsEmpty(dmgRgn) ? 0 : 1;
CFRelease(dmgRgn);
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 9ba7100..e4af406 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.
@@ -677,7 +677,7 @@ TkMacOSXUpdateClipRgn(
macWin = winPtr->privatePtr;
if (macWin && macWin->flags & TK_CLIP_INVALID) {
TkWindow *win2Ptr;
-
+
#ifdef TK_MAC_DEBUG_CLIP_REGIONS
TkMacOSXDbgMsg("%s", winPtr->pathName);
#endif
@@ -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;
}