summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2014-07-28 02:44:57 (GMT)
committerKevin Walzer <kw@codebykevin.com>2014-07-28 02:44:57 (GMT)
commitc5695e766b9c40219e9280af36c65998d30e6eb7 (patch)
tree641ce1d6fc66d418ec040244ff78297e680f97c8 /macosx
parent42ed9ac756fe0fedb878602d401c858c0117ea22 (diff)
downloadtk-c5695e766b9c40219e9280af36c65998d30e6eb7.zip
tk-c5695e766b9c40219e9280af36c65998d30e6eb7.tar.gz
tk-c5695e766b9c40219e9280af36c65998d30e6eb7.tar.bz2
Fine-tune scrolling, especially of text widgets with embedded windows, after removal of private API calls; performance is now better and within acceptable ranges.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDraw.c4
-rw-r--r--macosx/tkMacOSXPrivate.h7
-rw-r--r--macosx/tkMacOSXScrlbr.c20
-rw-r--r--macosx/tkMacOSXSubwindows.c9
-rw-r--r--macosx/tkMacOSXWindowEvent.c170
5 files changed, 1 insertions, 209 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 9ec4e9a..5512669 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1554,10 +1554,6 @@ TkScrollWindow(
}
}
- /* Step 2: Redisplay all subviews */
- for (NSView *subview in [view subviews] ) {
- [subview display];
- }
}
}
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 42287c7..4855635 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -363,12 +363,5 @@ VISIBILITY_HIDDEN
keyEquivalentModifierMask:(NSUInteger)keyEquivalentModifierMask;
@end
-//Remove private API calls here: not necessary for systems >= 10.7
-#if 0
-/* From WebKit/WebKit/mac/WebCoreSupport/WebChromeClient.mm: */
-@interface NSWindow(TKGrowBoxRect)
-- (NSRect)_growBoxRect;
-@end
-#endif
#endif /* _TKMACPRIV */
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index b8c73bd..0b4fa61 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -331,26 +331,6 @@ TkpDisplayScrollbar(
frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset);
frame.origin.y = viewHeight - (frame.origin.y + frame.size.height);
- NSWindow *w = [view window];
-
- //This uses a private API call that is no longer needed on systems >= 10.7.
- #if 0
- if ([w showsResizeIndicator]) {
- NSRect growBox = [view convertRect:[w _growBoxRect] fromView:nil];
-
- if (NSIntersectsRect(growBox, frame)) {
- if (scrollPtr->vertical) {
- CGFloat y = frame.origin.y;
-
- frame.origin.y = growBox.origin.y + growBox.size.height;
- frame.size.height -= frame.origin.y - y;
- } else {
- frame.size.width = growBox.origin.x - frame.origin.x;
- }
- TkMacOSXSetScrollbarGrow(winPtr, true);
- }
- }
- #endif
if (!NSEqualRects(frame, [scroller frame])) {
[scroller setFrame:frame];
}
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index ac055e3..a08c56e 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -741,15 +741,6 @@ TkMacOSXUpdateClipRgn(
} else if (winPtr->wmInfoPtr->attributes &
kWindowResizableAttribute) {
NSWindow *w = TkMacOSXDrawableWindow(winPtr->window);
-
- if (w) {
- // This call to private API not needed on systems >= 10.7
- // bounds = NSRectToCGRect([w _growBoxRect]);
- // bounds.origin.y = [w contentRectForFrameRect:
- // [w frame]].size.height - bounds.size.height -
- // bounds.origin.y;
- // ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds);
- }
}
macWin->aboveVisRgn = HIShapeCreateCopy(rgn);
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index e6e27a4..c458a89 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -764,10 +764,7 @@ Tk_MacOSXIsAppInFront(void)
* Custom content view for Tk NSWindows, containing standard NSView subviews.
* The goal is to emulate X11-style drawing in response to Expose events:
* during the normal AppKit drawing cycle, we supress drawing of all subviews
- * (using a technique adapted from WebKit's WebHTMLView) and instead send
- * Expose events about the subviews that would be redrawn. Tk Expose event
- * handling and drawing handlers then draw the subviews manually via their
- * -displayRectIgnoringOpacity:
+ * and instead send Expose events about the subviews that would be redrawn.
*/
@interface TKContentView(TKWindowEvent)
@@ -806,18 +803,6 @@ ExposeRestrictProc(
NSCompositeSourceOver);
#endif
- NSWindow *w = [self window];
-
- //remove private API calls here: not needed on systems >= 10.7
- #if 0
- if ([self isOpaque] && [w showsResizeIndicator]) {
- NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil];
-
- if ([self needsToDrawRect:bounds]) {
- NSEraseRect(bounds);
- }
- }
- #endif
CGFloat height = [self bounds].size.height;
HIMutableShapeRef drawShape = HIShapeCreateMutable();
@@ -950,159 +935,6 @@ ExposeRestrictProc(
}
@end
-
-/*Remove private/non-documented API calls. This is strongly discouraged by Apple and may lead to breakage in the future.*/
-
-#if 0
-#pragma mark TKContentViewPrivate
-
-/*
- * Technique adapted from WebKit/WebKit/mac/WebView/WebHTMLView.mm to supress
- * normal AppKit subview drawing and make all drawing go through us.
- * Overrides NSView internals.
- */
-
-
-@interface TKContentView(TKContentViewPrivate)
-- (id) initWithFrame: (NSRect) frame;
-- (void) _setAsideSubviews;
-- (void) _restoreSubviews;
-@end
-
-@interface NSView(TKContentViewPrivate)
-- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect
- isVisibleRect: (BOOL) isVisibleRect
- rectIsVisibleRectForView: (NSView *) visibleView
- topView: (BOOL) topView;
-- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus
- visRect: (NSRect) visRect;
-- (void) _recursive: (BOOL) recurse
- displayRectIgnoringOpacity: (NSRect) displayRect
- inContext: (NSGraphicsContext *) context topView: (BOOL) topView;
-- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect;
-- (BOOL) _drawRectIfEmpty;
-- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip;
-- (void) _setDrawsOwnDescendants: (BOOL) drawsOwnDescendants;
-@end
-
-@implementation TKContentView(TKContentViewPrivate)
-
-- (id) initWithFrame: (NSRect) frame
-{
- self = [super initWithFrame:frame];
- if (self) {
- _savedSubviews = nil;
- _subviewsSetAside = NO;
- [self _setDrawsOwnDescendants:YES];
- }
- return self;
-}
-
-- (void) _setAsideSubviews
-{
-#ifdef TK_MAC_DEBUG
- if (_subviewsSetAside || _savedSubviews) {
- Tcl_Panic("TKContentView _setAsideSubviews called incorrectly");
- }
-#endif
- _savedSubviews = _subviews;
- _subviews = nil;
- _subviewsSetAside = YES;
-}
-
-- (void) _restoreSubviews
-{
-#ifdef TK_MAC_DEBUG
- if (!_subviewsSetAside || _subviews) {
- Tcl_Panic("TKContentView _restoreSubviews called incorrectly");
- }
-#endif
- _subviews = _savedSubviews;
- _savedSubviews = nil;
- _subviewsSetAside = NO;
-}
-
-- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect
- isVisibleRect: (BOOL) isVisibleRect
- rectIsVisibleRectForView: (NSView *) visibleView
- topView: (BOOL) topView
-{
- [self _setAsideSubviews];
- [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect
- isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView
- topView:topView];
- [self _restoreSubviews];
-}
-
-- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus
- visRect: (NSRect) visRect
-{
- BOOL needToSetAsideSubviews = !_subviewsSetAside;
-
- if (needToSetAsideSubviews) {
- [self _setAsideSubviews];
- }
- [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus
- visRect:visRect];
- if (needToSetAsideSubviews) {
- [self _restoreSubviews];
- }
-}
-
-- (void) _recursive: (BOOL) recurse
- displayRectIgnoringOpacity: (NSRect) displayRect
- inContext: (NSGraphicsContext *) context topView: (BOOL) topView
-{
- [self _setAsideSubviews];
- [super _recursive:recurse
- displayRectIgnoringOpacity:displayRect inContext:context
- topView:topView];
- [self _restoreSubviews];
-}
-
-- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect
-{
- BOOL needToSetAsideSubviews = !_subviewsSetAside;
-
- if (needToSetAsideSubviews) {
- [self _setAsideSubviews];
- }
- [super _lightWeightRecursiveDisplayInRect:visRect];
- if (needToSetAsideSubviews) {
- [self _restoreSubviews];
- }
-}
-
-- (BOOL) _drawRectIfEmpty
-{
- /*
- * Our -drawRect manages subview drawing directly, so it needs to be called
- * even if the area to be redrawn is completely obscured by subviews.
- */
-
- return YES;
-}
-
-- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip
-{
-#ifdef TK_MAC_DEBUG_DRAWING
- TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd,
- NSStringFromRect(inRect));
-#endif
- BOOL subviewsWereSetAside = _subviewsSetAside;
-
- if (subviewsWereSetAside) {
- [self _restoreSubviews];
- }
- [super _drawRect:inRect clip:clip];
- if (subviewsWereSetAside) {
- [self _setAsideSubviews];
- }
-}
-
-@end
-#endif
-
/*