[Xquartz-changes] xserver: Branch 'master' - 8 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Nov 6 10:56:51 PST 2009


 configure.ac                            |   16 +
 hw/xfree86/modes/xf86Crtc.c             |   12 -
 hw/xfree86/os-support/linux/Makefile.am |    6 
 hw/xfree86/os-support/linux/lnx.h       |    7 
 hw/xfree86/os-support/linux/lnx_apm.c   |    1 
 hw/xfree86/os-support/linux/lnx_font.c  |  285 --------------------------------
 hw/xfree86/os-support/linux/lnx_init.c  |   30 ---
 hw/xfree86/os-support/linux/lnx_video.c |    1 
 hw/xquartz/X11Application.h             |    1 
 hw/xquartz/X11Application.m             |   19 +-
 hw/xquartz/X11Controller.h              |    4 
 hw/xquartz/X11Controller.m              |   16 -
 hw/xquartz/applewm.c                    |   20 +-
 hw/xquartz/quartzKeyboard.c             |   18 +-
 include/dix-config.h.in                 |    3 
 os/xsha1.c                              |   28 +++
 16 files changed, 101 insertions(+), 366 deletions(-)

New commits:
commit a5e59230de3abafda9cd9d571cea192897155a14
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Nov 5 13:44:30 2009 -0800

    randr: Turn on ModeDebug during server setup
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index fad50a2..d015c6a 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1561,6 +1561,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	int		    max_clock = 0;
 	double		    clock;
 	Bool                add_default_modes = TRUE;
+	Bool		    debug_modes = config->debug_modes ||
+					  xf86Initialising;
 	enum { sync_config, sync_edid, sync_default } sync_source = sync_default;
 	
 	while (output->probed_modes != NULL)
@@ -1712,8 +1714,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	    if (mode->status == MODE_OK)
 		mode->status = (*output->funcs->mode_valid)(output, mode);
 	
-	xf86PruneInvalidModes(scrn, &output->probed_modes,
-			      config->debug_modes);
+	xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
 	
 	output->probed_modes = xf86SortModes (output->probed_modes);
 	
@@ -1745,7 +1746,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	
 	output->initial_rotation = xf86OutputInitialRotation (output);
 
