xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Apr 18 20:08:04 PDT 2008


 hw/xquartz/X11Application.h     |    1 -
 hw/xquartz/X11Application.m     |   19 ++++++-------------
 hw/xquartz/X11Controller.m      |   16 +++++++---------
 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 ++
 miext/rootless/rootlessWindow.c |    2 +-
 16 files changed, 90 insertions(+), 46 deletions(-)

New commits:
commit 5183fea6d38de4bcf657e9c2a983dfd81a2a223f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Apr 18 20:06:17 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 6691a25..fe9bb25 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 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 072e57f..ba86f10 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 fb9f13c..4d03d02 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 40675bc..e63c2b7 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 fd0c3cc..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,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 5ac3017..233e6e6 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 a42c30c..76ab75c 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 8219046..f685d4a 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
diff --git a/include/window.h b/include/window.h
index ca2e57e..52b3982 100644
--- a/include/window.h
+++ b/include/window.h
@@ -134,7 +134,7 @@ extern int ChangeWindowAttributes(
 /* Quartz support on Mac OS X uses the HIToolbox
    framework whose GetWindowAttributes function conflicts here. */
 #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(
 #else
 extern void GetWindowAttributes(
commit edd3fb784bad893550ee270e0a09f22f99783cf5
Author: Ben Byer <bbyer at bbyer.local>
Date:   Fri Apr 18 17:17:01 2008 -0700

    random flailing
    (cherry picked from commit 7fb9b2dc615a3bd1a3c087438af7a8b88265cfaa)

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index ea9a6b7..9d1ee41 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -31,7 +31,6 @@
 #define X11APPLICATION_H 1
 
 #if __OBJC__
-
 #import <Cocoa/Cocoa.h>
 #import "X11Controller.h"
 
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 31ac563..6691a25 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -26,16 +26,19 @@
  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"
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
+#define BOOL X_BOOL
+//#undef GetWindowAttributes
+//#undef ChangeWindowAttributes
+#undef BOOL
 
-#include "quartzCommon.h"
 #include "quartzForeground.h"
-
 #import "X11Application.h"
-#include <Carbon/Carbon.h>
 
 /* ouch! */
 #define BOOL X_BOOL
@@ -45,8 +48,6 @@
 # define _APPLEWM_SERVER_
 # include "X11/extensions/applewm.h"
 # include "micmap.h"
-#undef BOOL
-
 #include <mach/mach.h>
 #include <unistd.h>
 #include <pthread.h>
@@ -188,10 +189,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 }
 
 - (void) sendEvent:(NSEvent *)e {
-  NSEventType type;
-  BOOL for_appkit, for_x;
-  
-  type = [e type];
  	NSEventType type;
 	BOOL for_appkit, for_x;
 
@@ -242,6 +239,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 							|| [e keyCode] == 53 /*Esc*/)) {
 						swallow_up = 0;
 						for_x = NO;
+					}
 			} else {
 			/* If we saw a key equivalent on the down, don't pass
 	   			the up through to X. */
@@ -641,8 +639,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
     if(darwinDesiredDepth == 8)
         darwinDesiredDepth = -1;
 	
-    enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
-                     default:false];
+//    enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
+//                     default:false];
 }
 
 /* This will end up at the end of the responder chain. */
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index c4bd2d8..40675bc 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -43,6 +43,7 @@
 #define WindowPtr    QD_WindowPtr
 #define Picture      QD_Picture
 #include <ApplicationServices/ApplicationServices.h>
+#include <Carbon/Carbon.h>
 #undef Cursor
 #undef WindowPtr
 #undef Picture
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index e8d9968..fd0c3cc 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -52,6 +52,9 @@
 
 #include "quartzCommon.h"
 
+#undef GetWindowAttributes
+#undef ChangeWindowAttributes
+
 #include <CoreServices/CoreServices.h>
 #include <Carbon/Carbon.h>
 #include <IOKit/hidsystem/event_status_driver.h>
diff --git a/include/window.h b/include/window.h
index 52b3982..ca2e57e 100644
--- a/include/window.h
+++ b/include/window.h
@@ -134,7 +134,7 @@ extern int ChangeWindowAttributes(
 /* Quartz support on Mac OS X uses the HIToolbox
    framework whose GetWindowAttributes function conflicts here. */
 #ifdef __APPLE__
-#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x)
+#define GetWindowAttributes(w,c) Darwin_X_GetWindowAttributes(w,c)
 extern void Darwin_X_GetWindowAttributes(
 #else
 extern void GetWindowAttributes(
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 17fe690..a6002bb 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -1427,7 +1427,7 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
     
     pWin->rootlessUnhittable = FALSE;
     
-    DeleteProperty (pWin, xa_native_window_id ());
+    DeleteProperty (serverClient, pWin, xa_native_window_id ());
 
     if (WINREC(pTopWin) != NULL) {
         /* We're screwed. */


More information about the xorg-commit mailing list