xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Nov 29 02:23:57 PST 2007


 hw/darwin/darwin.c                         |    8 -
 hw/darwin/darwin.h                         |    4 
 hw/darwin/darwinKeyboard.c                 |  135 +++++++++--------------------
 hw/darwin/darwinXinput.c                   |    4 
 hw/darwin/quartz/X11Application.m          |    7 -
 hw/darwin/quartz/X11Controller.m           |    4 
 hw/darwin/quartz/applewm.c                 |    2 
 hw/darwin/quartz/cr/XView.m                |    3 
 hw/darwin/quartz/cr/crAppleWM.m            |    2 
 hw/darwin/quartz/cr/crFrame.m              |    2 
 hw/darwin/quartz/cr/crScreen.m             |    2 
 hw/darwin/quartz/fullscreen/fullscreen.c   |    2 
 hw/darwin/quartz/fullscreen/quartzCursor.c |    2 
 hw/darwin/quartz/pseudoramiX.c             |    5 -
 hw/darwin/quartz/quartz.c                  |    2 
 hw/darwin/quartz/quartzAudio.c             |    2 
 hw/darwin/quartz/quartzCocoa.m             |    2 
 hw/darwin/quartz/quartzCursor.c            |    2 
 hw/darwin/quartz/quartzKeyboard.c          |    2 
 hw/darwin/quartz/quartzPasteboard.c        |    2 
 hw/darwin/quartz/quartzStartup.c           |   11 ++
 hw/darwin/quartz/xpr/Makefile.am           |    1 
 hw/darwin/quartz/xpr/appledri.c            |    2 
 hw/darwin/quartz/xpr/dri.c                 |    2 
 hw/darwin/quartz/xpr/x-hash.c              |    2 
 hw/darwin/quartz/xpr/x-hook.c              |    2 
 hw/darwin/quartz/xpr/x-list.c              |    2 
 hw/darwin/quartz/xpr/xprAppleWM.c          |    2 
 hw/darwin/quartz/xpr/xprCursor.c           |    2 
 hw/darwin/quartz/xpr/xprFrame.c            |    2 
 hw/darwin/quartz/xpr/xprScreen.c           |    2 
 31 files changed, 119 insertions(+), 105 deletions(-)

New commits:
commit 8a079be0dd0f2ce37868988cde4ac8895522b088
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Thu Nov 29 02:19:22 2007 -0800

    Darwin: #ifdefs around dix-config.h include and NDEBUG/assert.h workaround.
    (cherry picked from commit d2b768890f0878ae4e3fec8f7219e82b79256133)

diff --git a/hw/darwin/darwin.c b/hw/darwin/darwin.c
index 87edd9a..b46b768 100644
--- a/hw/darwin/darwin.c
+++ b/hw/darwin/darwin.c
@@ -29,7 +29,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include <X11/X.h>
 #include <X11/Xproto.h>
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index 4f11847..d7d2af4 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -27,9 +27,6 @@
 #ifndef _DARWIN_H
 #define _DARWIN_H
 
-//#include "dix-config.h" // This crashes us for some reason...
-#define SHAPE
-
 #include <IOKit/IOTypes.h>
 #include "inputstr.h"
 #include "scrnintstr.h"
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index b51e2da..7f7b7c7 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -56,9 +56,13 @@
 ===========================================================================
 */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 // Define this to get a diagnostic output to stderr which is helpful
 // in determining how the X server is interpreting the Darwin keymap.
-#define DUMP_DARWIN_KEYMAP
+// #define DUMP_DARWIN_KEYMAP
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -69,7 +73,15 @@
 #include <architecture/byte_order.h>  // For the NXSwap*
 #include "darwin.h"
 #include "darwinKeyboard.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
 #include <assert.h>
+#define NDEBUG 1
+#else
+#include <assert.h>
+#endif
+
 #define AltMask         Mod1Mask
 #define MetaMask        Mod2Mask
 #define FunctionMask    Mod3Mask
diff --git a/hw/darwin/darwinXinput.c b/hw/darwin/darwinXinput.c
index 260d72a..ee456a4 100644
--- a/hw/darwin/darwinXinput.c
+++ b/hw/darwin/darwinXinput.c
@@ -52,6 +52,10 @@ SOFTWARE.
 
 ********************************************************/
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #define	 NEED_EVENTS
 #include <X11/X.h>
 #include <X11/Xproto.h>
diff --git a/hw/darwin/quartz/X11Application.m b/hw/darwin/quartz/X11Application.m
index a43d536..514bc49 100644
--- a/hw/darwin/quartz/X11Application.m
+++ b/hw/darwin/quartz/X11Application.m
@@ -27,6 +27,10 @@
  promote the sale, use or other dealings in this Software without
  prior written authorization. */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include "quartzCommon.h"
 
 #import "X11Application.h"
diff --git a/hw/darwin/quartz/X11Controller.m b/hw/darwin/quartz/X11Controller.m
index 6929566..0f64e45 100644
--- a/hw/darwin/quartz/X11Controller.m
+++ b/hw/darwin/quartz/X11Controller.m
@@ -27,6 +27,10 @@
    promote the sale, use or other dealings in this Software without
    prior written authorization. */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
 
 #include "quartzCommon.h"
diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c
index 20d1b4f..72dca28 100644
--- a/hw/darwin/quartz/applewm.c
+++ b/hw/darwin/quartz/applewm.c
@@ -25,7 +25,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 
diff --git a/hw/darwin/quartz/cr/XView.m b/hw/darwin/quartz/cr/XView.m
index 8379f94..130b15f 100644
--- a/hw/darwin/quartz/cr/XView.m
+++ b/hw/darwin/quartz/cr/XView.m
@@ -30,10 +30,13 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #import "XView.h"
 
+
 @implementation XView
 
 - (BOOL)isFlipped
diff --git a/hw/darwin/quartz/cr/crAppleWM.m b/hw/darwin/quartz/cr/crAppleWM.m
index a0259c3..246f521 100644
--- a/hw/darwin/quartz/cr/crAppleWM.m
+++ b/hw/darwin/quartz/cr/crAppleWM.m
@@ -26,7 +26,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "quartz/cr/cr.h"
diff --git a/hw/darwin/quartz/cr/crFrame.m b/hw/darwin/quartz/cr/crFrame.m
index 79697fb..86c75d2 100644
--- a/hw/darwin/quartz/cr/crFrame.m
+++ b/hw/darwin/quartz/cr/crFrame.m
@@ -27,7 +27,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "quartz/cr/cr.h"
diff --git a/hw/darwin/quartz/cr/crScreen.m b/hw/darwin/quartz/cr/crScreen.m
index 504e7b3..cc82afb 100644
--- a/hw/darwin/quartz/cr/crScreen.m
+++ b/hw/darwin/quartz/cr/crScreen.m
@@ -27,7 +27,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "quartz/cr/cr.h"
diff --git a/hw/darwin/quartz/fullscreen/fullscreen.c b/hw/darwin/quartz/fullscreen/fullscreen.c
index 2021ea2..c4a049f 100644
--- a/hw/darwin/quartz/fullscreen/fullscreen.c
+++ b/hw/darwin/quartz/fullscreen/fullscreen.c
@@ -26,7 +26,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "darwin.h"
diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.c b/hw/darwin/quartz/fullscreen/quartzCursor.c
index 5247781..3ffa1c3 100644
--- a/hw/darwin/quartz/fullscreen/quartzCursor.c
+++ b/hw/darwin/quartz/fullscreen/quartzCursor.c
@@ -28,7 +28,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "quartz/quartzCursor.h"
diff --git a/hw/darwin/quartz/pseudoramiX.c b/hw/darwin/quartz/pseudoramiX.c
index 787601b..b19c605 100644
--- a/hw/darwin/quartz/pseudoramiX.c
+++ b/hw/darwin/quartz/pseudoramiX.c
@@ -33,10 +33,11 @@ dealings in this Software without prior written authorization from Digital
 Equipment Corporation.
 ******************************************************************/
 
