Fixed: right mouse clic during a drag operation cancels it

This commit is contained in:
Didier Korthoudt committed 2016-05-22 22:14:05 +02:00
1 parent c8ce2343d7
commit 24313d6709
2 files changed
+15

No files matched your search

+1
View File
@@ -60,6 +60,7 @@ var PrimaryPlatformWindow = NULL;
BOOL _mouseIsDown;
BOOL _mouseDownIsRightClick;
int _firstMouseDownButton;
CGPoint _lastMouseEventLocation;
CPWindow _mouseDownWindow;
CPTimeInterval _lastMouseUp;
@@ -1245,12 +1245,16 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
{
if (_mouseIsDown)
{
if (aDOMEvent.button !== _firstMouseDownButton)
return;
event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseUp : CPLeftMouseUp, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseUp, timestamp, location), 0, nil);
_mouseIsDown = NO;
_lastMouseUp = event;
_mouseDownWindow = nil;
_mouseDownIsRightClick = NO;
_firstMouseDownButton = -1;
}
if (_DOMEventMode)
@@ -1270,6 +1274,16 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
_mouseDownIsRightClick = button == 2 || (CPBrowserIsOperatingSystem(CPMacOperatingSystem) && button == 0 && modifierFlags & CPControlKeyMask);
// If mouse is already down, that means that a second mouse button is pushed. This could interfere in mouse events treatment. Just ignore it.
// BUT we have to track which button will be first released.
if (_mouseIsDown)
{
_mouseDownIsRightClick = !_mouseDownIsRightClick;
return;
}
_firstMouseDownButton = button;
if ((sourceElement.tagName === "INPUT" || sourceElement.tagName === "TEXTAREA") && sourceElement != _DOMFocusElement)
{
if ([CPPlatform supportsDragAndDrop])