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,9 +510,12 @@ NSPoint basePoint;
// //
// Managing the display // Managing the display
// //
- (void)disableFlushWindow { disable_flush_window = YES; } - (void) disableFlushWindow
{
disable_flush_window = YES;
}
- (void)display - (void) display
{ {
visible = YES; visible = YES;
needs_display = NO; // inform first responder needs_display = NO; // inform first responder
@ -524,9 +527,10 @@ NSPoint basePoint;
[[content_view superview] display]; // Draw the window view [[content_view superview] display]; // Draw the window view
[self enableFlushWindow]; // Reenable displaying and [self enableFlushWindow]; // Reenable displaying and
} // flush the window [self flushWindowIfNeeded]; // flush the window
}
- (void)displayIfNeeded - (void) displayIfNeeded
{ {
if (needs_display) if (needs_display)
{ {
@ -539,15 +543,20 @@ NSPoint basePoint;
{ {
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)
{ {
@ -556,11 +565,30 @@ NSPoint basePoint;
} }
} }
- (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,10 +596,17 @@ NSPoint basePoint;
[[NSApplication sharedApplication] setWindowsNeedUpdate: YES]; [[NSApplication sharedApplication] setWindowsNeedUpdate: YES];
} }
- (BOOL)viewsNeedDisplay { return needs_display; } - (BOOL) viewsNeedDisplay
- (void)useOptimizedDrawing:(BOOL)flag { optimize_drawing = flag; } {
return needs_display;
}
- (BOOL)canStoreColor - (void) useOptimizedDrawing: (BOOL)flag
{
optimize_drawing = flag;
}
- (BOOL) canStoreColor
{ {
if (depth_limit > 1) // If the depth is greater if (depth_limit > 1) // If the depth is greater
return YES; // than a single bit return YES; // than a single bit