From 9af04949cd4bb74362eb6bbdfb9daaa748ecb047 Mon Sep 17 00:00:00 2001 From: far Date: Fri, 27 Nov 1998 12:17:37 +0000 Subject: [PATCH] * GSContext.m/.h second rewrite and polish of API. * NSView.m displayrect add flushWindow at end. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3339 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 17 +++++++----- Headers/gnustep/gui/GSContext.h | 4 +-- Source/GSContext.m | 47 +++++++++++++++++++++------------ Source/NSView.m | 2 ++ 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99bfa0bb9..6c87851d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,24 +1,29 @@ +Fri Nov 27 1998 Felipe A. Rodriguez + + * GSContext.m/.h second rewrite and polish of API. + * NSView.m displayrect add flushWindow at end. + Thu Nov 26 1998 Felipe A. Rodriguez * NSApplication.m add updateServicesMenu invocation accidently deleted - during merge. Move method from _eventMatchingMask to tail of run - method for performance reasons. + during merge. Move method from _eventMatchingMask to tail of run + method for performance reasons. * Tools/dummy.m add various new dummy functions. * Panels/GNUmakefile make local targets double colon, add local clean to - fix make clean failure. + fix make clean failure. Wed Nov 25 1998 Felipe A. Rodriguez * move DPSOperators.h to XDPS. * move GPS headers into a new backend. * define GSContext.h/GSContext.m as abstract super for all drawing - destinations (eliminates the need for DPS, GPS, DGS at the root of - the AppKit) add appropriate defintion to various classes. + destinations (eliminates the need for DPS, GPS, DGS at the root of + the AppKit) add appropriate defintion to various classes. * NSMatrix.m add abstract backend code from xraw (eliminate backend). * NSSlider.m add abstract backend code from xraw (eliminate backend). * NSSliderCell.m add abstract backend code from xraw (eliminate backend). * NSSplitView.m add abstract backend code from xraw (eliminate backend). - replace private divider highlight method with NSHighlightRect() + replace private divider highlight method with NSHighlightRect() * NSWindow.m add class method to create backend specific window view. * NSTextField.m add abstract backend code from xraw (eliminate backend). * NSForm.m add abstract backend code from xraw (eliminate backend). diff --git a/Headers/gnustep/gui/GSContext.h b/Headers/gnustep/gui/GSContext.h index 98f73664e..fc55186ca 100644 --- a/Headers/gnustep/gui/GSContext.h +++ b/Headers/gnustep/gui/GSContext.h @@ -84,9 +84,6 @@ typedef enum _NSWindowOrderingMode { { NSDictionary *context_info; NSMutableData *context_data; - - // Reserverd for back-end use - void *be_context_reserved; } // @@ -118,6 +115,7 @@ typedef enum _NSWindowOrderingMode { // Destroy the Context // + (void) destroyContext:(GSContext *) context; ++ (void) _destroyContext:(GSContext *) context; // private use only - (void) destroy; @end diff --git a/Source/GSContext.m b/Source/GSContext.m index c9a541c61..11a22e333 100644 --- a/Source/GSContext.m +++ b/Source/GSContext.m @@ -46,9 +46,8 @@ NSZone *_globalGSZone = NULL; // The memory zone where all // // Class variables // -static Class contextConcreteClass; // actual class of GSContext's +static Class _concreteClass; // actual class of GSContext static NSMutableArray *contextList; // list of drawing destinations -static GSContext *_currentGSContext = nil; // the current context @@ -59,7 +58,7 @@ static GSContext *_currentGSContext = nil; // the current context // + (void)initialize { - if (self == (contextConcreteClass = [GSContext class])) + if (self == (_concreteClass = [GSContext class])) { contextList = [[NSMutableArray arrayWithCapacity:2] retain]; NSDebugLog(@"Initialize GSContext class\n"); @@ -67,37 +66,50 @@ static GSContext *_currentGSContext = nil; // the current context } } -+ (void) setConcreteClass: (Class)c { contextConcreteClass = c; } -+ (Class) concreteClass { return contextConcreteClass; } ++ (void) setConcreteClass: (Class)c { _concreteClass = c; } ++ (Class) concreteClass { return _concreteClass; } + allocWithZone: (NSZone*)z { - return NSAllocateObject(contextConcreteClass, 0, z); + return NSAllocateObject(_concreteClass, 0, z); } + contextWithInfo: (NSDictionary *)info; { GSContext *context; - NSAssert(contextConcreteClass, @"Error: No default GSContext is set\n"); - context = [[contextConcreteClass allocWithZone: _globalGSZone] - initWithContextInfo: info]; + NSAssert(_concreteClass, @"Error: No concrete GSContext is set\n"); + context = [[_concreteClass allocWithZone: _globalGSZone] + initWithContextInfo: info]; [context autorelease]; return context; } -+ (GSContext *) currentContext { return _currentGSContext; } ++ (GSContext *) currentContext { return nil;} + (void) setCurrentContext: (GSContext *)context { - _currentGSContext = context; + [self subclassResponsibility:_cmd]; } -+ (void) destroyContext:(GSContext *) context // remove context from the -{ // list so that it gets - [contextList removeObject: context]; // deallocated with the -} // next autorelease pool ++ (void) destroyContext:(GSContext *) context +{ // if concrete class is not + if(_concreteClass != [GSContext class]) // a GSContext invoke it's + [_concreteClass destroyContext: context]; // equivalent method first + else + [self _destroyContext: context]; +} + // private method which ++ (void) _destroyContext:(GSContext *) context // removes context from the +{ // list so that it gets +int top; // deallocated with the + // next autorelease pool + [contextList removeObject: context]; + // if not last context set + if((top = [contextList count]) > 0) // next in list as current + [_concreteClass setCurrentContext:[contextList objectAtIndex:top - 1]]; +} // // Instance methods @@ -110,8 +122,9 @@ GSContext *context; - initWithContextInfo: (NSDictionary *)info { // designated initializer [super init]; // for GSContext class + [contextList addObject: self]; - [GSContext setCurrentContext: self]; + [_concreteClass setCurrentContext: self]; if(info) context_info = [info retain]; @@ -131,7 +144,7 @@ GSContext *context; - (void) destroy // remove self from context { // list so that self gets - [GSContext destroyContext: self]; // deallocated with the + [_concreteClass destroyContext: self]; // deallocated with the } // next autorelease pool - (void) dealloc diff --git a/Source/NSView.m b/Source/NSView.m index a9c5eedb1..1f6bd85b0 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -801,6 +801,8 @@ int i, count; [subview displayRect:intersection]; } } + + [window flushWindow]; } - (void)displayRectIgnoringOpacity:(NSRect)aRect