Skip to content
Snippets Groups Projects
Commit 6cd36859 authored by George Nachman's avatar George Nachman
Browse files

Don't assume that the mouseDown preceding a mouseDragged had coordinates that...

Don't assume that the mouseDown preceding a mouseDragged had coordinates that can be compared with the drag. Require two consecutive drag events. Issue 6023.
parent 691b458e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -67,6 +67,8 @@ const NSInteger kPSMStartResizeAnimation = 0;
// drag and drop
NSEvent *_lastMouseDownEvent; // keep this for dragging reference
NSEvent *_lastMiddleMouseDownEvent;
BOOL _haveInitialDragLocation;
NSPoint _initialDragLocation;
BOOL _didDrag;
BOOL _closeClicked;
 
Loading
Loading
@@ -1272,6 +1274,11 @@ const NSInteger kPSMStartResizeAnimation = 0;
if ([self lastMouseDownEvent] == nil) {
return;
}
if (!_haveInitialDragLocation) {
_initialDragLocation = [theEvent locationInWindow];
_haveInitialDragLocation = YES;
return;
}
 
NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
 
Loading
Loading
@@ -1298,7 +1305,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
NSRect cellFrame;
NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil];
NSPoint trackingStartPoint = [self convertPoint:_initialDragLocation fromView:nil];
PSMTabBarCell *cell = [self cellForPoint:trackingStartPoint cellFrame:&cellFrame];
if (cell) {
//check to see if the close button was the target in the clicked cell
Loading
Loading
@@ -1344,6 +1351,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
 
- (void)mouseUp:(NSEvent *)theEvent
{
_haveInitialDragLocation = NO;
if (_resizing) {
_resizing = NO;
[[NSCursor arrowCursor] set];
Loading
Loading
@@ -1515,6 +1523,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
_haveInitialDragLocation = NO;
if ([[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] != NSNotFound ||
[self _delegateAcceptsSender:sender]) {
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation:sender];
Loading
Loading
@@ -1526,6 +1535,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)aPoint operation:(NSDragOperation)operation {
_haveInitialDragLocation = NO;
if (operation != NSDragOperationNone) {
[self removeTabForCell:[[PSMTabDragAssistant sharedDragAssistant] draggedCell]];
[[PSMTabDragAssistant sharedDragAssistant] finishDrag];
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment