mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-28 14:37:04 +00:00
Merge pull request #2456 from didierkorthoudt/Fixed--right-mouse-clic-during-a-drag-operation-problem
Fixed: right mouse clic during a drag operation cancels it
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user