Correct bug with cursor hiding/unhiding.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2274 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
netcrep 1997-03-29 20:03:45 +00:00
parent 9c427901ba
commit ae6fb8a2f9
2 changed files with 45 additions and 35 deletions

View file

@ -1,3 +1,11 @@
Sat Mar 29 11:58:31 1997 GNUstep Development <gnustep@net-community.com>
* Source/NSApplication.m (NullEvent): Rename global variable to
be unique and conform to GNUstep standards.
(nextEventMatchingMatchingMask:untilDate:inMode:dequeue:): Don't
unhide the cursor for null events.
(peekEventMatchingMatchingMask:untilDate:inMode:dequeue:): Likewise.
Fri Mar 28 14:15:52 1997 GNUstep Development <gnustep@net-community.com>
* Release version 0.2.0

View file

@ -45,7 +45,7 @@
//
// The global application instance
extern id NSApp;
NSEvent *NullEvent = NULL;
NSEvent *gnustep_gui_null_event = nil;
static BOOL gnustep_gui_app_is_in_dealloc;
// Global strings
@ -165,7 +165,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
// No current event
current_event = nil;
// The NULL event
NullEvent = [[NSEvent alloc] init];
gnustep_gui_null_event = [[NSEvent alloc] init];
//
// We are the end of the responder chain
@ -269,7 +269,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
{
e = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil
inMode:nil dequeue:YES];
if (e)
if (e != gnustep_gui_null_event)
[self sendEvent: e];
else
{
@ -296,7 +296,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
- (void)sendEvent:(NSEvent *)theEvent
{
// Don't send the null event
if (theEvent == NullEvent)
if (theEvent == gnustep_gui_null_event)
{
NSDebugLog(@"Not sending the Null Event\n");
return;
@ -368,7 +368,7 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
if (!theEvent) return NO;
// Don't check the null event
if (theEvent == NullEvent) return NO;
if (theEvent == gnustep_gui_null_event) return NO;
t = [theEvent type];
@ -477,20 +477,22 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
}
// Unhide the cursor if necessary
{
NSEventType type;
// but only if its not a null event
if (e != gnustep_gui_null_event)
{
NSEventType type;
// Only if we should unhide when mouse moves
if ([NSCursor isHiddenUntilMouseMoves])
{
// Make sure the event is a mouse event before unhiding
type = [e type];
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|| (type == NSMouseMoved))
[NSCursor unhide];
}
}
// Only if we should unhide when mouse moves
if ([NSCursor isHiddenUntilMouseMoves])
{
// Make sure the event is a mouse event before unhiding
type = [e type];
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|| (type == NSMouseMoved))
[NSCursor unhide];
}
}
[self setCurrentEvent: e];
return e;
@ -502,7 +504,6 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
dequeue:(BOOL)flag
{
NSEvent *e;
BOOL done;
int i, j;
// If the queue isn't empty then check those messages
@ -536,20 +537,21 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
return nil;
// Unhide the cursor if necessary
{
NSEventType type;
if (e != gnustep_gui_null_event)
{
NSEventType type;
// Only if we should unhide when mouse moves
if ([NSCursor isHiddenUntilMouseMoves])
{
// Make sure the event is a mouse event before unhiding
type = [e type];
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|| (type == NSMouseMoved))
[NSCursor unhide];
}
}
// Only if we should unhide when mouse moves
if ([NSCursor isHiddenUntilMouseMoves])
{
// Make sure the event is a mouse event before unhiding
type = [e type];
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|| (type == NSMouseMoved))
[NSCursor unhide];
}
}
[self setCurrentEvent: e];
return e;
@ -1114,13 +1116,13 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
// Get next event
- (NSEvent *)getNextEvent
{
[event_queue addObject: NullEvent];
return NullEvent;
[event_queue addObject: gnustep_gui_null_event];
return gnustep_gui_null_event;
}
- (NSEvent *)peekNextEvent
{
return NullEvent;
return gnustep_gui_null_event;
}
// handle a non-translated event