XQuartz: Handled sanitization of namespace better

(cherry picked from commit 8cb23d672177da919257c885804cecd18cf9af88)
This commit is contained in:
Jeremy Huddleston 2008-04-18 20:06:17 -07:00
parent edd3fb784b
commit 5183fea6d3
15 changed files with 87 additions and 44 deletions

View File

@ -26,22 +26,17 @@
copyright holders shall not be used in advertising or otherwise to copyright holders shall not be used in advertising or otherwise to
promote the sale, use or other dealings in this Software without promote the sale, use or other dealings in this Software without
prior written authorization. */ prior written authorization. */
#include <Carbon/Carbon.h>
#include "quartzCommon.h" #include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#define BOOL X_BOOL
//#undef GetWindowAttributes
//#undef ChangeWindowAttributes
#undef BOOL
#include "quartzForeground.h" #include "quartzForeground.h"
#include "quartzCommon.h"
#import "X11Application.h" #import "X11Application.h"
/* ouch! */
#define BOOL X_BOOL
# include "darwin.h" # include "darwin.h"
# include "darwinEvents.h" # include "darwinEvents.h"
# include "quartz.h" # include "quartz.h"

View File

@ -27,6 +27,8 @@
promote the sale, use or other dealings in this Software without promote the sale, use or other dealings in this Software without
prior written authorization. */ prior written authorization. */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
@ -37,17 +39,13 @@
#import "X11Controller.h" #import "X11Controller.h"
#import "X11Application.h" #import "X11Application.h"
#import <Carbon/Carbon.h>
/* ouch! */
#define BOOL X_BOOL
#include "opaque.h" #include "opaque.h"
# include "darwin.h" #include "darwin.h"
# include "quartz.h" #include "quartz.h"
# define _APPLEWM_SERVER_ #define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h" #include "X11/extensions/applewm.h"
# include "applewmExt.h" #include "applewmExt.h"
#undef BOOL
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>

View File

@ -25,6 +25,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/ **************************************************************************/
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -284,7 +284,7 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
break; break;
case kXquartzSetRootClip: case kXquartzSetRootClip:
QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0); QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0);
break; break;
case kXquartzQuit: case kXquartzQuit:

View File

@ -28,6 +28,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -36,6 +36,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -32,6 +32,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCocoa.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
@ -40,12 +42,8 @@
#include "inputstr.h" #include "inputstr.h"
#include "quartzPasteboard.h" #include "quartzPasteboard.h"
#define BOOL xBOOL
#include "darwin.h" #include "darwin.h"
#include <Cocoa/Cocoa.h>
#undef BOOL
#include "pseudoramiX.h" #include "pseudoramiX.h"
extern void FatalError(const char *, ...); extern void FatalError(const char *, ...);

View File

@ -35,18 +35,6 @@
#ifndef _QUARTZCOMMON_H #ifndef _QUARTZCOMMON_H
#define _QUARTZCOMMON_H #define _QUARTZCOMMON_H
// QuickDraw in ApplicationServices has the following conflicts with
// the basic X server headers. Use QD_<name> to use the QuickDraw
// definition of any of these symbols, or the normal name for the
// X11 definition.
#define Cursor QD_Cursor
#define WindowPtr QD_WindowPtr
#define Picture QD_Picture
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#undef Cursor
#undef WindowPtr
#undef Picture
#include <X11/Xdefs.h> #include <X11/Xdefs.h>
#include "privates.h" #include "privates.h"

View File

@ -34,6 +34,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
@ -51,15 +53,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "quartzCommon.h" #include "quartzCommon.h"
#undef GetWindowAttributes
#undef ChangeWindowAttributes
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
#include <IOKit/hidsystem/event_status_driver.h>
#include <IOKit/hidsystem/ev_keymap.h>
#include <architecture/byte_order.h> // For the NXSwap*
#include "darwin.h" #include "darwin.h"
#include "quartzKeyboard.h" #include "quartzKeyboard.h"

View File

@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -0,0 +1,32 @@
/*
* Don't #include any of the AppKit, etc stuff directly since it will
* pollute the X11 namespace.
*/
#ifndef _XQ_SANITIZED_CARBON_H_
#define _XQ_SANITIZED_CARBON_H_
// QuickDraw in ApplicationServices has the following conflicts with
// the basic X server headers. Use QD_<name> to use the QuickDraw
// definition of any of these symbols, or the normal name for the
// X11 definition.
#define Cursor QD_Cursor
#define WindowPtr QD_WindowPtr
#define Picture QD_Picture
#define BOOL OSX_BOOL
#define EventType HIT_EventType
#include <ApplicationServices/ApplicationServices.h>
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
#include <IOKit/hidsystem/event_status_driver.h>
#include <IOKit/hidsystem/ev_keymap.h>
#include <architecture/byte_order.h> // For the NXSwap*
#undef Cursor
#undef WindowPtr
#undef Picture
#undef BOOL
#undef EventType
#endif /* _XQ_SANITIZED_CARBON_H_ */

View File

@ -0,0 +1,27 @@
/*
* Don't #include any of the AppKit, etc stuff directly since it will
* pollute the X11 namespace.
*/
#ifndef _XQ_SANITIZED_COCOA_H_
#define _XQ_SANITIZED_COCOA_H_
// QuickDraw in ApplicationServices has the following conflicts with
// the basic X server headers. Use QD_<name> to use the QuickDraw
// definition of any of these symbols, or the normal name for the
// X11 definition.
#define Cursor QD_Cursor
#define WindowPtr QD_WindowPtr
#define Picture QD_Picture
#define BOOL OSX_BOOL
#define EventType HIT_EventType
#include <Cocoa/Cocoa.h>
#undef Cursor
#undef WindowPtr
#undef Picture
#undef BOOL
#undef EventType
#endif /* _XQ_SANITIZED_COCOA_H_ */

View File

@ -29,6 +29,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization. * use or other dealings in this Software without prior written authorization.
*/ */
#include "sanitizedCarbon.h"
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif

View File

@ -134,7 +134,7 @@ extern int ChangeWindowAttributes(
/* Quartz support on Mac OS X uses the HIToolbox /* Quartz support on Mac OS X uses the HIToolbox
framework whose GetWindowAttributes function conflicts here. */ framework whose GetWindowAttributes function conflicts here. */
#ifdef __APPLE__ #ifdef __APPLE__
#define GetWindowAttributes(w,c) Darwin_X_GetWindowAttributes(w,c) #define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x)
extern void Darwin_X_GetWindowAttributes( extern void Darwin_X_GetWindowAttributes(
#else #else
extern void GetWindowAttributes( extern void GetWindowAttributes(