* Source/GSStandardWindowDecorationView.m: Correct issue in

initWithFrame🪟 that was causing a crash when the window 
	was closed.
	* Source/NSControl.m: Reinstated fix from Fred Kiefer for 
	mouseDown: simplification and refactoring. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-08-31 04:23:56 +00:00
parent ea619a198f
commit d0bc68ca3a
3 changed files with 39 additions and 50 deletions

View file

@ -732,82 +732,63 @@ static Class actionCellClass;
*/
- (void) mouseDown: (NSEvent *)theEvent
{
NSApplication *theApp = [NSApplication sharedApplication];
BOOL mouseUp = NO, done = NO;
NSEvent *e;
int oldActionMask;
NSPoint location;
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask
| NSMouseMovedMask | NSLeftMouseDraggedMask | NSOtherMouseDraggedMask
| NSRightMouseDraggedMask;
BOOL mouseUp = NO;
// If not enabled ignore mouse clicks
if (![self isEnabled])
return;
// Ignore multiple clicks, if configured to do so
if (_ignoresMultiClick && ([theEvent clickCount] > 1))
{
[super mouseDown: theEvent];
return;
}
if ([_cell isContinuous])
{
oldActionMask = [_cell sendActionOn: NSPeriodicMask];
}
else
{
oldActionMask = [_cell sendActionOn: 0];
}
[_window _captureMouse: self];
e = theEvent;
// loop until mouse goes up
while (!done)
while (1)
{
location = [e locationInWindow];
location = [self convertPoint: location fromView: nil];
// ask the cell to track the mouse only
NSPoint location = [self convertPoint: [theEvent locationInWindow]
fromView: nil];
// ask the cell to track the mouse only,
// if the mouse is within the cell
if ([self mouse: location inRect: _bounds])
{
BOOL done;
[_cell setHighlighted: YES];
[self setNeedsDisplay: YES];
if ([_cell trackMouse: e
inRect: _bounds
ofView: self
untilMouseUp: [[_cell class] prefersTrackingUntilMouseUp]])
done = mouseUp = YES;
else
{
[_cell setHighlighted: NO];
[self setNeedsDisplay: YES];
}
done = [_cell trackMouse: theEvent
inRect: _bounds
ofView: self
untilMouseUp: [[_cell class] prefersTrackingUntilMouseUp]];
[_cell setHighlighted: NO];
[self setNeedsDisplay: YES];
if (done)
break;
}
if (done)
break;
e = [theApp nextEventMatchingMask: event_mask
untilDate: nil
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
if ([e type] == NSLeftMouseUp)
done = YES;
theEvent = [NSApp nextEventMatchingMask: event_mask
untilDate: nil
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
if ([theEvent type] == NSLeftMouseUp)
{
mouseUp = YES;
break;
}
}
[_window _releaseMouse: self];
// Mouse went up inside the control but not inside the cell
if (mouseUp)
{
[_cell setHighlighted: NO];
[self setNeedsDisplay: YES];
[self sendAction: [self action] to: [self target]];
}
[_cell sendActionOn: oldActionMask];
if (mouseUp)
[self sendAction: [self action] to: [self target]];
}
- (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent