Permalink
Browse files

Added a compile-time flag to enable or disable NSViews being clipped …

…by TwUI (mainly for debugging)
  • Loading branch information...
1 parent 2d2daee commit ad2bb979e42d364526a1e4a1e39a1a591920ba20 @jspahrsummers jspahrsummers committed Jul 19, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/UIKit/TUINSView.m
View
@@ -30,6 +30,12 @@
#import "TUITooltipWindow.h"
#import <CoreFoundation/CoreFoundation.h>
+// If enabled, NSViews contained within TUIViewNSViewContainers will be clipped
+// by any TwUI ancestors that enable clipping to bounds.
+//
+// This should really only be disabled for debugging.
+#define ENABLE_NSVIEW_CLIPPING 1
+
static NSComparisonResult compareNSViewOrdering (NSView *viewA, NSView *viewB, void *context) {
TUIViewNSViewContainer *hostA = viewA.hostView;
TUIViewNSViewContainer *hostB = viewB.hostView;
@@ -642,9 +648,12 @@ - (void)setUp {
// set up masking on the AppKit host view, and make ourselves the layout
// manager, so that we'll know when new sublayers are added
- self.appKitHostView.layer.mask = self.maskLayer;
self.appKitHostView.layer.layoutManager = self;
+
+ #if ENABLE_NSVIEW_CLIPPING
+ self.appKitHostView.layer.mask = self.maskLayer;
[self recalculateNSViewClipping];
+ #endif
}
- (void)didAddSubview:(NSView *)view {
@@ -697,6 +706,10 @@ - (void)recalculateNSViewOrdering; {
}
- (void)recalculateNSViewClipping; {
+ #if !ENABLE_NSVIEW_CLIPPING
+ return;
+ #endif
+
CGMutablePathRef path = CGPathCreateMutable();
for (NSView *view in self.appKitHostView.subviews) {

0 comments on commit ad2bb97

Please sign in to comment.