-	if (config->debug_modes) {
+	if (debug_modes) {
 	    if (output->probed_modes != NULL) {
 		xf86DrvMsg(scrn->scrnIndex, X_INFO,
 			   "Printing probed modes for output %s\n",
@@ -1764,7 +1765,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	    mode->VRefresh = xf86ModeVRefresh(mode);
 	    xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
 
-	    if (config->debug_modes)
+	    if (debug_modes)
 		xf86PrintModeline(scrn->scrnIndex, mode);
 	}
     }
@@ -2924,6 +2925,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
 {
     ScrnInfoPtr		scrn = output->scrn;
     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+    Bool		debug_modes = config->debug_modes || xf86Initialising;
 #ifdef RANDR_12_INTERFACE
     int			size;
 #endif
@@ -2933,7 +2935,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
     
     output->MonInfo = edid_mon;
 
-    if (config->debug_modes) {
+    if (debug_modes) {
 	xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
 		   output->name);
 	xf86PrintEDID(edid_mon);
commit c61e77c77ca309f3676370992f41867807ed0c67
Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Nov 5 22:40:03 2009 -0800

    Remove lnx_font.c and lnx.h
    
    I couldn't find any version of the X xserver that ever used lnx_font.c
    so let's delete it. I tried contacting its author, Egbert, multiple
    times on IRC and email [*] but never got any response. It also hasn't
    been seriously touched since January 2005.
    
    [*] http://lists.x.org/archives/xorg-devel/2009-October/002855.html
    
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 1239c8f..7a82627 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -40,13 +40,7 @@ AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_
 
 INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
 
-# FIXME: These need to be added to the build
-LNX_EXTRA_SRCS = \
-	lnx_font.c
-
 EXTRA_DIST = \
-	$(LNX_EXTRA_SRCS) \
-	lnx.h \
 	$(srcdir)/../shared/xf86Axp.h
 
 if LINUX_ALPHA
diff --git a/hw/xfree86/os-support/linux/lnx.h b/hw/xfree86/os-support/linux/lnx.h
index 085c942..33363dd 100644
--- a/hw/xfree86/os-support/linux/lnx.h
+++ b/hw/xfree86/os-support/linux/lnx.h
@@ -41,13 +41,6 @@ extern long (*_iobase)(unsigned, int, int, int);
 #  endif
 # endif /* __alpha__ */
 
-# if defined(DO_OS_FONTRESTORE)
-Bool lnx_savefont(void);
-Bool lnx_restorefont(void);
-Bool lnx_switchaway(void);
-void lnx_freefontdata(void);
-# endif
-
 #define LNX_H_
 
 #endif
diff --git a/hw/xfree86/os-support/linux/lnx_apm.c b/hw/xfree86/os-support/linux/lnx_apm.c
index 4ccc7d6..54c6989 100644
--- a/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/hw/xfree86/os-support/linux/lnx_apm.c
@@ -16,7 +16,6 @@ extern PMClose lnxACPIOpen(void);
 
 #ifdef HAVE_APM
 
-#include "lnx.h"
 #include <linux/apm_bios.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
diff --git a/hw/xfree86/os-support/linux/lnx_font.c b/hw/xfree86/os-support/linux/lnx_font.c
deleted file mode 100644
index d6fc283..0000000
--- a/hw/xfree86/os-support/linux/lnx_font.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2004, Egbert Eich
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
- * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Egbert Eich shall not
- * be used in advertising or otherwise to promote the sale, use or other deal-
- *ings in this Software without prior written authorization from Egbert Eich.
- *
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "lnx.h"
-
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-
-struct {
-    int width;
-    int height;
-    int charcount;
-    unsigned char *data;
-} lnxfont = { 0, 0, 0, NULL };
-
-
-static Bool
-getfont(int *width, int *height, 
-	int *charcount, unsigned char *data)
-{
-    struct console_font_op op;
-    struct consolefontdesc ds;
-    int result;
-
-    op.op = KD_FONT_OP_GET;
-    op.width = *width;
-    op.height = *height;
-    op.charcount = *charcount;
-    op.data = data;
-    op.flags = 0;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
-    DebugF("Console font read: h: %i count: %i\n",op.height,op.charcount);
-
-    if (!result) {
-
-	*width = op.width;
-	*height = op.height;
-	*charcount = op.charcount;
-	
-	return TRUE;
-    } 
-    
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* GIO_FONTX fallback */
-    ds.charcount = *charcount;
-    ds.charheight = *height;
-    ds.chardata = (char *)data;
-    *width = 8;
-    
-    SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONTX, &ds));
-    
-    if (!result) {
-	
-	*charcount = ds.charcount;
-	*height = ds.charheight;
-
-	return TRUE;
-    }
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* GIO_FONT fallback */
-    if (*charcount < 256)
-	return FALSE;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONT, data));
-
-    if (!result) {
-	*height = 0;
-	*charcount = 512;
-	return TRUE;
-    }
-
-    return FALSE;
-
-}
-
-#define VERSION_LEN 31
-
-Bool
-lnx_savefont(void)
-{
-    unsigned char *fontdata;
-#if CHECK_OS_VERSION
-    char kernel_version[VERSION_LEN + 1];
-    int k_major, k_minor, k_release;
-#endif
-    int size;
-    int fd;
-    int width = 32, height = 32, charcount = 2048;
-
-    DebugF("SAVE font\n");
-
-#if CHECK_OS_VERSION
-    /* Check if the kernel has full support for this */
-    if ((fd = open ("/proc/sys/kernel/osrelease",O_RDONLY)) == -1) {
-	close (fd);
-	return TRUE;
-    }
-    size = read(fd, kernel_version, VERSION_LEN);
-    close (fd);
-
-    if (size < 0)
-	return TRUE;
-
-    size = sscanf(kernel_version, "%d.%d.%d",&k_major,&k_minor,&k_release);
-    if (size < 3 
-	|| (k_major < 2) 
-	|| ((k_major == 2) 
-	    && ((k_minor < 6) 
-		|| ( k_minor == 6 
-		     && k_release < 11))))
-	return TRUE;
-#endif
-							    
-    /* if we are in fbdev mode we don't bother saving fonts */
-    if ((fd = open ("/dev/fb0",O_RDWR)) != -1) {
-	close (fd);
-	return TRUE;
-    }
-
-    if (!getfont(&width, &height, &charcount, NULL)) {
-	xf86Msg(X_WARNING, 
-		"lnx_savefont: cannot obtain font info\n");
-	goto error;
-    } else if (charcount == 2048) {
-	xf86Msg(X_WARNING, "lnx_savefont: "
-		"kernel bug: kernel doesn't report font info\n");
-	return FALSE;
-    }
-
-    size = bits_to_bytes(width) * 32 * charcount;
-    fontdata = (unsigned char *)xnfalloc(size);
-    if (!fontdata) {
-	xf86Msg(X_WARNING,
-		"lnx_savefont: cannot allocate memory to save font\n");
-	goto error;
-    }
-
-    if (!getfont(&width, &height, &charcount, fontdata)) {
-	xf86Msg(X_WARNING,"lnx_savefont: cannot read font data\n");
-	goto error;
-    }
-    lnxfont.width = width;
-    lnxfont.height = height;
-    lnxfont.charcount = charcount;
-    lnxfont.data = fontdata;
-
-    return TRUE;
-
- error:
-    return FALSE;
-}
-
-static Bool
-setfont(int width, int height, 
-	int charcount, unsigned char *data)
-{
-    struct console_font_op op;
-    struct consolefontdesc ds;
-    int result;
-
-    op.op = KD_FONT_OP_SET;
-    op.flags = 0;
-    op.charcount = charcount;
-    op.width = width;
-    op.height = height;
-    op.data = data;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
-
-    if (!result) 
-	return TRUE;
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* PIO_FONTX fallback */
-    if (width != 8)
-	return FALSE;
-
-    ds.charcount = charcount;
-    ds.chardata = (char *)data;
-    ds.charheight = height;
-    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONTX, &ds));
-    
-    if (!result)
-	return TRUE;
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* PIO_FONT fallback */
-    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONT, data));
-    
-    if (!result)
-	return TRUE;
-    
-    return FALSE;
-}
-
-Bool
-lnx_restorefont(void)
-{
-    if (lnxfont.data == NULL)
-	return FALSE;
-    DebugF("RESTORE font\n");
-#if 0
-    /* must wack the height to make the kernel reprogram the VGA registers */
-    if (!setfont(lnxfont.width, lnxfont.height + 1, lnxfont.charcount,
-		lnxfont.data)) {
-	xf86Msg(X_WARNING,"lnx_fontretore: cannot write font data\n");
-	return FALSE;
-    }
-#endif
-    if (!setfont(lnxfont.width, lnxfont.height, lnxfont.charcount,
-		lnxfont.data)) {
-	xf86Msg(X_WARNING,"lnx_restorefont: cannot write font data\n");
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-Bool
-lnx_switchaway(void)
-{
-    Bool ret;
-
-    /* temporarily switch to text mode */
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
-    ret = lnx_restorefont();
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS);
-    return ret;
-}
-
-void
-lnx_freefontdata(void)
-{
-    if (lnxfont.data == NULL)
-	return;
-
-    xfree(lnxfont.data);
-    lnxfont.data = NULL;
-    lnxfont.width = lnxfont.height = lnxfont.charcount = 0;
-}
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index f84c614..297e7a6 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -35,7 +35,6 @@
 #include "xf86.h"
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
-#include "lnx.h"
 
 #include <sys/stat.h>
 
@@ -230,9 +229,6 @@ xf86OpenConsole(void)
         {
             struct termios nTty;
 
-#if defined(DO_OS_FONTRESTORE)
-	    lnx_savefont();
-#endif
 	    /*
 	     * now get the VT.  This _must_ succeed, or else fail completely.
 	     */
@@ -302,17 +298,12 @@ xf86OpenConsole(void)
 		        strerror(errno));
         }
     }
-    return;
 }
 
 void
 xf86CloseConsole(void)
 {
     struct vt_mode   VT;
-#if defined(DO_OS_FONTRESTORE)
-    struct vt_stat vts;
-    int vtno = -1;
-#endif
 
     if (ShareVTs) {
         close(xf86Info.consoleFd);
@@ -324,14 +315,6 @@ xf86CloseConsole(void)
 	console_handler = NULL;
     };
 
-#if defined(DO_OS_FONTRESTORE)
-    if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
-	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n",
-		strerror(errno));
-    else
-	vtno = vts.v_active;
-#endif
-
     /* Back to text mode ... */
     if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
 	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
@@ -366,18 +349,10 @@ xf86CloseConsole(void)
 			strerror(errno));
 	    activeVT = -1;
         }
-
-#if defined(DO_OS_FONTRESTORE)
-        if (xf86Info.vtno == vtno)	/* check if we are active */
-	    lnx_restorefont();
-        lnx_freefontdata();
-#endif
     }
     close(xf86Info.consoleFd);	/* make the vt-manager happy */
 
     restoreVtPerms();		/* restore the permissions */
-
-    return;
 }
 
 int
@@ -421,7 +396,6 @@ xf86UseMsg(void)
 	ErrorF("vtXX                   use the specified VT number\n");
 	ErrorF("-keeptty               ");
 	ErrorF("don't detach controlling tty (for debugging only)\n");
