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:
David Chisnall 2010-03-27 00:01:03 +00:00
parent 1f6a5b28c2
commit a9ba2e5e77
12 changed files with 61 additions and 51 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -596,12 +596,6 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
*/
@implementation NSWindow
typedef struct NSView_struct
{
@defs(NSView)
} *NSViewPtr;
/*
* Class variables
*/
@ -2548,14 +2542,14 @@ discardCursorRectsForView(NSView *theView)
{
if (theView != nil)
{
if (((NSViewPtr)theView)->_rFlags.has_currects)
if (theView->_rFlags.has_currects)
{
[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];
if (count)
@ -2585,7 +2579,7 @@ discardCursorRectsForView(NSView *theView)
- (void) invalidateCursorRectsForView: (NSView*)aView
{
if (((NSViewPtr)aView)->_rFlags.valid_rects)
if (aView->_rFlags.valid_rects)
{
[aView discardCursorRects];
@ -2616,9 +2610,9 @@ resetCursorRectsForView(NSView *theView)
{
[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];
if (count)
@ -3340,9 +3334,9 @@ resetCursorRectsForView(NSView *theView)
- (void) _checkTrackingRectangles: (NSView*)theView
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];
/*
@ -3433,9 +3427,9 @@ resetCursorRectsForView(NSView *theView)
/*
* 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];
if (count > 0)
@ -3455,9 +3449,9 @@ resetCursorRectsForView(NSView *theView)
- (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];
// Loop through cursor rectangles
@ -3523,9 +3517,9 @@ resetCursorRectsForView(NSView *theView)
/*
* 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];
if (count > 0)
@ -4064,7 +4058,7 @@ resetCursorRectsForView(NSView *theView)
while (v != nil)
{
if (((NSViewPtr)v)->_rFlags.has_draginfo != 0
if (v->_rFlags.has_draginfo != 0
&& GSViewAcceptsDrag(v, dragInfo))
break;
v = [v superview];