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