-        ErrorF("-novtswitch            don't immediately switch to new VT\n");
-        ErrorF("-sharevts              share VTs with another X server\n");
-	return;
+	ErrorF("-novtswitch            don't immediately switch to new VT\n");
+	ErrorF("-sharevts              share VTs with another X server\n");
 }
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 09d1787..e159f46 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -38,7 +38,6 @@
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
 #include "xf86OSpriv.h"
-#include "lnx.h"
 #ifdef __alpha__
 #include "shared/xf86Axp.h"
 #endif
commit 15ffe9f51b122494a2b292b3ab1f199d3e81600c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Nov 5 18:28:28 2009 -0800

    configure.ac: Notify user about which SHA1 implementation is being used
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/configure.ac b/configure.ac
index f8dc55b..fd2118a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1364,9 +1364,11 @@ if test "x$with_sha1" = xlibcrypto; then
 		SHA1_CFLAGS="$OPENSSL_CFLAGS"
 	fi
 fi
+AC_MSG_CHECKING([for SHA1 implementation])
 if test "x$with_sha1" = x; then
 	AC_MSG_ERROR([No suitable SHA1 implementation found])
 fi
+AC_MSG_RESULT([$with_sha1])
 AC_SUBST(SHA1_LIBS)
 AC_SUBST(SHA1_CFLAGS)
 
commit 6b109919f6e1593b27b0760bb56a65b43fb86ea4
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Nov 5 18:13:07 2009 -0800

    SHA1: Add support for Common Crypto
    
    libSystem on darwin can handle SHA1 computation without needing to pull in
    OpenSSL. See CC_crypto(3)
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/configure.ac b/configure.ac
index de58f21..f8dc55b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1287,7 +1287,7 @@ CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
 
 # SHA1 hashing
 AC_ARG_WITH([sha1],
-            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1],
+            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto],
                             [choose SHA1 implementation])])
 AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
 if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
