diff --git a/ChangeLog b/ChangeLog index 79a41e189..fb0159114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Mar 27 09:43:02 1997 GNUstep Development + + * Headers/gnustep/gui/NSApplication.h (-peekNextEvent): New method. + (-peekEventMatchingMask:untilDate:inMode:dequeue:): New method. + * Source/NSApplication.m (-peekNextEvent): New method. + (-peekEventMatchingMask:untilDate:inMode:dequeue:): New method. + * Source/NSControl.m (-setAlignment:): Display if needed. + Thu Mar 20 10:40:51 1997 GNUstep Development * Source/NSControl.m: Call displayIfNeeded after setting the diff --git a/Headers/gnustep/gui/NSApplication.h b/Headers/gnustep/gui/NSApplication.h index fa2aa307d..c52768b43 100644 --- a/Headers/gnustep/gui/NSApplication.h +++ b/Headers/gnustep/gui/NSApplication.h @@ -132,6 +132,12 @@ extern NSString *NSEventTrackingRunLoopMode; dequeue:(BOOL)flag; - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag; +// xxx Not part of OpenStep, should be removed someday +- (NSEvent *)peekEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration + inMode:(NSString *)mode + dequeue:(BOOL)flag; + // // Sending action messages // @@ -266,6 +272,7 @@ extern NSString *NSEventTrackingRunLoopMode; // Get next event - (NSEvent *)getNextEvent; +- (NSEvent *)peekNextEvent; // handle a non-translated event - (void)handleNullEvent; diff --git a/Source/NSApplication.m b/Source/NSApplication.m index afab5cba4..cd1ee5acb 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -496,6 +496,65 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate"; return e; } +- (NSEvent *)peekEventMatchingMask:(unsigned int)mask + untilDate:(NSDate *)expiration + inMode:(NSString *)mode + dequeue:(BOOL)flag +{ + NSEvent *e; + BOOL done; + int i, j; + + // If the queue isn't empty then check those messages + if ([event_queue count]) + { + j = [event_queue count]; + for (i = j-1;i >= 0; --i) + { + e = [event_queue objectAtIndex: i]; + if ([self event: e matchMask: mask]) + { + [event_queue removeObjectAtIndex: i]; + [self setCurrentEvent: e]; + return e; + } + } + } + + // Not in queue so peek for event + e = [self peekNextEvent]; + + // Check mask + if ([self event: e matchMask: mask]) + { + if (e) + { + [event_queue removeObject: e]; + } + } + else + return nil; + + // Unhide the cursor if necessary + { + 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]; + } + } + + [self setCurrentEvent: e]; + return e; +} + - (void)postEvent:(NSEvent *)event atStart:(BOOL)flag { if (flag) @@ -1059,6 +1118,11 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate"; return NullEvent; } +- (NSEvent *)peekNextEvent +{ + return NullEvent; +} + // handle a non-translated event - (void)handleNullEvent {} diff --git a/Source/NSControl.m b/Source/NSControl.m index 9d3a40605..e95a544e6 100644 --- a/Source/NSControl.m +++ b/Source/NSControl.m @@ -260,7 +260,11 @@ NSString *NSControlTextDidChangeNotification = @"NSControlTextDidChangeNotificat - (void)setAlignment:(NSTextAlignment)mode { - if (cell) [cell setAlignment:mode]; + if (cell) + { + [cell setAlignment:mode]; + [self displayIfNeeded]; + } } - (void)setFont:(NSFont *)fontObject