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> Fri Mar 28 14:15:52 1997 GNUstep Development <gnustep@net-community.com>
* Release version 0.2.0 * Release version 0.2.0

View file

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