xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/sanitizedCocoa.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Don't #include any of the AppKit, etc stuff directly since it will
3  * pollute the X11 namespace.
4  */
5 
6 #ifndef _XQ_SANITIZED_COCOA_H_
7 #define _XQ_SANITIZED_COCOA_H_
8 
9 // QuickDraw in ApplicationServices has the following conflicts with
10 // the basic X server headers. Use QD_<name> to use the QuickDraw
11 // definition of any of these symbols, or the normal name for the
12 // X11 definition.
13 #define Cursor    QD_Cursor
14 #define WindowPtr QD_WindowPtr
15 #define Picture   QD_Picture
16 #define BOOL      OSX_BOOL
17 #define EventType HIT_EventType
18 
19 #import <Cocoa/Cocoa.h>
20 #import <Foundation/Foundation.h>
21 
22 #undef Cursor
23 #undef WindowPtr
24 #undef Picture
25 #undef BOOL
26 #undef EventType
27 
28 #ifndef __has_feature
29 #define __has_feature(x) 0 // Compatibility with non-clang compilers.
30 #endif
31 
32 #ifndef NS_RETURNS_RETAINED
33 #if __has_feature(attribute_ns_returns_retained)
34 #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
35 #else
36 #define NS_RETURNS_RETAINED
37 #endif
38 #endif
39 
40 #ifndef NS_RETURNS_NOT_RETAINED
41 #if __has_feature(attribute_ns_returns_not_retained)
42 #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
43 #else
44 #define NS_RETURNS_NOT_RETAINED
45 #endif
46 #endif
47 
48 #ifndef CF_RETURNS_RETAINED
49 #if __has_feature(attribute_cf_returns_retained)
50 #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
51 #else
52 #define CF_RETURNS_RETAINED
53 #endif
54 #endif
55 
56 #ifndef CF_RETURNS_NOT_RETAINED
57 #if __has_feature(attribute_cf_returns_not_retained)
58 #define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
59 #else
60 #define CF_RETURNS_NOT_RETAINED
61 #endif
62 #endif
63 
64 #endif  /* _XQ_SANITIZED_COCOA_H_ */
65