From 9df20632e803773bcb4958b14c7a4c801671f95b Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 28 Jun 2002 08:05:49 +0000 Subject: [PATCH] Flushing fix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13990 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Source/NSWindow.m | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c0c95875..7b1097f40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-06-28 Richard Frith-Macdonald + + * Source/NSWindow.m: ([-flushWindow]) don't flush context for + non-retained windows unless flushing is enabled. Actually I'm + not sure about this ... according to the documentation this + method should never flush non-retained windows anyway. + Thu Jun 27 11:49:57 2002 Nicola Pero * Source/NSTextField.m ([-textDidEndEditing:]): Set _text_object diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 6924db5d1..05e5d75eb 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -1771,22 +1771,35 @@ static NSNotificationCenter *nc = nil; } } +/** + * Flush all drawing in the windows buffer to the screen unless the window + * is not buffered or flushing is not enabled. + */ - (void) flushWindow { - int i; - NSGraphicsContext* context = GSCurrentContext(); + int i; - // do nothing if backing is not buffered - if (_backingType == NSBackingStoreNonretained) + /* + * If flushWindow is called while flush is disabled + * mark self as needing a flush, then return + */ + if (_disableFlushWindow) { - [context flushGraphics]; + _f.needs_flush = YES; return; } - if (_disableFlushWindow) // if flushWindow is called - { // while flush is disabled - _f.needs_flush = YES; // mark self as needing a - return; // flush, then return + /* + * Just flush graphics if backing is not buffered. + * The documentation actually says that this is wrong ... the method + * should do nothing when the backingType is NSBackingStoreNonretained + */ + if (_backingType == NSBackingStoreNonretained) + { + NSGraphicsContext *context = GSCurrentContext(); + + [context flushGraphics]; + return; } /* Check for special case of flushing while we are lock focused. @@ -1807,12 +1820,14 @@ static NSNotificationCenter *nc = nil; while (i-- > 0) { _rectNeedingFlush = NSUnionRect(_rectNeedingFlush, - [[_rectsBeingDrawn objectAtIndex: i] rectValue]); + [[_rectsBeingDrawn objectAtIndex: i] rectValue]); } - if (_windowNum) - [GSServerForWindow(self) flushwindowrect: _rectNeedingFlush - : _windowNum]; + if (_windowNum > 0) + { + [GSServerForWindow(self) flushwindowrect: _rectNeedingFlush + : _windowNum]; + } _f.needs_flush = NO; _rectNeedingFlush = NSZeroRect; }