-#include "pseudoramiX.h"
-
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
+#include "pseudoramiX.h"
 #include "extnsionst.h"
 #include "dixstruct.h"
 #include "window.h"
diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c
index c95880c..2483d12 100644
--- a/hw/darwin/quartz/quartz.c
+++ b/hw/darwin/quartz/quartz.c
@@ -28,7 +28,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 #include "quartz.h"
diff --git a/hw/darwin/quartz/quartzAudio.c b/hw/darwin/quartz/quartzAudio.c
index 8a337da..1eb099b 100644
--- a/hw/darwin/quartz/quartzAudio.c
+++ b/hw/darwin/quartz/quartzAudio.c
@@ -36,7 +36,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 #include "quartzAudio.h"
diff --git a/hw/darwin/quartz/quartzCocoa.m b/hw/darwin/quartz/quartzCocoa.m
index 48cadc6..0086c5c 100644
--- a/hw/darwin/quartz/quartzCocoa.m
+++ b/hw/darwin/quartz/quartzCocoa.m
@@ -32,7 +32,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 
diff --git a/hw/darwin/quartz/quartzCursor.c b/hw/darwin/quartz/quartzCursor.c
index 15f5553..6e86acb 100644
--- a/hw/darwin/quartz/quartzCursor.c
+++ b/hw/darwin/quartz/quartzCursor.c
@@ -28,7 +28,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 #include "quartzCursor.h"
diff --git a/hw/darwin/quartz/quartzKeyboard.c b/hw/darwin/quartz/quartzKeyboard.c
index 49c5bfd..b87249f 100644
--- a/hw/darwin/quartz/quartzKeyboard.c
+++ b/hw/darwin/quartz/quartzKeyboard.c
@@ -31,7 +31,9 @@
    prior written authorization.
 */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzCommon.h"
 
diff --git a/hw/darwin/quartz/quartzPasteboard.c b/hw/darwin/quartz/quartzPasteboard.c
index 2130197..0cecff5 100644
--- a/hw/darwin/quartz/quartzPasteboard.c
+++ b/hw/darwin/quartz/quartzPasteboard.c
@@ -30,7 +30,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartzPasteboard.h"
 
diff --git a/hw/darwin/quartz/quartzStartup.c b/hw/darwin/quartz/quartzStartup.c
index 6f45949..e20c16b 100644
--- a/hw/darwin/quartz/quartzStartup.c
+++ b/hw/darwin/quartz/quartzStartup.c
@@ -27,6 +27,10 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
 #include <fcntl.h>
 #include <unistd.h>
 #include <CoreFoundation/CoreFoundation.h>
@@ -35,7 +39,14 @@
 #include "quartz.h"
 #include "opaque.h"
 #include "micmap.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#include <assert.h>
+#define NDEBUG 1
+#else
 #include <assert.h>
+#endif
 
 char **envpGlobal;      // argcGlobal and argvGlobal
                         // are from dix/globals.c
diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am
index 8f482f1..8980ad7 100644
--- a/hw/darwin/quartz/xpr/Makefile.am
+++ b/hw/darwin/quartz/xpr/Makefile.am
@@ -1,7 +1,6 @@
 noinst_LIBRARIES = libxpr.a
 AM_CFLAGS =  $(XSERVER_CFLAGS) $(DIX_CFLAGS)
 AM_CPPFLAGS = \
-	   -DHAVE_XORG_CONFIG_H \
 	   -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
 	   -I$(top_srcdir)/miext \
 	   -I$(top_srcdir)/miext/rootless \
diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c
index 45d1a7e..95a4439 100644
--- a/hw/darwin/quartz/xpr/appledri.c
+++ b/hw/darwin/quartz/xpr/appledri.c
@@ -35,7 +35,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #define NEED_REPLIES
 #define NEED_EVENTS
diff --git a/hw/darwin/quartz/xpr/dri.c b/hw/darwin/quartz/xpr/dri.c
index 4ade249..e5591ab 100644
--- a/hw/darwin/quartz/xpr/dri.c
+++ b/hw/darwin/quartz/xpr/dri.c
@@ -34,7 +34,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #ifdef XFree86LOADER
 #include "xf86.h"
diff --git a/hw/darwin/quartz/xpr/x-hash.c b/hw/darwin/quartz/xpr/x-hash.c
index d24e05c..55d28ba 100644
--- a/hw/darwin/quartz/xpr/x-hash.c
+++ b/hw/darwin/quartz/xpr/x-hash.c
@@ -27,7 +27,9 @@
    promote the sale, use or other dealings in this Software without
    prior written authorization. */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "x-hash.h"
 #include "x-list.h"
diff --git a/hw/darwin/quartz/xpr/x-hook.c b/hw/darwin/quartz/xpr/x-hook.c
index e38d0ed..bb873bb 100644
--- a/hw/darwin/quartz/xpr/x-hook.c
+++ b/hw/darwin/quartz/xpr/x-hook.c
@@ -27,7 +27,9 @@
    promote the sale, use or other dealings in this Software without
    prior written authorization. */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "x-hook.h"
 #include <stdlib.h>
diff --git a/hw/darwin/quartz/xpr/x-list.c b/hw/darwin/quartz/xpr/x-list.c
index 356bb79..3596dd3 100644
--- a/hw/darwin/quartz/xpr/x-list.c
+++ b/hw/darwin/quartz/xpr/x-list.c
@@ -27,7 +27,9 @@
    promote the sale, use or other dealings in this Software without
    prior written authorization. */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "x-list.h"
 #include <stdlib.h>
diff --git a/hw/darwin/quartz/xpr/xprAppleWM.c b/hw/darwin/quartz/xpr/xprAppleWM.c
index f639b55..5539c51 100644
--- a/hw/darwin/quartz/xpr/xprAppleWM.c
+++ b/hw/darwin/quartz/xpr/xprAppleWM.c
@@ -27,7 +27,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "xpr.h"
 #include "quartz/applewmExt.h"
diff --git a/hw/darwin/quartz/xpr/xprCursor.c b/hw/darwin/quartz/xpr/xprCursor.c
index 9892bcd..160b5d9 100644
--- a/hw/darwin/quartz/xpr/xprCursor.c
+++ b/hw/darwin/quartz/xpr/xprCursor.c
@@ -29,7 +29,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "xpr.h"
diff --git a/hw/darwin/quartz/xpr/xprFrame.c b/hw/darwin/quartz/xpr/xprFrame.c
index ddb6d2d..1b0ba91 100644
--- a/hw/darwin/quartz/xpr/xprFrame.c
+++ b/hw/darwin/quartz/xpr/xprFrame.c
@@ -27,7 +27,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "xpr.h"
 #include "rootlessCommon.h"
diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c
index b5f382e..28ed159 100644
--- a/hw/darwin/quartz/xpr/xprScreen.c
+++ b/hw/darwin/quartz/xpr/xprScreen.c
@@ -27,7 +27,9 @@
  * use or other dealings in this Software without prior written authorization.
  */
 
+#ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
+#endif
 
 #include "quartz/quartzCommon.h"
 #include "quartz/quartz.h"
commit 38397560612424b5b348f34c1a0bea8c47a574be
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Wed Nov 28 23:07:41 2007 -0800

    Darwin: Removed support for darwinSwapAltMeta
    (cherry picked from commit 3d153c8fa40986d194b7701f5eafa0080e32399a)

