Simplified sending keyUp: ... send them to the current first responder

rather than trying to save the original first responder


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12630 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2002-02-21 23:40:39 +00:00
parent 8c2deb359a
commit ab75e773a8

View file

@ -614,7 +614,6 @@ static NSNotificationCenter *nc = nil;
TEST_RELEASE(_windowTitle); TEST_RELEASE(_windowTitle);
TEST_RELEASE(_rectsBeingDrawn); TEST_RELEASE(_rectsBeingDrawn);
TEST_RELEASE(_initialFirstResponder); TEST_RELEASE(_initialFirstResponder);
TEST_RELEASE(_originalResponder);
TEST_RELEASE(_defaultButtonCell); TEST_RELEASE(_defaultButtonCell);
/* /*
@ -2646,7 +2645,7 @@ resetCursorRectsForView(NSView *theView)
type = [theEvent type]; type = [theEvent type];
switch (type) switch (type)
{ {
case NSLeftMouseDown: // Left mouse down case NSLeftMouseDown:
{ {
BOOL wasKey = _f.is_key; BOOL wasKey = _f.is_key;
@ -2685,40 +2684,42 @@ resetCursorRectsForView(NSView *theView)
break; break;
} }
case NSLeftMouseUp: // Left mouse up case NSLeftMouseUp:
v = _firstResponder; /* Send to the view that got the mouse down. */ /* Send to the view that got the mouse down. FIXME - check
that this is actually the correct behaviour. */
v = _firstResponder;
[v mouseUp: theEvent]; [v mouseUp: theEvent];
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSMiddleMouseDown: // Middle mouse down case NSMiddleMouseDown:
v = [_contentView hitTest: [theEvent locationInWindow]]; v = [_contentView hitTest: [theEvent locationInWindow]];
[v middleMouseDown: theEvent]; [v middleMouseDown: theEvent];
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSMiddleMouseUp: // Middle mouse up case NSMiddleMouseUp:
v = [_contentView hitTest: [theEvent locationInWindow]]; v = [_contentView hitTest: [theEvent locationInWindow]];
[v middleMouseUp: theEvent]; [v middleMouseUp: theEvent];
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSRightMouseDown: // Right mouse down case NSRightMouseDown:
v = [_contentView hitTest: [theEvent locationInWindow]]; v = [_contentView hitTest: [theEvent locationInWindow]];
[v rightMouseDown: theEvent]; [v rightMouseDown: theEvent];
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSRightMouseUp: // Right mouse up case NSRightMouseUp:
v = [_contentView hitTest: [theEvent locationInWindow]]; v = [_contentView hitTest: [theEvent locationInWindow]];
[v rightMouseUp: theEvent]; [v rightMouseUp: theEvent];
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSLeftMouseDragged: // Left mouse dragged case NSLeftMouseDragged:
case NSMiddleMouseDragged: // Middle mouse dragged case NSMiddleMouseDragged:
case NSRightMouseDragged: // Right mouse dragged case NSRightMouseDragged:
case NSMouseMoved: // Mouse moved case NSMouseMoved:
switch (type) switch (type)
{ {
case NSLeftMouseDragged: case NSLeftMouseDragged:
@ -2767,32 +2768,22 @@ resetCursorRectsForView(NSView *theView)
_lastPoint = [theEvent locationInWindow]; _lastPoint = [theEvent locationInWindow];
break; break;
case NSMouseEntered: // Mouse entered case NSMouseEntered:
case NSMouseExited: // Mouse exited case NSMouseExited:
break; break;
case NSKeyDown: case NSKeyDown:
/*
* Save the first responder so that the key up goes to it and not a
* possible new first responder.
*/
ASSIGN(_originalResponder, _firstResponder);
[_firstResponder keyDown: theEvent]; [_firstResponder keyDown: theEvent];
break; break;
case NSKeyUp: // Key up case NSKeyUp:
/* [_firstResponder keyUp: theEvent];
* send message to the object that got the key down
*/
if (_originalResponder)
[_originalResponder keyUp: theEvent];
DESTROY(_originalResponder);
break; break;
case NSFlagsChanged: // Flags changed case NSFlagsChanged:
break; break;
case NSCursorUpdate: // Cursor update case NSCursorUpdate:
{ {
GSTrackingRect *r =(GSTrackingRect*)[theEvent userData]; GSTrackingRect *r =(GSTrackingRect*)[theEvent userData];
NSCursor *c = (NSCursor*)[r owner]; NSCursor *c = (NSCursor*)[r owner];
@ -3880,7 +3871,6 @@ resetCursorRectsForView(NSView *theView)
- (void) _initDefaults - (void) _initDefaults
{ {
_firstResponder = self; _firstResponder = self;
_originalResponder = nil;
_initialFirstResponder = nil; _initialFirstResponder = nil;
_selectionDirection = NSDirectSelection; _selectionDirection = NSDirectSelection;
_delegate = nil; _delegate = nil;