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:
ericwa 2010-04-11 00:31:59 +00:00
parent 3da9ac45b7
commit f2fd7b10c2
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> 2010-04-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/linking.m * Source/linking.m

View file

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

View file

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