@@ -1301,6 +1301,18 @@ if test "x$with_sha1" = xlibc; then
 		[Use libc SHA1 functions])
 	SHA1_LIBS=""
 fi
+AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
+if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
+	with_sha1=CommonCrypto
+fi
+if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
+	AC_MSG_ERROR([CommonCrypto requested but not found])
+fi
+if test "x$with_sha1" = xCommonCrypto; then
+	AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
+		[Use CommonCrypto SHA1 functions])
+	SHA1_LIBS=""
+fi
 AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
 if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
 	with_sha1=libmd
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 274ce89..1096371 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -163,6 +163,9 @@
 /* Define to use libc SHA1 functions */
 #undef HAVE_SHA1_IN_LIBC
 
+/* Define to use CommonCrypto SHA1 functions */
+#undef HAVE_SHA1_IN_COMMONCRYPTO
+
 /* Define to use libmd SHA1 functions */
 #undef HAVE_SHA1_IN_LIBMD
 
diff --git a/os/xsha1.c b/os/xsha1.c
index 229ce89..355862f 100644
--- a/os/xsha1.c
+++ b/os/xsha1.c
@@ -34,6 +34,34 @@ int x_sha1_final(void *ctx, unsigned char result[20])
     return 1;
 }
 
+#elif defined(HAVE_SHA1_IN_COMMONCRYPTO) /* Use CommonCrypto for SHA1 */
+
+#include <CommonCrypto/CommonDigest.h>
+
+void *x_sha1_init(void)
+{
+    CC_SHA1_CTX *ctx = xalloc(sizeof(*ctx));
+    if (!ctx)
+        return NULL;
+    CC_SHA1_Init(ctx);
+    return ctx;
+}
+
+int x_sha1_update(void *ctx, void *data, int size)
+{
+    CC_SHA1_CTX *sha1_ctx = ctx;
+    CC_SHA1_Update(sha1_ctx, data, size);
+    return 1;
+}
+
+int x_sha1_final(void *ctx, unsigned char result[20])
+{
+    CC_SHA1_CTX *sha1_ctx = ctx;
+    CC_SHA1_Final(result, sha1_ctx);
+    xfree(sha1_ctx);
+    return 1;
+}
+
 #elif defined(HAVE_SHA1_IN_LIBGCRYPT) /* Use libgcrypt for SHA1 */
 
 # include <gcrypt.h>
commit 840a68dc5e3b4d285894f86df2a8c41fca5a4bec
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 18:39:16 2009 -0800

    XQuartz: Cleanup X11Controller.m compilation warnings.
    
    Declare X11Controller as implementing NSTableViewDataSource.
    Use selectRowIndexes:byExtendingSelection instead of selectRow:byExtendingSelection
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 88f50a1..bb28447 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -55,7 +55,7 @@ typedef unsigned int NSUInteger;
 #endif
 #endif
 
- at interface X11Controller : NSObject
+ at interface X11Controller : NSObject <NSTableViewDataSource>
 {
     IBOutlet NSPanel *prefs_panel;
 
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 1191547..b28f4d3 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -426,8 +426,8 @@
   [[columns objectAtIndex:2] setIdentifier:@"2"];
 	
   [apps_table setDataSource:self];
-  [apps_table selectRow:0 byExtendingSelection:NO];
-	
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
+
   [[apps_table window] makeKeyAndOrderFront:sender];
   [apps_table reloadData];
   if(oldapps != nil)
@@ -474,7 +474,7 @@
   [item release];
 	
   [apps_table reloadData];
-  [apps_table selectRow:row byExtendingSelection:NO];
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
 }
 
 - (IBAction) apps_table_duplicate:sender
@@ -497,7 +497,7 @@
   [item release];
 	
   [apps_table reloadData];
-  [apps_table selectRow:row+1 byExtendingSelection:NO];
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row+1] byExtendingSelection:NO];
 }
 
 - (IBAction) apps_table_delete:sender
