diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-18 20:06:17 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-18 20:07:55 -0700 |
commit | 5183fea6d38de4bcf657e9c2a983dfd81a2a223f (patch) | |
tree | f8f701aa2da17b5cf8be9f1e7f629561929fdf24 /hw | |
parent | edd3fb784bad893550ee270e0a09f22f99783cf5 (diff) |
XQuartz: Handled sanitization of namespace better
(cherry picked from commit 8cb23d672177da919257c885804cecd18cf9af88)
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xquartz/X11Application.m | 11 | ||||
-rw-r--r-- | hw/xquartz/X11Controller.m | 16 | ||||
-rw-r--r-- | hw/xquartz/applewm.c | 2 | ||||
-rw-r--r-- | hw/xquartz/darwinEvents.c | 2 | ||||
-rw-r--r-- | hw/xquartz/quartz.c | 2 | ||||
-rw-r--r-- | hw/xquartz/quartzAudio.c | 2 | ||||
-rw-r--r-- | hw/xquartz/quartzCocoa.m | 6 | ||||
-rw-r--r-- | hw/xquartz/quartzCommon.h | 12 | ||||
-rw-r--r-- | hw/xquartz/quartzKeyboard.c | 11 | ||||
-rw-r--r-- | hw/xquartz/quartzStartup.c | 2 | ||||
-rw-r--r-- | hw/xquartz/sanitizedCarbon.h | 32 | ||||
-rw-r--r-- | hw/xquartz/sanitizedCocoa.h | 27 | ||||
-rw-r--r-- | hw/xquartz/xpr/xprCursor.c | 2 | ||||
-rw-r--r-- | hw/xquartz/xpr/xprScreen.c | 2 |
14 files changed, 86 insertions, 43 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 6691a2527..fe9bb2508 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -26,22 +26,17 @@ copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. */ -#include <Carbon/Carbon.h> -#include "quartzCommon.h" + +#include "sanitizedCarbon.h" #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#define BOOL X_BOOL -//#undef GetWindowAttributes -//#undef ChangeWindowAttributes -#undef BOOL #include "quartzForeground.h" +#include "quartzCommon.h" #import "X11Application.h" -/* ouch! */ -#define BOOL X_BOOL # include "darwin.h" # include "darwinEvents.h" # include "quartz.h" diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 2fd988661..1f23569e6 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -27,6 +27,8 @@ promote the sale, use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -37,17 +39,13 @@ #import "X11Controller.h" #import "X11Application.h" -#import <Carbon/Carbon.h> -/* ouch! */ -#define BOOL X_BOOL #include "opaque.h" -# include "darwin.h" -# include "quartz.h" -# define _APPLEWM_SERVER_ -# include "X11/extensions/applewm.h" -# include "applewmExt.h" -#undef BOOL +#include "darwin.h" +#include "quartz.h" +#define _APPLEWM_SERVER_ +#include "X11/extensions/applewm.h" +#include "applewmExt.h" #include <stdio.h> #include <unistd.h> diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 072e57ff4..ba86f1045 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -25,6 +25,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index d69e6b744..afa292fb8 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -284,7 +284,7 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in break; case kXquartzSetRootClip: - QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0); + QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0); break; case kXquartzQuit: diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index fb9f13cd3..4d03d02fb 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -28,6 +28,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c index 5dee32f54..d3698d7c9 100644 --- a/hw/xquartz/quartzAudio.c +++ b/hw/xquartz/quartzAudio.c @@ -36,6 +36,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m index d8f9c69e4..aa4b9fb1e 100644 --- a/hw/xquartz/quartzCocoa.m +++ b/hw/xquartz/quartzCocoa.m @@ -32,6 +32,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCocoa.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -40,12 +42,8 @@ #include "inputstr.h" #include "quartzPasteboard.h" -#define BOOL xBOOL #include "darwin.h" -#include <Cocoa/Cocoa.h> -#undef BOOL - #include "pseudoramiX.h" extern void FatalError(const char *, ...); diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h index 40675bc5a..e63c2b760 100644 --- a/hw/xquartz/quartzCommon.h +++ b/hw/xquartz/quartzCommon.h @@ -35,18 +35,6 @@ #ifndef _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 "privates.h" diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index fd0c3ccb3..698f39a22 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -34,6 +34,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -51,15 +53,6 @@ #include <sys/stat.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 "quartzKeyboard.h" diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index 5ac3017e1..233e6e630 100644 --- a/hw/xquartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -27,6 +27,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/hw/xquartz/sanitizedCarbon.h b/hw/xquartz/sanitizedCarbon.h new file mode 100644 index 000000000..cc6ef198d --- /dev/null +++ b/hw/xquartz/sanitizedCarbon.h @@ -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_ */ diff --git a/hw/xquartz/sanitizedCocoa.h b/hw/xquartz/sanitizedCocoa.h new file mode 100644 index 000000000..58de64c1c --- /dev/null +++ b/hw/xquartz/sanitizedCocoa.h @@ -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_ */ diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c index a42c30cdd..76ab75c02 100644 --- a/hw/xquartz/xpr/xprCursor.c +++ b/hw/xquartz/xpr/xprCursor.c @@ -29,6 +29,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 82190463c..f685d4ad1 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -27,6 +27,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif |