Removed all uses of @defs() from -gui, so it now compiles cleanly with the non-fragile ABI. All ivars that must be accessed from other classes are now wrapped in PACKAGE_SCOPE. With clang, this expands to @package, with GCC it expands to @public.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30045 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2010-03-27 00:01:03 +00:00
parent b06fb57e31
commit 14205ea54b
12 changed files with 61 additions and 51 deletions

View file

@ -53,4 +53,10 @@
#endif #endif
#ifdef __clang__
# define PACKAGE_SCOPE @package
#else
# define PACKAGE_SCOPE @public
#endif
#endif /* __AppKitDefines_INCLUDE */ #endif /* __AppKitDefines_INCLUDE */

View file

@ -46,11 +46,13 @@
@interface NSResponder : NSObject <NSCoding> @interface NSResponder : NSObject <NSCoding>
{ {
PACKAGE_SCOPE
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
NSInterfaceStyle _interface_style; NSInterfaceStyle _interface_style;
#else #else
int _interface_style; int _interface_style;
#endif #endif
@protected
NSResponder *_next_responder; NSResponder *_next_responder;
/* /*

View file

@ -104,10 +104,14 @@ typedef enum _NSFocusRingType {
id _matrixFromWindow; id _matrixFromWindow;
NSView* _super_view; NSView* _super_view;
PACKAGE_SCOPE
NSMutableArray *_sub_views; NSMutableArray *_sub_views;
@protected
NSWindow *_window; NSWindow *_window;
PACKAGE_SCOPE
NSMutableArray *_tracking_rects; NSMutableArray *_tracking_rects;
NSMutableArray *_cursor_rects; NSMutableArray *_cursor_rects;
@protected
NSRect _invalidRect; NSRect _invalidRect;
NSRect _visibleRect; NSRect _visibleRect;
int _gstate; int _gstate;

View file

@ -170,7 +170,9 @@ APPKIT_EXPORT NSSize NSTokenSize;
id _firstResponder; id _firstResponder;
id _futureFirstResponder; id _futureFirstResponder;
NSView *_initialFirstResponder; NSView *_initialFirstResponder;
PACKAGE_SCOPE
id _delegate; id _delegate;
@protected
id _fieldEditor; id _fieldEditor;
id _lastView; id _lastView;
id _lastDragView; id _lastDragView;
@ -186,12 +188,16 @@ APPKIT_EXPORT NSSize NSTokenSize;
NSString *_miniaturizedTitle; NSString *_miniaturizedTitle;
NSImage *_miniaturizedImage; NSImage *_miniaturizedImage;
NSString *_windowTitle; NSString *_windowTitle;
PACKAGE_SCOPE
NSPoint _lastPoint; NSPoint _lastPoint;
@protected
NSBackingStoreType _backingType; NSBackingStoreType _backingType;
unsigned _styleMask; unsigned _styleMask;
int _windowLevel; int _windowLevel;
PACKAGE_SCOPE
NSRect _rectNeedingFlush; NSRect _rectNeedingFlush;
NSMutableArray *_rectsBeingDrawn; NSMutableArray *_rectsBeingDrawn;
@protected
unsigned _disableFlushWindow; unsigned _disableFlushWindow;
NSWindowDepth _depthLimit; NSWindowDepth _depthLimit;
@ -205,6 +211,7 @@ APPKIT_EXPORT NSSize NSTokenSize;
NSPoint _cachedImageOrigin; NSPoint _cachedImageOrigin;
NSWindow *_attachedSheet; NSWindow *_attachedSheet;
PACKAGE_SCOPE
struct GSWindowFlagsType { struct GSWindowFlagsType {
unsigned accepts_drag:1; unsigned accepts_drag:1;
unsigned is_one_shot:1; unsigned is_one_shot:1;
@ -246,7 +253,7 @@ APPKIT_EXPORT NSSize NSTokenSize;
unsigned ignores_mouse_events: 1; unsigned ignores_mouse_events: 1;
unsigned preserves_content_during_live_resize: 1; unsigned preserves_content_during_live_resize: 1;
} _f; } _f;
@protected
NSToolbar *_toolbar; NSToolbar *_toolbar;
void *_reserved_1; void *_reserved_1;
} }

View file

@ -31,6 +31,8 @@
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#define EXPOSE_NSKeyedUnarchiver_IVARS
#import <Foundation/NSArchiver.h> #import <Foundation/NSArchiver.h>
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h> #import <Foundation/NSBundle.h>

View file

@ -121,11 +121,13 @@
- (void) _endDisplay; - (void) _endDisplay;
- (void) _timedOut: (NSTimer *)timer; - (void) _timedOut: (NSTimer *)timer;
@end @end
/*
typedef struct NSView_struct typedef struct NSView_struct
{ {
@defs(NSView) @defs(NSView)
} *NSViewPtr; } *NSViewPtr;
*/
typedef NSView* NSViewPtr;
@implementation GSToolTips @implementation GSToolTips

View file

@ -28,6 +28,8 @@
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#define EXPOSE_NSThread_IVARS
#import <Foundation/NSGeometry.h> #import <Foundation/NSGeometry.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <Foundation/NSArray.h> #import <Foundation/NSArray.h>
@ -53,8 +55,6 @@
#import "GNUstepGUI/GSVersion.h" #import "GNUstepGUI/GSVersion.h"
#import "GNUstepGUI/GSDisplayServer.h" #import "GNUstepGUI/GSDisplayServer.h"
typedef struct { @defs(NSThread) } *TInfo;
/* The memory zone where all global objects are allocated from (Contexts /* The memory zone where all global objects are allocated from (Contexts
are also allocated from this zone) */ are also allocated from this zone) */
static NSZone *_globalGSZone = NULL; static NSZone *_globalGSZone = NULL;
@ -97,7 +97,7 @@ NSGraphicsContext *GSCurrentContext(void)
*/ */
NSThread *th = GSCurrentThread(); NSThread *th = GSCurrentThread();
return (NSGraphicsContext*) ((TInfo)th)->_gcontext; return (NSGraphicsContext*) th->_gcontext;
#else #else
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
@ -166,7 +166,7 @@ NSGraphicsContext *GSCurrentContext(void)
*/ */
NSThread *th = GSCurrentThread(); NSThread *th = GSCurrentThread();
ASSIGN(((TInfo)th)->_gcontext, context); ASSIGN(th->_gcontext, context);
#else #else
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];

