From 0a20f77b0862696a3a93634eec0c106042f634e5 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sat, 13 Jun 2015 21:06:17 +0200 Subject: [PATCH 1/4] FIXED: In CPView, the transformation matrix was set at each drawing pass, even if the matrix was the identity matrix. Now we check if the highDPI ratio is == 1 and skip the setTransform call in this case. --- AppKit/CPView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 36ed408bb..bf90801d4 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -2594,7 +2594,7 @@ setBoundsOrigin: } #if PLATFORM(DOM) - if (_needToSetTransformMatrix) + if (_needToSetTransformMatrix && _highDPIRatio !== 1) [_graphicsContext graphicsPort].setTransform(_highDPIRatio, 0, 0 , _highDPIRatio, 0, 0); #endif From 3fcc37e0869685771bf6c819b9e974a1899ef106 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 22 Sep 2015 14:33:14 -0700 Subject: [PATCH 2/4] Fixed: CPTabView did not accept first mouse event Previously, the CPTabView did not react with the first mouse event (for instance when a CPTabView was in a not focused window). Now it does as in cocoa. To do that, the CPTavView override the method acceptsFirstMouse. Previously, the tabView had a CPBox, it now has a _CPTabViewBox. This new box reacts differently than the CPBox for the method hitTests. It now returns nil when the click was performed on the segmentedControl of the CPTabView, previously this same click would be handle byt the CPBox. --- AppKit/CPTabView.j | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTabView.j b/AppKit/CPTabView.j index baefde563..a99ee9c9d 100644 --- a/AppKit/CPTabView.j +++ b/AppKit/CPTabView.j @@ -34,6 +34,8 @@ CPNoTabsBezelBorder = 4; //Displays no tabs and has a bezeled border. CPNoTabsLineBorder = 5; //Has no tabs and displays a line border. CPNoTabsNoBorder = 6; //Displays no tabs and no border. +@class _CPTabViewBox + var CPTabViewDidSelectTabViewItemSelector = 1 << 1, CPTabViewShouldSelectTabViewItemSelector = 1 << 2, CPTabViewWillSelectTabViewItemSelector = 1 << 3, @@ -64,7 +66,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1, CPArray _items; CPSegmentedControl _tabs; - CPBox _box; + _CPTabViewBox _box; CPNumber _selectedIndex; @@ -98,7 +100,8 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1, var height = [_tabs valueForThemeAttribute:@"min-size"].height; [_tabs setFrameSize:CGSizeMake(0, height)]; - _box = [[CPBox alloc] initWithFrame:[self bounds]]; + _box = [[_CPTabViewBox alloc] initWithFrame:[self bounds]]; + [_box setTabView:self]; [self setBackgroundColor:[CPColor colorWithCalibratedWhite:0.95 alpha:1.0]]; [self addSubview:_box]; @@ -496,6 +499,18 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1, [self selectFirstTabViewItem:self]; } + +#pragma mark - +#pragma mark Override + +/*! + Enabled controls accept first mouse by default. +*/ +- (BOOL)acceptsFirstMouse:(CPEvent)anEvent +{ + return YES; +} + @end var CPTabViewItemsKey = "CPTabViewItemsKey", @@ -571,3 +586,26 @@ var CPTabViewItemsKey = "CPTabViewItemsKey", } @end + +@implementation _CPTabViewBox : CPBox +{ + CPTabView _tabView @accessors(property=tabView); +} + + +#pragma mark - +#pragma mark Override + +- (CPView)hitTest:(CGPoint)aPoint +{ + // Here we check if we have clicked on the segmentedControl of the tabView or not + // If YES, the CPBox should not handle the click + var segmentIndex = [_tabView._tabs testSegment:[_tabView._tabs convertPoint:aPoint fromView:[self superview]]]; + + if (segmentIndex != CPNotFound) + return nil; + + return [super hitTest:aPoint]; +} + +@end \ No newline at end of file From 7a0b2c958b2d94d9e3c83f4cfa6c38cace75d68f Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 22 Sep 2015 15:01:19 -0700 Subject: [PATCH 3/4] Fixed: crash with CPRuleEditor when dragging the first row Previously, cappuccinos crashed when dragging to the top the first row of a CPRuleEditor. --- AppKit/CPRuleEditor/CPRuleEditor.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index 404c5546e..141e06d63 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -2121,7 +2121,7 @@ TODO: implement return; var point = [self convertPoint:[event locationInWindow] fromView:nil], - view = [_slices objectAtIndex:FLOOR(point.y / _sliceHeight)]; + view = [_slices objectAtIndex:FLOOR(MAX(0, point.y) / _sliceHeight)]; if ([self _dragShouldBeginFromMouseDown:view]) [self _performDragForSlice:view withEvent:event]; From 4ac63950adeba3196c649a46706bac3cbc47bdc2 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 22 Sep 2015 15:58:53 -0700 Subject: [PATCH 4/4] Fixed: toolTip does not work on a external window Previously, the toolTip created for an external window where shown on the primary platform window. We now display it on the desired platformWindow. --- AppKit/_CPToolTip.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index 6268f8ab4..296293d02 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -176,6 +176,8 @@ var _CPToolTipHeight = 24.0, _toolTipWindow = aWindow; _constrainsToUsableScreen = NO; + [self setPlatformWindow:[_toolTipWindow platformWindow]]; + textFrameSize.height += 4; _content = [CPTextField labelWithTitle:aString]; @@ -193,6 +195,7 @@ var _CPToolTipHeight = 24.0, [self setAlphaValue:0.9]; [_windowView setNeedsDisplay:YES]; + } return self;