diff --git a/ChangeLog b/ChangeLog index 9ceca79ea..9e88657e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Feb 12 16:20:00 1999 Richard Frith-Macdonald + + * Source/NSView.m: Improve window flushing + * Source/NSWindow.m: ditto + Fri Feb 12 13:37:00 1999 Richard Frith-Macdonald * Source/NSCell.m: Fixes to draw text using NSText (by Benhur) diff --git a/Source/NSView.m b/Source/NSView.m index 4e6b29165..1ac1bf8da 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -1042,6 +1042,7 @@ BOOL changedSize = NO; } } needs_display = stillNeedsDisplay; + [window flushWindow]; } } @@ -1099,8 +1100,6 @@ BOOL changedSize = NO; } } - [window flushWindow]; - /* * If the rect we displayed contains the invalidRect * for the view then we can empty invalidRect. @@ -1115,6 +1114,7 @@ BOOL changedSize = NO; stillNeedsDisplay = YES; } needs_display = stillNeedsDisplay; + [window flushWindow]; } - (void)drawRect:(NSRect)rect diff --git a/Source/NSWindow.m b/Source/NSWindow.m index d9027220d..bf3562b8c 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -510,57 +510,85 @@ NSPoint basePoint; // // Managing the display // -- (void)disableFlushWindow { disable_flush_window = YES; } - -- (void)display +- (void) disableFlushWindow { - visible = YES; - needs_display = NO; // inform first responder - // of it's status so it can - [first_responder becomeFirstResponder]; // set the focus to itself + disable_flush_window = YES; +} - [self disableFlushWindow]; // tmp disable display - - [[content_view superview] display]; // Draw the window view - - [self enableFlushWindow]; // Reenable displaying and -} // flush the window - -- (void)displayIfNeeded +- (void) display { - if (needs_display) - { - [[content_view superview] displayIfNeeded]; - needs_display = NO; - } + visible = YES; + needs_display = NO; // inform first responder + // of it's status so it can + [first_responder becomeFirstResponder]; // set the focus to itself + + [self disableFlushWindow]; // tmp disable display + + [[content_view superview] display]; // Draw the window view + + [self enableFlushWindow]; // Reenable displaying and + [self flushWindowIfNeeded]; // flush the window +} + +- (void) displayIfNeeded +{ + if (needs_display) + { + [[content_view superview] displayIfNeeded]; + needs_display = NO; + } } - (void) update { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - if (is_autodisplay && needs_display) // if autodisplay is - { // enabled and window - [self displayIfNeeded]; // display + /* + * if autodisplay is enabled and window display + */ + if (is_autodisplay && needs_display) + { + [self disableFlushWindow]; + [self displayIfNeeded]; + [self enableFlushWindow]; [self flushWindowIfNeeded]; } [nc postNotificationName: NSWindowDidUpdateNotification object: self]; } -- (void)flushWindowIfNeeded +- (void) flushWindowIfNeeded { - if (!disable_flush_window && needs_flush) - { - needs_flush = NO; - [self flushWindow]; - } + if (!disable_flush_window && needs_flush) + { + needs_flush = NO; + [self flushWindow]; + } } -- (void)flushWindow {} // implemented in back end -- (void)enableFlushWindow { disable_flush_window = NO; } -- (BOOL)isAutodisplay { return is_autodisplay; } -- (BOOL)isFlushWindowDisabled { return disable_flush_window; } -- (void)setAutodisplay:(BOOL)flag { is_autodisplay = flag; } +- (void) flushWindow +{ + // implemented in back end +} + +- (void) enableFlushWindow +{ + disable_flush_window = NO; +} + +- (BOOL) isAutodisplay +{ + return is_autodisplay; +} + +- (BOOL) isFlushWindowDisabled +{ + return disable_flush_window; +} + +- (void) setAutodisplay: (BOOL)flag +{ + is_autodisplay = flag; +} - (void) setViewsNeedDisplay: (BOOL)flag { @@ -568,15 +596,22 @@ NSPoint basePoint; [[NSApplication sharedApplication] setWindowsNeedUpdate: YES]; } -- (BOOL)viewsNeedDisplay { return needs_display; } -- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; } - -- (BOOL)canStoreColor +- (BOOL) viewsNeedDisplay { - if (depth_limit > 1) // If the depth is greater - return YES; // than a single bit - else - return NO; + return needs_display; +} + +- (void) useOptimizedDrawing: (BOOL)flag +{ + optimize_drawing = flag; +} + +- (BOOL) canStoreColor +{ + if (depth_limit > 1) // If the depth is greater + return YES; // than a single bit + else + return NO; } - (NSScreen *)deepestScreen { return [NSScreen deepestScreen];}