Fix for delivery of rightMouseDragged: and otherMouseDragged: which were not working

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30120 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2010-04-11 00:31:59 +00:00
parent c6866f8c8a
commit fa1db26477
3 changed files with 34 additions and 12 deletions

View file

@ -1,3 +1,13 @@
2010-04-10 Eric Wasylishen <ewasylishen@gmail.com>
* Headers/AppKit/NSWindow.h
* Source/NSWindow.m: Fix delivery of rightMouseDragged: and otherMouseDragged:
messages. These weren't working because right/otherMouseDragged: would be
called on the _lastView ivar, which was only set on mouse down.
I replace the _lastView ivar with _lastLeftMouseDownView, _lastRightMouseDownView,
and _lastOtherMouseDownView. Behaviour now matches OS X as far as I can tell.
2010-04-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/linking.m

View file

@ -175,7 +175,9 @@ PACKAGE_SCOPE
id _delegate;
@protected
id _fieldEditor;
id _lastView;
id _lastLeftMouseDownView;
id _lastRightMouseDownView;
id _lastOtherMouseDownView;
id _lastDragView;
int _lastDragOperationMask;
int _windowNum;

View file

@ -786,7 +786,9 @@ many times.
DESTROY(_defaultButtonCell);
DESTROY(_cachedImage);
DESTROY(_children);
DESTROY(_lastView);
DESTROY(_lastLeftMouseDownView);
DESTROY(_lastRightMouseDownView);
DESTROY(_lastOtherMouseDownView);
DESTROY(_lastDragView);
DESTROY(_screen);
@ -3633,9 +3635,9 @@ resetCursorRectsForView(NSView *theView)
{
v = [_wv hitTest: [theEvent locationInWindow]];
}
if (_lastView)
if (_lastLeftMouseDownView)
{
DESTROY(_lastView);
DESTROY(_lastLeftMouseDownView);
}
// Don't make buttons first responder otherwise they cannot
// send actions to the current first responder.
@ -3658,7 +3660,7 @@ resetCursorRectsForView(NSView *theView)
}
else
{
ASSIGN(_lastView, v);
ASSIGN(_lastLeftMouseDownView, v);
if (toolTipVisible != nil)
{
/* Inform the tooltips system that we have had
@ -3683,8 +3685,8 @@ resetCursorRectsForView(NSView *theView)
}
case NSLeftMouseUp:
v = AUTORELEASE(RETAIN(_lastView));
DESTROY(_lastView);
v = AUTORELEASE(RETAIN(_lastLeftMouseDownView));
DESTROY(_lastLeftMouseDownView);
if (v == nil)
break;
[v mouseUp: theEvent];
@ -3693,24 +3695,32 @@ resetCursorRectsForView(NSView *theView)
case NSOtherMouseDown:
v = [_wv hitTest: [theEvent locationInWindow]];
ASSIGN(_lastOtherMouseDownView, v);
[v otherMouseDown: theEvent];
_lastPoint = [theEvent locationInWindow];
break;
case NSOtherMouseUp:
v = [_wv hitTest: [theEvent locationInWindow]];
v = AUTORELEASE(RETAIN(_lastOtherMouseDownView));
DESTROY(_lastOtherMouseDownView);
if (v == nil)
break;
[v otherMouseUp: theEvent];
_lastPoint = [theEvent locationInWindow];
break;
case NSRightMouseDown:
v = [_wv hitTest: [theEvent locationInWindow]];
ASSIGN(_lastRightMouseDownView, v);
[v rightMouseDown: theEvent];
_lastPoint = [theEvent locationInWindow];
break;
case NSRightMouseUp:
v = [_wv hitTest: [theEvent locationInWindow]];
v = AUTORELEASE(RETAIN(_lastRightMouseDownView));
DESTROY(_lastRightMouseDownView);
if (v == nil)
break;
[v rightMouseUp: theEvent];
_lastPoint = [theEvent locationInWindow];
break;
@ -3722,13 +3732,13 @@ resetCursorRectsForView(NSView *theView)
switch (type)
{
case NSLeftMouseDragged:
[_lastView mouseDragged: theEvent];
[_lastLeftMouseDownView mouseDragged: theEvent];
break;
case NSOtherMouseDragged:
[_lastView otherMouseDragged: theEvent];
[_lastOtherMouseDownView otherMouseDragged: theEvent];
break;
case NSRightMouseDragged:
[_lastView rightMouseDragged: theEvent];
[_lastRightMouseDownView rightMouseDragged: theEvent];
break;
default:
if (_f.accepts_mouse_moved)