@@ -519,10 +519,10 @@
 	
   row = MIN (row, [table_apps count] - 1);
   if (row >= 0)
-    [apps_table selectRow:row byExtendingSelection:NO];
+    [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
 }
 
-- (int) numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
 {
   if (table_apps == nil) return 0;
   
@@ -530,7 +530,7 @@
 }
 
 - (id) tableView:(NSTableView *)tableView
-objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
+objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
   NSArray *item;
   int col;
@@ -547,7 +547,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
 }
 
 - (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
-    forTableColumn:(NSTableColumn *)tableColumn row:(int)row
+    forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
   NSMutableArray *item;
   int col;
commit 0e3ad44c3b05cbe7b1d8f5ce7949fec3c7ae2e7c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 18:15:08 2009 -0800

    XQuartz: Use dixLookupResourceByType instead of LookupIDByType
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index d2cca13..d1a6175 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -213,10 +213,11 @@ static int
 WMFreeClient (pointer data, XID id) {
     WMEventPtr   pEvent;
     WMEventPtr   *pHead, pCur, pPrev;
+    int i;
 
     pEvent = (WMEventPtr) data;
-    pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
-    if (pHead) {
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess | DixWriteAccess | DixDestroyAccess);
+    if (i == Success && pHead) {
         pPrev = 0;
         for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
             pPrev = pCur;
@@ -254,12 +255,12 @@ ProcAppleWMSelectInput (register ClientPtr client)
     REQUEST(xAppleWMSelectInputReq);
     WMEventPtr      pEvent, pNewEvent, *pHead;
     XID             clientResource;
+    int             i;
 
     REQUEST_SIZE_MATCH (xAppleWMSelectInputReq);
-    pHead = (WMEventPtr *)SecurityLookupIDByType(client,
-                        eventResource, EventType, DixWriteAccess);
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, client, DixWriteAccess);
     if (stuff->mask != 0) {
-        if (pHead) {
+        if (i == Success && pHead) {
             /* check for existing entry. */
             for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
             {
@@ -293,7 +294,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
          * the list may be arbitrarily rearranged which cannot be
          * done through the resource database.
          */
-        if (!pHead)
+        if (i != Success || !pHead)
         {
             pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
             if (!pHead ||
@@ -309,7 +310,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
         updateEventMask (pHead);
     } else if (stuff->mask == 0) {
         /* delete the interest */
-        if (pHead) {
+        if (i == Success && pHead) {
             pNewEvent = 0;
             for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
                 if (pEvent->client == client)
@@ -342,9 +343,10 @@ AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
     WMEventPtr      *pHead, pEvent;
     ClientPtr       client;
     xAppleWMNotifyEvent se;
+    int             i;
 
-    pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
-    if (!pHead)
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess);
+    if (i != Success || !pHead)
         return;
     for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
         client = pEvent->client;
commit 069fc6ce0a0e7f2c418e11941568ffcc52b6b331
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 16:18:06 2009 -0800

    XQuartz: Don't weed out duplicates in generated keymap
    
    There seems to be an issue in the 1.5+ server where shift-space does not
    produce a space when 'keycode 57 = space' but it does when 'keycode 57 = space
    space'
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 1b3c27e..90f6610 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -387,6 +387,7 @@ void DarwinKeyboardReloadHandler(void) {
         keySyms.minKeyCode = MIN_KEYCODE;
         keySyms.maxKeyCode = MAX_KEYCODE;
 
+	// TODO: We should build the entire XkbDescRec and use XkbCopyKeymap
         /* Apply the mappings to darwinKeyboard */
         XkbApplyMappingChange(darwinKeyboard, &keySyms, keySyms.minKeyCode,
                               keySyms.maxKeyCode - keySyms.minKeyCode + 1,
@@ -767,9 +768,12 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 #endif
         }
 
-        if (k[3] == k[2]) k[3] = NoSymbol;
-        if (k[1] == k[0]) k[1] = NoSymbol;
-        if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+        // There seems to be an issue with this in 1.5+, shift-space is not
+        // producing space, it's sending NoSymbol... ?
+        //if (k[3] == k[2]) k[3] = NoSymbol;
+        //if (k[1] == k[0]) k[1] = NoSymbol;
+        //if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+        //if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
     }
 
     /* Fix up some things that are normally missing.. */
@@ -780,7 +784,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 
             if    (k[0] == NoSymbol && k[1] == NoSymbol
                 && k[2] == NoSymbol && k[3] == NoSymbol)
-	      k[0] = known_keys[i].keysym;
+	      k[0] = k[1] = k[2] = k[3] = known_keys[i].keysym;
         }
     }
 
@@ -793,7 +797,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
             k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
 
             if (k[0] == known_numeric_keys[i].normal)
-                k[0] = known_numeric_keys[i].keypad;
+                k[0] = k[1] = k[2] = k[3] = known_numeric_keys[i].keypad;
         }
     }
 
commit 6d6e8fb27f00f0c3128cef624b39a60aa754fdc8
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 13:34:20 2009 -0800

    XQuartz: Controller thread launches clients
    
    This avoids a memory leak due to no active auto-release pool on the server thread.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 5e828a4..d7e9a5f 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -71,6 +71,7 @@ void X11ApplicationSetFrontProcess (void);
 void X11ApplicationSetCanQuit (int state);
 void X11ApplicationServerReady (void);
 void X11ApplicationShowHideMenubar (int state);
+void X11ApplicationLaunchClient (const char *cmd);
 
 void X11ApplicationMain(int argc, char **argv, char **envp);
 
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2c95485..f3c8a30 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -411,6 +411,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
         SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
 }
 
+- (void) launch_client:(NSString *)cmd {
+    (void)[_controller application:self openFile:cmd];
+}
 
 /* user preferences */
 
@@ -856,6 +859,16 @@ void X11ApplicationShowHideMenubar (int state) {
     [n release];
 }
 
+void X11ApplicationLaunchClient (const char *cmd) {
+    NSString *string;
+    
+    string = [[NSString alloc] initWithUTF8String:cmd];
+	
+    message_kit_thread (@selector (launch_client:), string);
+	
+    [string release];
+}
+
 static void check_xinitrc (void) {
     char *tem, buf[1024];
     NSString *msg;
@@ -961,12 +974,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
     /* not reached */
 }
 
-void launch_client(const char *cmd) {
-    NSString *string = [[NSString alloc] initWithUTF8String:cmd];
-    [[X11App controller] launch_client:string];
-    [string release];
-}
-
 @implementation X11Application (Private)
 
 #ifdef NX_DEVICELCMDKEYMASK
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 3d8e007..88f50a1 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -120,6 +120,7 @@ typedef unsigned int NSUInteger;
 #endif
 - (void) set_can_quit:(OSX_BOOL)state;
 - (void) server_ready;
+- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename;
 
 - (IBAction) apps_table_show:(id)sender;
 - (IBAction) apps_table_done:(id)sender;
@@ -144,6 +145,5 @@ typedef unsigned int NSUInteger;
 #endif /* __OBJC__ */
 
 void X11ControllerMain(int argc, char **argv, char **envp);
-void launch_client(const char *cmd);
 
 #endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 5bbb9c9..1b3c27e 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -408,7 +408,7 @@ void DarwinKeyboardReloadHandler(void) {
     if (access(xmodmap, F_OK) == 0) {
         if (access(sysmodmap, F_OK) == 0) {
             snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
-            launch_client(cmd);
+            X11ApplicationLaunchClient(cmd);
         }
     }
         
@@ -417,7 +417,7 @@ void DarwinKeyboardReloadHandler(void) {
         snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
         if (access(usermodmap, F_OK) == 0) {
             snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
-            launch_client(cmd);
+            X11ApplicationLaunchClient(cmd);
         }
     }
 }


More information about the Xquartz-changes mailing list