Temporary rollback of change to -[NSControl mouseDown:] until it can be determined why it is causing some applications to crash.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23284 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2006-08-13 17:06:57 +00:00
parent 9552bd2696
commit 3e19866ecf
2 changed files with 54 additions and 30 deletions

View file

@ -1,3 +1,8 @@
2006-08-13 13:05-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSControl.m: Rolling back previous change to mouseDown:
until it can be determined why it is causing some apps to crash.
2006-08-12 18:37-EDT Gregory John Casamento <greg_casamento@yahoo.com> 2006-08-12 18:37-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added * Headers/Additions/GNUstepGUI/GSNibCompatibility.h: Added

View file

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