xserver: Branch 'xorg-server-1.4-apple' - 2 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Fri Apr 18 20:23:30 PDT 2008
hw/xquartz/X11Application.h | 3 +--
hw/xquartz/X11Application.m | 12 +++++-------
hw/xquartz/X11Controller.h | 8 ++++----
hw/xquartz/X11Controller.m | 26 ++++++++++++--------------
hw/xquartz/applewm.c | 2 ++
hw/xquartz/darwinEvents.c | 2 +-
hw/xquartz/quartz.c | 2 ++
hw/xquartz/quartzAudio.c | 2 ++
hw/xquartz/quartzCocoa.m | 6 ++----
hw/xquartz/quartzCommon.h | 11 -----------
hw/xquartz/quartzKeyboard.c | 8 ++------
hw/xquartz/quartzStartup.c | 2 ++
hw/xquartz/sanitizedCarbon.h | 32 ++++++++++++++++++++++++++++++++
hw/xquartz/sanitizedCocoa.h | 27 +++++++++++++++++++++++++++
hw/xquartz/xpr/xprCursor.c | 2 ++
hw/xquartz/xpr/xprScreen.c | 2 ++
16 files changed, 98 insertions(+), 49 deletions(-)
New commits:
commit bc50d41f9d1aec04f0de0478cbd5036f1fe9b81e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Apr 18 20:23:26 2008 -0700
XQuartz: More sanitization of the namespace
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index ea9a6b7..47c605c 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -32,7 +32,6 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
#import "X11Controller.h"
@interface X11Application : NSApplication {
@@ -56,7 +55,7 @@
- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
- (void) prefs_synchronize;
-- (BOOL) x_active;
+- (OSX_BOOL) x_active;
@end
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 00a5ae7..2be5a8c 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -37,7 +37,6 @@
#include "quartzForeground.h"
#import "X11Application.h"
-#include <Carbon/Carbon.h>
# include "darwin.h"
# include "darwinEvents.h"
@@ -45,7 +44,6 @@
# define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h"
# include "micmap.h"
-#undef BOOL
#include <mach/mach.h>
#include <unistd.h>
@@ -159,7 +157,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
[self orderFrontStandardAboutPanelWithOptions: dict];
}
-- (void) activateX:(BOOL)state {
+- (void) activateX:(OSX_BOOL)state {
/* Create a TSM document that supports full Unicode input, and
have it activated while X is active (unless using the old
keymapping files) */
@@ -193,7 +191,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
- (void) sendEvent:(NSEvent *)e {
NSEventType type;
- BOOL for_appkit, for_x;
+ OSX_BOOL for_appkit, for_x;
type = [e type];
@@ -655,7 +653,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
AppleWMCopyToPasteboard);
}
-- (BOOL) x_active {
+- (OSX_BOOL) x_active {
return _x_active;
}
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 8d6a38f..c5994bd 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -32,7 +32,7 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
+#include "sanitizedCocoa.h"
#include "xpr/x-list.h"
@interface X11Controller : NSObject
@@ -67,14 +67,14 @@
int checked_window_item;
x_list *pending_apps;
- BOOL finished_launching;
- BOOL can_quit;
+ OSX_BOOL finished_launching;
+ OSX_BOOL can_quit;
}
- (void) set_window_menu:(NSArray *)list;
- (void) set_window_menu_check:(NSNumber *)n;
- (void) set_apps_menu:(NSArray *)list;
-- (void) set_can_quit:(BOOL)state;
+- (void) set_can_quit:(OSX_BOOL)state;
- (void) server_ready;
- (IBAction) apps_table_show:(id)sender;
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 1f23569..f2dee2c 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -600,7 +600,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
#endif
}
-- (void) set_can_quit:(BOOL)state
+- (void) set_can_quit:(OSX_BOOL)state
{
can_quit = state;
}
@@ -667,7 +667,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
}
-- (BOOL) validateMenuItem:(NSMenuItem *)item
+- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
@@ -739,7 +739,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
pending_apps = NULL;
}
-- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename
{
const char *name = [filename UTF8String];
@@ -752,8 +752,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
return YES;
}
-- (BOOL) applicationShouldHandleReopen:(NSApplication *)app
- hasVisibleWindows:(BOOL)hasVis {
+- (OSX_BOOL) applicationShouldHandleReopen:(NSApplication *)app
+ hasVisibleWindows:(OSX_BOOL)hasVis {
DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
return YES;
}
commit ba074f19eaff8c7fb21a03da6b3d6b914b4f8b5a
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Apr 18 20:16:06 2008 -0700
XQuartz: Handled sanitization of namespace better
(cherry picked from commit 8cb23d672177da919257c885804cecd18cf9af88)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 986771c..00a5ae7 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.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,8 +39,6 @@
#import "X11Application.h"
#include <Carbon/Carbon.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 2fd9886..1f23569 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 c460ec6..f16c6b4 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 d69e6b7..afa292f 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 beee54a..5190326 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 5dee32f..d3698d7 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 d8f9c69..aa4b9fb 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 40c72b3..99bac19 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -35,17 +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>
-#undef Cursor
-#undef WindowPtr
-#undef Picture
#include <X11/Xdefs.h>
// Quartz specific per screen storage structure
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index e8d9968..698f39a 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,12 +53,6 @@
#include <sys/stat.h>
#include "quartzCommon.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*
#include "darwin.h"
#include "quartzKeyboard.h"
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index e25e155..18d0bfa 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 0000000..cc6ef19
--- /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 0000000..58de64c
--- /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 56f7955..df138c7 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 e8b54ad..ccd0aa1 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
More information about the xorg-commit
mailing list