diff --git a/hw/darwin/darwin.c b/hw/darwin/darwin.c
index b08770c..87edd9a 100644
--- a/hw/darwin/darwin.c
+++ b/hw/darwin/darwin.c
@@ -100,7 +100,6 @@ int                     darwinDesiredDepth = -1;
 int                     darwinDesiredRefresh = -1;
 char                    *darwinKeymapFile = "USA.keymapping";
 int                     darwinSyncKeymap = FALSE;
-int                     darwinSwapAltMeta = FALSE;
 
 // modifier masks for faking mouse buttons
 int                     darwinFakeMouse2Mask = NX_ALTERNATEMASK;
@@ -766,11 +765,6 @@ int ddxProcessArgument( int argc, char *argv[], int i )
         return 2;
     }
 
-    if ( !strcmp( argv[i], "-swapAltMeta" ) ) {
-        darwinSwapAltMeta = 1;
-        return 1;
-    }
-
     if ( !strcmp( argv[i], "-keymap" ) ) {
         if ( i == argc-1 ) {
             FatalError( "-keymap must be followed by a filename\n" );
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index e2e4829..4f11847 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -27,7 +27,7 @@
 #ifndef _DARWIN_H
 #define _DARWIN_H
 
-// #include "dix-config.h" // This makes us crash for some reason...
+//#include "dix-config.h" // This crashes us for some reason...
 #define SHAPE
 
 #include <IOKit/IOTypes.h>
@@ -113,7 +113,6 @@ extern int              darwinMouseAccelChange;
 extern int              darwinFakeButtons;
 extern int              darwinFakeMouse2Mask;
 extern int              darwinFakeMouse3Mask;
-extern int              darwinSwapAltMeta;
 extern char            *darwinKeymapFile;
 extern int              darwinSyncKeymap;
 extern unsigned int     darwinDesiredWidth, darwinDesiredHeight;
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index 47acb65..b51e2da 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -58,10 +58,7 @@
 
 // Define this to get a diagnostic output to stderr which is helpful
 // in determining how the X server is interpreting the Darwin keymap.
-#undef DUMP_DARWIN_KEYMAP
-
-/* Define this to use Alt for Mode_switch. */
-//#define ALT_IS_MODE_SWITCH 1
+#define DUMP_DARWIN_KEYMAP
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -77,9 +74,6 @@
 #define MetaMask        Mod2Mask
 #define FunctionMask    Mod3Mask
 
-// FIXME: It would be nice to support some of the extra keys in XF86keysym.h,
-// at least the volume controls that now ship on every Apple keyboard.
-
 #define UK(a)           NoSymbol    // unknown symbol
 
 static KeySym const next_to_x[256] = {
@@ -513,7 +507,7 @@ Bool DarwinParseNXKeyMapping(
                         break;
                     case NX_MODIFIERKEY_ALTERNATE:
                         info->keyMap[keyCode * GLYPHS_PER_KEY] =
-                                (left ? XK_Mode_switch : XK_Alt_R);
+                                (left ? XK_Alt_L : XK_Alt_R);
                         break;
                     case NX_MODIFIERKEY_COMMAND:
                         info->keyMap[keyCode * GLYPHS_PER_KEY] =
@@ -638,27 +632,23 @@ Bool DarwinParseNXKeyMapping(
     return TRUE;
 }
 
-
 /*
  * DarwinBuildModifierMaps
  *      Use the keyMap field of keyboard info structure to populate
  *      the modMap and modifierKeycodes fields.
  */
 static void
-DarwinBuildModifierMaps(
-    darwinKeyboardInfo *info)
-{
+DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
     int i;
     KeySym *k;
 
     memset(info->modMap, NoSymbol, sizeof(info->modMap));
     memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
 
-    for (i = 0; i < NUM_KEYCODES; i++)
-    {
+    for (i = 0; i < NUM_KEYCODES; i++) {
         k = info->keyMap + i * GLYPHS_PER_KEY;
 
-        switch (k[0]) {
+        switch (*k) {
             case XK_Shift_L:
                 info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
                 info->modMap[MIN_KEYCODE + i] = ShiftMask;
@@ -728,34 +718,9 @@ DarwinBuildModifierMaps(
                 info->modMap[MIN_KEYCODE + i] = Mod3Mask;
                 break;
         }
-
-        if (darwinSwapAltMeta)
-        {
-            switch (k[0])
-            {
-            case XK_Alt_L:
-                k[0] = XK_Meta_L;
-                break;
-            case XK_Alt_R:
-                k[0] = XK_Meta_R;
-                break;
-            case XK_Meta_L:
-                k[0] = XK_Alt_L;
-                break;
-            case XK_Meta_R:
-                k[0] = XK_Alt_R;
-                break;
-            }
-        }
-
-#if ALT_IS_MODE_SWITCH
-        if (k[0] == XK_Alt_L)
-            k[0] = XK_Mode_switch;
-#endif
     }
 }
 
-
 /*
  * DarwinLoadKeyboardMapping
  *  Load the keyboard map from a file or system and convert
@@ -764,9 +729,17 @@ DarwinBuildModifierMaps(
 static void
 DarwinLoadKeyboardMapping(KeySymsRec *keySyms)
 {
+    int i;
+    KeySym *k;
+
     memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
 
+    /* TODO: Clean this up
+     * DarwinModeReadSystemKeymap is in quartz/quartzKeyboard.c
+     * DarwinParseNXKeyMapping is here
+     */
     if (!DarwinParseNXKeyMapping(&keyInfo)) {
+        DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running DarwinModeReadSystemKeymap().\n");
         if (!DarwinModeReadSystemKeymap(&keyInfo)) {
             FatalError("Could not build a valid keymap.");
         }
@@ -775,20 +748,18 @@ DarwinLoadKeyboardMapping(KeySymsRec *keySyms)
     DarwinBuildModifierMaps(&keyInfo);
 
 #ifdef DUMP_DARWIN_KEYMAP
-    ErrorF("Darwin -> X converted keyboard map\n");
-    for (i = 0, k = info->keyMap; i < NX_NUMKEYCODES;
+    DEBUG_LOG("Darwin -> X converted keyboard map\n");
+    for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
          i++, k += GLYPHS_PER_KEY)
     {
         int j;
-        ErrorF("0x%02x:", i);
         for (j = 0; j < GLYPHS_PER_KEY; j++) {
             if (k[j] == NoSymbol) {
-                ErrorF("\tNoSym");
+                DEBUG_LOG("0x%02x:\tNoSym\n", i);
             } else {
-                ErrorF("\t0x%x", k[j]);
+                DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
             }
         }
-        ErrorF("\n");
     }
 #endif
 
@@ -937,32 +908,6 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide)
 }
 
 /*
- * DarwinModifierNXMaskToNXKeyCode
- *      Returns 0 if mask is not a known modifier mask.
- */
-int DarwinModifierNXMaskToNXKeyCode(int mask)
-{
-  switch (mask) {
-  case NX_ALPHASHIFTMASK:       return XK_Caps_Lock;
-  case NX_SHIFTMASK: ErrorF("Warning: Received NX_SHIFTMASK, treating as NX_DEVICELSHIFTKEYMASK\n");
-  case NX_DEVICELSHIFTKEYMASK:  return NX_MODIFIERKEY_SHIFT; //XK_Shift_L;
-  case NX_DEVICERSHIFTKEYMASK:  return NX_MODIFIERKEY_RSHIFT; //XK_Shift_R;
-  case NX_CONTROLMASK: ErrorF("Warning: Received NX_CONTROLMASK, treating as NX_DEVICELCTLKEYMASK\n");
-  case NX_DEVICELCTLKEYMASK:    return XK_Control_L;
-  case NX_DEVICERCTLKEYMASK:    return XK_Control_R;
-  case NX_ALTERNATEMASK: ErrorF("Warning: Received NX_ALTERNATEMASK, treating as NX_DEVICELALTKEYMASK\n");
-  case NX_DEVICELALTKEYMASK:    return XK_Alt_L;
-  case NX_DEVICERALTKEYMASK:    return XK_Alt_R;
-  case NX_COMMANDMASK: ErrorF("Warning: Received NX_COMMANDMASK, treating as NX_DEVICELCMDKEYMASK\n");
-  case NX_DEVICELCMDKEYMASK:    return XK_Meta_L;
-  case NX_DEVICERCMDKEYMASK:    return XK_Meta_R;
-  case NX_NUMERICPADMASK:       return XK_Num_Lock;
-  case NX_HELPMASK:             return XK_Help;
-  case NX_SECONDARYFNMASK:      return XK_Control_L; // this seems very wrong, but is what the old code did
-    }
-}
-
-/*
  * DarwinModifierNXMaskToNXKey
  *      Returns -1 if mask is not a known modifier mask.
  */
@@ -997,25 +942,25 @@ int DarwinModifierNXMaskToNXKey(int mask)
     return -1;
 }
 
-char * DarwinModifierNXMaskTostring(int mask)
+const char *DarwinModifierNXMaskTostring(int mask)
 {
     switch (mask) {
-    case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
-    case NX_SHIFTMASK: return "NX_SHIFTMASK";
-    case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
-    case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
-    case NX_CONTROLMASK: return "NX_CONTROLMASK";
-    case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
-    case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
-    case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
-    case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
-    case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
-    case NX_COMMANDMASK: return "NX_COMMANDMASK";
-    case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
-    case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
-    case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
-    case NX_HELPMASK: return "NX_HELPMASK";
-    case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
+        case NX_ALPHASHIFTMASK:      return "NX_ALPHASHIFTMASK";
+        case NX_SHIFTMASK:           return "NX_SHIFTMASK";
+        case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
+        case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
+        case NX_CONTROLMASK:         return "NX_CONTROLMASK";
+        case NX_DEVICELCTLKEYMASK:   return "NX_DEVICELCTLKEYMASK";
+        case NX_DEVICERCTLKEYMASK:   return "NX_DEVICERCTLKEYMASK";
+        case NX_ALTERNATEMASK:       return "NX_ALTERNATEMASK";
+        case NX_DEVICELALTKEYMASK:   return "NX_DEVICELALTKEYMASK";
+        case NX_DEVICERALTKEYMASK:   return "NX_DEVICERALTKEYMASK";
+        case NX_COMMANDMASK:         return "NX_COMMANDMASK";
+        case NX_DEVICELCMDKEYMASK:   return "NX_DEVICELCMDKEYMASK";
+        case NX_DEVICERCMDKEYMASK:   return "NX_DEVICERCMDKEYMASK";
+        case NX_NUMERICPADMASK:      return "NX_NUMERICPADMASK";
+        case NX_HELPMASK:            return "NX_HELPMASK";
+        case NX_SECONDARYFNMASK:     return "NX_SECONDARYFNMASK";
     }
     return "unknown mask";
 }
diff --git a/hw/darwin/quartz/X11Application.m b/hw/darwin/quartz/X11Application.m
index 60d11c5..a43d536 100644
--- a/hw/darwin/quartz/X11Application.m
+++ b/hw/darwin/quartz/X11Application.m
@@ -612,9 +612,6 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
     quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS
                             default:quartzXpluginOptions];
 #endif
-	
-    darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META
-                         default:darwinSwapAltMeta];
     darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
                          default:darwinFakeButtons];
     if (darwinFakeButtons) {


More information about the xorg-commit mailing list