xserver: Branch 'xorg-server-1.5-apple' - 8 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Aug 26 20:19:53 PDT 2008


 glx/glxcmds.c                         |    8 ++-
 glx/glxdricommon.c                    |   16 +-----
 glx/glxscreens.h                      |    7 --
 hw/xquartz/X11Application.m           |   85 ++++++++++++++++++----------------
 hw/xquartz/darwinEvents.c             |    2 
 hw/xquartz/mach-startup/bundle-main.c |   27 +++++++++-
 hw/xquartz/quartzKeyboard.c           |    3 -
 7 files changed, 80 insertions(+), 68 deletions(-)

New commits:
commit d6960e00752a91e8ced0a085f8b6c482f15086f1
Merge: 38e59ad... 78f50cd...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Aug 26 20:19:23 2008 -0700

    Merge branch 'server-1.5-branch' into xorg-server-1.5-apple

commit 38e59ad930ae655479c1de6f605b9009072017a7
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Aug 26 19:13:56 2008 -0700

    XQuartz: Use new Xplugin API to determine if a keypress event corresponds to an OS-X hotkey that we should dispatch to Appkit.
    (cherry picked from commit e7658e745f8a3eaf5cec9f54a8a1b7e5a7708e09)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 135fac3..707a67f 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -47,6 +47,8 @@
 #include <mach/mach.h>
 #include <unistd.h>
 
+#include <Xplugin.h>
+
 #define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
 
 #ifndef XSERVER_VERSION
@@ -222,34 +224,40 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
             break;
             
         case NSKeyDown: case NSKeyUp:
