Minor tidyup for window flushing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3695 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-02-12 17:00:59 +00:00
parent 5af19c7b13
commit eddafd66d5
3 changed files with 84 additions and 44 deletions

View file

@ -1,3 +1,8 @@
Fri Feb 12 16:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: Improve window flushing
* Source/NSWindow.m: ditto
Fri Feb 12 13:37:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk> Fri Feb 12 13:37:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSCell.m: Fixes to draw text using NSText (by Benhur) * Source/NSCell.m: Fixes to draw text using NSText (by Benhur)

View file

@ -1042,6 +1042,7 @@ BOOL changedSize = NO;
} }
} }
needs_display = stillNeedsDisplay; needs_display = stillNeedsDisplay;
[window flushWindow];
} }
} }
@ -1099,8 +1100,6 @@ BOOL changedSize = NO;
} }
} }
[window flushWindow];
/* /*
* If the rect we displayed contains the invalidRect * If the rect we displayed contains the invalidRect
* for the view then we can empty invalidRect. * for the view then we can empty invalidRect.
@ -1115,6 +1114,7 @@ BOOL changedSize = NO;
stillNeedsDisplay = YES; stillNeedsDisplay = YES;
} }
needs_display = stillNeedsDisplay; needs_display = stillNeedsDisplay;
[window flushWindow];
} }
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect

View file

@ -510,57 +510,85 @@ NSPoint basePoint;
// //
// Managing the display // Managing the display
// //
- (void)disableFlushWindow { disable_flush_window = YES; } - (void) disableFlushWindow
- (void)display
{ {
visible = YES; disable_flush_window = 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 - (void) display
[[content_view superview] display]; // Draw the window view
[self enableFlushWindow]; // Reenable displaying and
} // flush the window
- (void)displayIfNeeded
{ {
if (needs_display) visible = YES;
{ needs_display = NO; // inform first responder
[[content_view superview] displayIfNeeded]; // of it's status so it can
needs_display = NO; [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 - (void) update
{ {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if (is_autodisplay && needs_display) // if autodisplay is /*
{ // enabled and window * if autodisplay is enabled and window display
[self displayIfNeeded]; // display */
if (is_autodisplay && needs_display)
{
[self disableFlushWindow];
[self displayIfNeeded];
[self enableFlushWindow];
[self flushWindowIfNeeded]; [self flushWindowIfNeeded];
} }
[nc postNotificationName: NSWindowDidUpdateNotification object: self]; [nc postNotificationName: NSWindowDidUpdateNotification object: self];
} }
- (void)flushWindowIfNeeded - (void) flushWindowIfNeeded
{ {
if (!disable_flush_window && needs_flush) if (!disable_flush_window && needs_flush)
{ {
needs_flush = NO; needs_flush = NO;
[self flushWindow]; [self flushWindow];
} }
} }
- (void)flushWindow {} // implemented in back end - (void) flushWindow
- (void)enableFlushWindow { disable_flush_window = NO; } {
- (BOOL)isAutodisplay { return is_autodisplay; } // implemented in back end
- (BOOL)isFlushWindowDisabled { return disable_flush_window; } }
- (void)setAutodisplay:(BOOL)flag { is_autodisplay = flag; }
- (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 - (void) setViewsNeedDisplay: (BOOL)flag
{ {
@ -568,15 +596,22 @@ NSPoint basePoint;
[[NSApplication sharedApplication] setWindowsNeedUpdate: YES]; [[NSApplication sharedApplication] setWindowsNeedUpdate: YES];
} }
- (BOOL)viewsNeedDisplay { return needs_display; } - (BOOL) viewsNeedDisplay
- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; }
- (BOOL)canStoreColor
{ {
if (depth_limit > 1) // If the depth is greater return needs_display;
return YES; // than a single bit }
else
return NO; - (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];} - (NSScreen *)deepestScreen { return [NSScreen deepestScreen];}