View file

@ -61,9 +61,12 @@ styleFromString(NSString* str)
/*
typedef struct { typedef struct {
@defs(NSResponder) @defs(NSResponder)
} *accessToResponder; } *accessToResponder;
*/
typedef NSResponder* accessToResponder;
/** /**
<p> <p>

View file

@ -1530,6 +1530,11 @@ static NSMapTable *mimeMap = NULL;
return ok; return ok;
} }
- (BOOL)writeObjects: (NSArray*)objects
{
}
/** /**
* <p>Serialises the data in the supplied property list and writes it to the * <p>Serialises the data in the supplied property list and writes it to the
* pasteboard server using the -setData:forType: method. * pasteboard server using the -setData:forType: method.

View file

@ -1553,15 +1553,10 @@ createRowsForColumn: (int)column
column: (int)column; column: (int)column;
@end @end
struct NSSavePanel_struct
{
@defs (NSSavePanel)
};
static int compareFilenames (id elem1, id elem2, void *context) static int compareFilenames (id elem1, id elem2, void *context)
{ {
/* TODO - use IMP optimization here. */ /* TODO - use IMP optimization here. */
struct NSSavePanel_struct *s = (struct NSSavePanel_struct *)context; NSSavePanel *s = context;
NSSavePanel *self = (NSSavePanel *)context; NSSavePanel *self = (NSSavePanel *)context;
return (int)[s->_delegate panel: self return (int)[s->_delegate panel: self

View file

@ -99,11 +99,6 @@
*/ */
NSView *viewIsPrinting = nil; NSView *viewIsPrinting = nil;
struct NSWindow_struct
{
@defs(NSWindow)
};
/** /**
<unit> <unit>
<heading>NSView</heading> <heading>NSView</heading>
@ -2022,8 +2017,7 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
NSStringFromRect(_frame),_rFlags.flipped_view); NSStringFromRect(_frame),_rFlags.flipped_view);
if (viewIsPrinting == nil) if (viewIsPrinting == nil)
{ {
struct NSWindow_struct *window_t = (struct NSWindow_struct *)_window; [_window->_rectsBeingDrawn addObject: [NSValue valueWithRect: wrect]];
[window_t->_rectsBeingDrawn addObject: [NSValue valueWithRect: wrect]];
} }
/* Make sure we don't modify superview's gstate */ /* Make sure we don't modify superview's gstate */
@ -2155,16 +2149,14 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
if (viewIsPrinting == nil) if (viewIsPrinting == nil)
{ {
NSRect rect; NSRect rect;
struct NSWindow_struct *window_t;
window_t = (struct NSWindow_struct *)_window;
if (flush && !_rFlags.ignores_backing) if (flush && !_rFlags.ignores_backing)
{ {
rect = [[window_t->_rectsBeingDrawn lastObject] rectValue]; rect = [[_window->_rectsBeingDrawn lastObject] rectValue];
window_t->_rectNeedingFlush = _window->_rectNeedingFlush =
NSUnionRect(window_t->_rectNeedingFlush, rect); NSUnionRect(_window->_rectNeedingFlush, rect);
window_t->_f.needs_flush = YES; _window->_f.needs_flush = YES;
} }
[window_t->_rectsBeingDrawn removeLastObject]; [_window->_rectsBeingDrawn removeLastObject];
} }
[ctxt unlockFocusView: self needsFlush: YES ]; [ctxt unlockFocusView: self needsFlush: YES ];
[NSGraphicsContext restoreGraphicsState]; [NSGraphicsContext restoreGraphicsState];
@ -2606,10 +2598,8 @@ convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matrix1,
{ {
// FIXME // FIXME
static NSRect rect; static NSRect rect;
struct NSWindow_struct *window_t;
window_t = (struct NSWindow_struct *)_window; rect = [[_window->_rectsBeingDrawn lastObject] rectValue];
rect = [[window_t->_rectsBeingDrawn lastObject] rectValue];
rect = [self convertRect: rect fromView: nil]; rect = [self convertRect: rect fromView: nil];
if (rects != NULL) if (rects != NULL)
@ -3123,7 +3113,7 @@ Returns YES iff any scrolling was done.
[_cursor_rects getObjects: rects]; [_cursor_rects getObjects: rects];
if (_rFlags.valid_rects != 0) if (_rFlags.valid_rects != 0)
{ {
NSPoint loc = ((struct NSWindow_struct *)_window)->_lastPoint; NSPoint loc = _window->_lastPoint;
unsigned i; unsigned i;
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)

View file

@ -596,12 +596,6 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
*/ */
@implementation NSWindow @implementation NSWindow
typedef struct NSView_struct
{
@defs(NSView)
} *NSViewPtr;
/* /*
* Class variables * Class variables
*/ */
@ -2548,14 +2542,14 @@ discardCursorRectsForView(NSView *theView)
{ {
if (theView != nil) if (theView != nil)
{ {
if (((NSViewPtr)theView)->_rFlags.has_currects) if (theView->_rFlags.has_currects)
{ {
[theView discardCursorRects]; [theView discardCursorRects];
} }
if (((NSViewPtr)theView)->_rFlags.has_subviews) if (theView->_rFlags.has_subviews)
{ {
NSArray *s = ((NSViewPtr)theView)->_sub_views; NSArray *s = theView->_sub_views;
unsigned count = [s count]; unsigned count = [s count];
if (count) if (count)
@ -2585,7 +2579,7 @@ discardCursorRectsForView(NSView *theView)
- (void) invalidateCursorRectsForView: (NSView*)aView - (void) invalidateCursorRectsForView: (NSView*)aView
{ {
if (((NSViewPtr)aView)->_rFlags.valid_rects) if (aView->_rFlags.valid_rects)
{ {
[aView discardCursorRects]; [aView discardCursorRects];
@ -2616,9 +2610,9 @@ resetCursorRectsForView(NSView *theView)
{ {
[theView resetCursorRects]; [theView resetCursorRects];
if (((NSViewPtr)theView)->_rFlags.has_subviews) if (theView->_rFlags.has_subviews)
{ {
NSArray *s = ((NSViewPtr)theView)->_sub_views; NSArray *s = theView->_sub_views;
unsigned count = [s count]; unsigned count = [s count];
if (count) if (count)
@ -3340,9 +3334,9 @@ resetCursorRectsForView(NSView *theView)
- (void) _checkTrackingRectangles: (NSView*)theView - (void) _checkTrackingRectangles: (NSView*)theView
forEvent: (NSEvent*)theEvent forEvent: (NSEvent*)theEvent
{ {
if (((NSViewPtr)theView)->_rFlags.has_trkrects) if (theView->_rFlags.has_trkrects)
{ {
NSArray *tr = ((NSViewPtr)theView)->_tracking_rects; NSArray *tr = theView->_tracking_rects;
unsigned count = [tr count]; unsigned count = [tr count];
/* /*
@ -3433,9 +3427,9 @@ resetCursorRectsForView(NSView *theView)
/* /*
* Check tracking rectangles for the subviews * Check tracking rectangles for the subviews
*/ */
if (((NSViewPtr)theView)->_rFlags.has_subviews) if (theView->_rFlags.has_subviews)
{ {
NSArray *sb = ((NSViewPtr)theView)->_sub_views; NSArray *sb = theView->_sub_views;
unsigned count = [sb count]; unsigned count = [sb count];
if (count > 0) if (count > 0)
@ -3455,9 +3449,9 @@ resetCursorRectsForView(NSView *theView)
- (void) _checkCursorRectangles: (NSView*)theView forEvent: (NSEvent*)theEvent - (void) _checkCursorRectangles: (NSView*)theView forEvent: (NSEvent*)theEvent
{ {
if (((NSViewPtr)theView)->_rFlags.valid_rects) if (theView->_rFlags.valid_rects)
{ {
NSArray *tr = ((NSViewPtr)theView)->_cursor_rects; NSArray *tr = theView->_cursor_rects;
unsigned count = [tr count]; unsigned count = [tr count];
// Loop through cursor rectangles // Loop through cursor rectangles
@ -3523,9 +3517,9 @@ resetCursorRectsForView(NSView *theView)
/* /*
* Check cursor rectangles for the subviews * Check cursor rectangles for the subviews
*/ */
if (((NSViewPtr)theView)->_rFlags.has_subviews) if (theView->_rFlags.has_subviews)
{ {
NSArray *sb = ((NSViewPtr)theView)->_sub_views; NSArray *sb = theView->_sub_views;
unsigned count = [sb count]; unsigned count = [sb count];
if (count > 0) if (count > 0)
@ -4064,7 +4058,7 @@ resetCursorRectsForView(NSView *theView)
while (v != nil) while (v != nil)
{ {
if (((NSViewPtr)v)->_rFlags.has_draginfo != 0 if (v->_rFlags.has_draginfo != 0
&& GSViewAcceptsDrag(v, dragInfo)) && GSViewAcceptsDrag(v, dragInfo))
break; break;
v = [v superview]; v = [v superview];