-            if(darwinAppKitModMask & [e modifierFlags]) {
-                /* Override to force sending to Appkit */
-                for_x = NO;
-            } else if (_x_active) {
+            
+            if(_x_active) {
                 static int swallow_up;
                 
-                /* No kit window is focused, so send it to X. */
-                for_appkit = NO;
-                if ([e type] == NSKeyDown) {
+                if([e type] == NSKeyDown) {
                     /* Before that though, see if there are any global
                      shortcuts bound to it. */
-                    
-                    if (X11EnableKeyEquivalents
-                        && [[self mainMenu] performKeyEquivalent:e]) {
+
+                    if(darwinAppKitModMask & [e modifierFlags]) {
+                        /* Override to force sending to Appkit */
                         swallow_up = [e keyCode];
                         for_x = NO;
-                    } else if (!quartzEnableRootless
-                               && ([e modifierFlags] & ALL_KEY_MASKS)
-                               == (NSCommandKeyMask | NSAlternateKeyMask)
-                               && ([e keyCode] == 0 /*a*/
-                                   || [e keyCode] == 53 /*Esc*/)) {
-                        swallow_up = 0;
+#if 0
+                    } else if(!quartzEnableRootless
+                              && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
+                              && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
+                        swallow_up = [e keyCode];
                         for_x = NO;
-#ifdef DARWIN_DDX_MISSING
                         DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
 #endif
+                    } else if(X11EnableKeyEquivalents &&
+#if XPLUGIN_VERSION >= 4
+                              xp_is_symbolic_hotkey_event([e eventRef])) {
+#else
+                              [[self mainMenu] performKeyEquivalent:e]) {
+                        for_appkit = NO;
+#endif
+                        swallow_up = [e keyCode];
+                        for_x = NO;
+                    } else {
+                        /* No kit window is focused, so send it to X. */
+                        for_appkit = NO;
                     }
-                } else {
+                } else { /* KeyUp */
                     /* If we saw a key equivalent on the down, don't pass
                      the up through to X. */
                     
@@ -258,7 +266,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         for_x = NO;
                     }
                 }
-            } else {
+            } else { /* !_x_active */
                 for_x = NO;
             }
             break;
commit 6685522abe2ec25818c3529317ea65b666f6297e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Aug 25 22:10:46 2008 -0700

    XQuartz: Made a note to come back to the xinitrc race condition in the 1.5 branch when we move up to it.
    (cherry picked from commit 54a882dcbdccef3f3eb4e6398e13c88185a8986c)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 21a72d9..0eb45d1 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -41,6 +41,8 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#include <sys/time.h>
+
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <servers/bootstrap.h>
@@ -167,10 +169,29 @@ static void accept_fd_handoff(int connected_fd) {
     }
 
 #ifndef XQUARTZ_EXPORTS_LAUNCHD_FD
-    fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
+    /* TODO: Clean up this race better... giving xinitrc time to run... need to wait for 1.5 branch:
+     *
+     * From ajax:
+     * There's already an internal callback chain for setting selection [in 1.5]
+     * ownership.  See the CallSelectionCallback at the bottom of
+     * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
+     * into it.
+     */
 
-    /* TODO: Clean up this race better... givint xinitrc time to run. */
-    sleep(2);
+#if 0
+    struct timeval start, now;
+    gettimeofday(&start, NULL);
+    gettimeofday(&now, NULL);
+    while((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec) < 2000000) {
+        unsigned usec = 3000001 - ((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec));
+        fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup (%u).\n", launchd_fd, usec);
+        usleep(usec);
+        gettimeofday(&now, NULL);
+    }
+#else
+    fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
+    sleep(3);
+#endif
 #endif
 
     fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
commit 46b3a5dfd6fb78cb355456a8c3a79ffa6901f43b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 22 01:12:37 2008 -0700

    XQuartz: Fixed bogus args to debug ErrorF
    (cherry picked from commit f0351c2b80f30ae31f041798b84139141fc3d5a5)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index cb4a214..15953e3 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -148,7 +148,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
     int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
 
     if (keycode == 0) {
-        ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", pressed == KeyPress ? "press" : "release", key, keycode);
+        ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", key);
         return;
     }
 
commit cd59eee24402b6dca0c0bd190701c70b5044e4a6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 22 01:11:33 2008 -0700

    XQuartz: Cleaned up mouse event translation a bit more.
    (cherry picked from commit c286f2a718fdaf6ad10249b59abb20731da8d904)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index b53f733..135fac3 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -895,29 +895,25 @@ static void send_nsevent(NSEvent *e) {
         DarwinUpdateModKeys([e modifierFlags]);
 
 	switch ([e type]) {
-		case NSMouseMoved:        ev_button=0; ev_type=MotionNotify;  goto check_subtype;
-		case NSLeftMouseDown:     ev_button=1; ev_type=ButtonPress;   goto check_subtype;
-		case NSOtherMouseDown:    ev_button=2; ev_type=ButtonPress;   goto check_subtype;
-		case NSRightMouseDown:    ev_button=3; ev_type=ButtonPress;   goto check_subtype;
-		case NSLeftMouseUp:       ev_button=1; ev_type=ButtonRelease; goto check_subtype;
-		case NSOtherMouseUp:      ev_button=2; ev_type=ButtonRelease; goto check_subtype;
-		case NSRightMouseUp:      ev_button=3; ev_type=ButtonRelease; goto check_subtype;
-		case NSLeftMouseDragged:  ev_button=1; ev_type=MotionNotify;  goto check_subtype;
-		case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify;  goto check_subtype;
-		case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify;  goto check_subtype;
-
-        check_subtype:
-			if ([e subtype] != NSTabletPointEventSubtype) 
-                goto handle_mouse;
-			// fall through to get tablet data
-
-		case NSTabletPoint:
-            ev_type  = MotionNotify;
-            pressure = [e pressure];
-			tilt_x   = [e tilt].x;
-			tilt_y   = [e tilt].y; 
-			// fall through to normal mouse handling
+		case NSLeftMouseDown:     ev_button=1; ev_type=ButtonPress;   goto handle_mouse;
+		case NSOtherMouseDown:    ev_button=2; ev_type=ButtonPress;   goto handle_mouse;
+		case NSRightMouseDown:    ev_button=3; ev_type=ButtonPress;   goto handle_mouse;
+		case NSLeftMouseUp:       ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
+		case NSOtherMouseUp:      ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
+		case NSRightMouseUp:      ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
+		case NSLeftMouseDragged:  ev_button=1; ev_type=MotionNotify;  goto handle_mouse;
+		case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify;  goto handle_mouse;
+		case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify;  goto handle_mouse;
+		case NSMouseMoved:        ev_button=0; ev_type=MotionNotify;  goto handle_mouse;
+        case NSTabletPoint:       ev_button=0; ev_type=MotionNotify;  goto handle_mouse;
+
         handle_mouse:
+			if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
+                pressure = [e pressure];
+                tilt_x   = [e tilt].x;
+                tilt_y   = [e tilt].y; 
+            }
+
             DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
                                     pressure, tilt_x, tilt_y);
             break;
commit 7357dc56c4165b101bfc59d047ea0b3b92bf8004
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 22 00:45:12 2008 -0700

    Xquartz: Added missing ev_type for NSTabletPoint event.
    (cherry picked from commit 07548f13947a212dcc020d52fe0ad679255121e2)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index eeffd8c..b53f733 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -912,6 +912,7 @@ static void send_nsevent(NSEvent *e) {
 			// fall through to get tablet data
 
 		case NSTabletPoint:
+            ev_type  = MotionNotify;
             pressure = [e pressure];
 			tilt_x   = [e tilt].x;
 			tilt_y   = [e tilt].y; 
commit 12c534bf144eb514e3c4aaa2e69953f55286ae63
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Aug 20 10:21:23 2008 -0700

    XQuartz: Added more explanation to debug keylayout spew to cut down on report-spam.
    (cherry picked from commit fcdc9f8b5abd724d75f53d48fdadbed9859e9e79)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 629d15d..aebc941 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -1191,7 +1191,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 
 #if !defined(__x86_64__) && !defined(__ppc64__)
     if (chr_data == NULL) {
-        ErrorF("X11.app: Error detected in determining keyboard layout.  Please report this error at http://xquartz.macosforge.org\n");
+        ErrorF("X11.app: Error detected in determining keyboard layout.  If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
         ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
                (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
 
@@ -1205,6 +1205,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 
     if (chr_data == NULL) {
         ErrorF("X11.app: Debug Info: kKLuchrData fallback failed, trying kKLKCHRData.\n");
+        ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n");
         KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
         is_uchr = 0;
         num_keycodes = 128;
commit 78f50cd5758d778a5b01aa607c04919b69a5a47f
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Aug 26 10:58:35 2008 -0400

    Fix driGetConfigAttribIndex unaligned access to GLboolean.
    
    We don't actually send the float mode so just drop it.  Drop a couple of
    other unused or redundant fields from GLXconfig.

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 0831135..95221a7 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -907,7 +907,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 	p = 0;
 	buf[p++] = modes->visualID;
 	buf[p++] = glxConvertToXVisualType( modes->visualType );
-	buf[p++] = modes->rgbMode;
+	buf[p++] = (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE;
 
 	buf[p++] = modes->redBits;
 	buf[p++] = modes->greenBits;
@@ -959,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
     return Success;
 }
 
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (35)
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)
 #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
 /**
  * Send the set of GLXFBConfigs to the client.  There is not currently
@@ -1011,7 +1011,9 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
 	WRITE_PAIR( GLX_FBCONFIG_ID,      modes->fbconfigID );
 	WRITE_PAIR( GLX_X_RENDERABLE,     GL_TRUE );
 
-	WRITE_PAIR( GLX_RGBA,             modes->rgbMode );
+	WRITE_PAIR( GLX_RGBA,
+		    (modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE );
+	WRITE_PAIR( GLX_RENDER_TYPE,      modes->renderType );
 	WRITE_PAIR( GLX_DOUBLEBUFFER,     modes->doubleBufferMode );
 	WRITE_PAIR( GLX_STEREO,           modes->stereoMode );
 
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 3285835..faaa3b7 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -88,7 +88,6 @@ static const struct { unsigned int attrib, offset; } attribMap[] = {
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE,	transparentGreen),
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE,	transparentBlue),
     __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE,	transparentAlpha),
-    __ATTRIB(__DRI_ATTRIB_FLOAT_MODE,			floatMode),
     __ATTRIB(__DRI_ATTRIB_RED_MASK,			redMask),
     __ATTRIB(__DRI_ATTRIB_GREEN_MASK,			greenMask),
     __ATTRIB(__DRI_ATTRIB_BLUE_MASK,			blueMask),
@@ -136,16 +135,11 @@ createModeFromConfig(const __DRIcoreExtension *core,
     while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
 	switch (attrib) {
 	case __DRI_ATTRIB_RENDER_TYPE:
-	    if (value & __DRI_ATTRIB_RGBA_BIT) {
+	    config->config.renderType = 0;
+	    if (value & __DRI_ATTRIB_RGBA_BIT)
 		config->config.renderType |= GLX_RGBA_BIT;
-		config->config.rgbMode = GL_TRUE;
-	    } else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
+	    if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
 		config->config.renderType |= GLX_COLOR_INDEX_BIT;
-		config->config.rgbMode = GL_FALSE;
-	    } else {
-		config->config.renderType = 0;
-		config->config.rgbMode = GL_FALSE;
-	    }
 	    break;
 	case __DRI_ATTRIB_CONFIG_CAVEAT:
 	    if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
@@ -164,10 +158,6 @@ createModeFromConfig(const __DRIcoreExtension *core,
 	    if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
 		config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
 	    break;	
-	case __DRI_ATTRIB_FLOAT_MODE:
-	    config->config.floatMode = (value ? GL_TRUE : GL_FALSE);
-	    break;
-
 	default:
 	    setScalar(&config->config, attrib, value);
 	    break;
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 39d162d..ea47db4 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -58,16 +58,9 @@ void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
 typedef struct __GLXconfig __GLXconfig;
 struct __GLXconfig {
     __GLXconfig *next;
-    GLboolean rgbMode;
-    GLboolean floatMode;
-    GLboolean colorIndexMode;
     GLuint doubleBufferMode;
     GLuint stereoMode;
 
-    GLboolean haveAccumBuffer;
-    GLboolean haveDepthBuffer;
-    GLboolean haveStencilBuffer;
-
     GLint redBits, greenBits, blueBits, alphaBits;	/* bits per comp */
     GLuint redMask, greenMask, blueMask, alphaMask;
     GLint rgbBits;		/* total bits for rgb */


More information about the xorg-commit mailing list