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

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Nov 9 14:20:45 PST 2009


Rebased ref, commits from common ancestor:
commit e6f81a4cab7cdf7b013dffc59661b115e05aef42
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Nov 9 13:09:55 2009 -0800

    XQuartz: Explicitly pass a bellProc to make XBell() work again.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 90f6610..00567b8 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -183,6 +183,12 @@ static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) {
     // keyclick, bell volume / pitch, autorepead, LED's
 }
 
+static void DarwinKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something) {
+    KeybdCtrl *ctrl = arg;
+
+    DDXRingBell(volume, ctrl->bell_pitch, ctrl->bell_duration);
+}
+
 //-----------------------------------------------------------------------------
 // Utility functions to help parse Darwin keymap
 //-----------------------------------------------------------------------------
@@ -296,7 +302,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
     /* We need to really have rules... or something... */
     //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
 
-    InitKeyboardDeviceStruct(pDev, NULL, NULL, DarwinChangeKeyboardControl);
+    InitKeyboardDeviceStruct(pDev, NULL, DarwinKeyboardBell, DarwinChangeKeyboardControl);
 
     DarwinKeyboardReloadHandler();
 
commit df1639836cda8142e889cc9491f012f6f1c97017
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Oct 27 17:16:57 2009 -0700

    XQuartz: pbproxy: Wait for the server to finish starting up, so display is valid.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index d4b43c6..f3f683a 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -37,7 +37,11 @@
 static const char *app_prefs_domain = "org.x.X11";
 CFStringRef app_prefs_domain_cfstr;
 
+/* Stubs */
 char *display = NULL;
+BOOL serverInitComplete = YES;
+pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
 
 static void signal_handler (int sig) {
     switch(sig) {
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index 5bc5182..d26b1b1 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -47,6 +47,20 @@ BOOL xpbproxy_is_standalone = NO;
 
 x_selection *_selection_object;
 
+extern BOOL serverInitComplete;
+extern pthread_mutex_t serverInitCompleteMutex;
+extern pthread_cond_t serverInitCompleteCond;
+
+static inline void wait_for_server_init(void) {
+    /* If the server hasn't finished initializing, wait for it... */
+    if(!serverInitComplete) {
+        pthread_mutex_lock(&serverInitCompleteMutex);
+        while(!serverInitComplete)
+            pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex);
+        pthread_mutex_unlock(&serverInitCompleteMutex);
+    }
+}
+
 static int x_io_error_handler (Display *dpy) {
     /* We lost our connection to the server. */
     
@@ -85,6 +99,8 @@ static void *xpbproxy_x_thread(void *args) {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     size_t i;
 
+    wait_for_server_init();
+
     for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) {
         xpbproxy_dpy = XOpenDisplay(NULL);
         
commit 3ecb6e4d457af23b211a90a2673a6e76fd9b177e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Nov 8 20:25:42 2009 -0800

    XQuartz: Buildfix for Leopard and older
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index bb28447..9e16f75 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -55,7 +55,11 @@ typedef unsigned int NSUInteger;
 #endif
 #endif
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 @interface X11Controller : NSObject <NSTableViewDataSource>
+#else
+ at interface X11Controller : NSObject
+#endif
 {
     IBOutlet NSPanel *prefs_panel;
 
commit ec5417b965616e60b51466fe9fd2b44cb5abb349
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Jul 12 23:58:32 2009 +0100

    Cygwin/X: Ensure WM_STATE atom exists in multiwindow mode
    
    Workaround a bug in iiimxcf (assuming the WM_STATE atom exists),
    which can cause many Solaris clients to simply fail with a BadAtom
    error
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 27f5e32..880ca6a 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1012,6 +1012,16 @@ winMultiWindowXMsgProc (void *pArg)
 			      "WM_CHANGE_STATE",
 			      False);
 
+  /*
+    iiimxcf had a bug until 2009-04-27, assuming that the
+    WM_STATE atom exists, causing clients to fail with
+    a BadAtom X error if it doesn't.
+
+    Since this is on in the default Solaris 10 install,
+    workaround this by making sure it does exist...
+   */
+  XInternAtom(pProcArg->pDisplay, "WM_STATE", 0);
+
   /* Loop until we explicitly break out */
   while (1)
     {
commit aa860552fd7e2888258a7b48b8c3bd4af527dc6c
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Sun Nov 1 18:19:08 2009 +0000

    Cygwin/X: Enable clipboard integration by default
    
    Enable clipboard integration by default, can be turned off with -noclipboard.
    We still accept -clipboard for backwards compatibility.  If both are passed,
    the last one is accepted (just as other arguments are handled).
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 0bf7918..8fd82d0 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -811,9 +811,8 @@ winUseMsg (void)
 	  "\tmonitors are present.\n");
 
 #ifdef XWIN_CLIPBOARD
-  ErrorF ("-clipboard\n"
-	  "\tRun the clipboard integration module.\n"
-	  "\tDo not use at the same time as 'xwinclip'.\n");
+  ErrorF ("-[no]clipboard\n"
+	  "\tEnable [disable] the clipboard integration. Default is enabled.\n");
 
   ErrorF ("-nounicodeclipboard\n"
 	  "\tDo not use Unicode clipboard even if NT-based platform.\n");
diff --git a/hw/xwin/XWin.man.pre b/hw/xwin/XWin.man.pre
index 9649e2e..0bad65c 100644
--- a/hw/xwin/XWin.man.pre
+++ b/hw/xwin/XWin.man.pre
@@ -80,10 +80,9 @@ In addition to the normal server options described in the \fIXserver(1)\fP
 manual page, \fIXWin\fP accepts the following command line switches,
 \fIall\fP of which are optional:
 .TP 8
-.B \-clipboard
-Enables the integration
-between the Cygwin/X clipboard and Windows clipboard.  Do not use in
-conjunction with the \fIxwinclip\fP program.
+.B \-[no]clipboard
+Enables [disables] the integration between the Cygwin/X clipboard and
+Windows clipboard.  The default is enabled.
 .TP 8
 .B "\-clipupdates \fInum_boxes\fP"
 Specify an optional threshold, above which the boxes in a shadow
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 57b3bf3..7bb4a60 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -114,7 +114,7 @@ winDispatchProcPtr	winProcSetSelectionOwnerOrig = NULL;
  */
 
 Bool			g_fUnicodeClipboard = TRUE;
-Bool			g_fClipboard = FALSE;
+Bool			g_fClipboard = TRUE;
 Bool			g_fClipboardLaunched = FALSE;
 Bool			g_fClipboardStarted = FALSE;
 pthread_t		g_ptClipboardProc;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 3732ecb..31e505e 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -889,11 +889,23 @@ ddxProcessArgument (int argc, char *argv[], int i)
    */
   if (IS_OPTION ("-clipboard"))
     {
+      /* Now the default, we still accept the arg for backwards compatibility */
       g_fClipboard = TRUE;
 
       /* Indicate that we have processed this argument */
       return 1;
     }
+
+  /*
+   * Look for the '-noclipboard' argument
+   */
+  if (IS_OPTION ("-noclipboard"))
+    {
+      g_fClipboard = FALSE;
+
+      /* Indicate that we have processed this argument */
+      return 1;
+    }
 #endif
 
 
commit 87b00ced3d308a9168828c0e38ecffa0640621a0
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Nov 1 18:18:48 2009 +0000

    Cygwin/X: Setup screen layout in Xinerama mode
    
    Setup screen layout according to the screen window native window
    positions in Xinerama mode
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index 99d5a46..37ec27e 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -239,6 +239,16 @@ winScreenInit (int index,
   else
     winErrorFVerb(2, "winScreenInit - Using software cursor\n");  
 
+  /*
+     Note the screen origin in a normalized coordinate space where (0,0) is at the top left
+     of the native virtual desktop area
+  */
+  dixScreenOrigins[index].x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN);
+  dixScreenOrigins[index].y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+  ErrorF("Screen %d added at XINERAMA coordinate (%d,%d).\n",
+         index, dixScreenOrigins[index].x, dixScreenOrigins[index].y);
+
 #if CYGDEBUG || YES
   winDebug ("winScreenInit - returning\n");
 #endif
commit 0fe2e8c64e7a5a9140c77b88b266d7ae58b0bca2
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Sun Nov 1 18:18:31 2009 +0000

    Cygwin/X: Allow composite to be enabled for Xwin
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/configure.ac b/configure.ac
index 077f7a0..dda4f37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1830,10 +1830,6 @@ if test "x$XWIN" = xyes; then
 		AC_MSG_NOTICE([Disabling XF86VidMode extension])
 		XF86VIDMODE=no
 	fi
-	if test "x$COMPOSITE" = xyes; then
-		AC_MSG_NOTICE([Disabling Composite extension])
-		COMPOSITE=no
-	fi
 fi
 AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
commit 26a69bbd9b6f415c443d6d6f8f450329f348edc3
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Sun Nov 1 18:19:04 2009 +0000

    Cygwin/X: Mount options have changed in cygwin-1.7
    
    Mount options have changed in cygwin-1.7
    
    Also fix a typo in the warning issued if /tmp is a textmode mount
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index a33056d..0bf7918 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -334,7 +334,7 @@ winCheckMount(void)
 
   while ((ent = getmntent(mnt)) != NULL)
   {
-    BOOL system = (strcmp(ent->mnt_type, "system") == 0);
+    BOOL system = (winCheckMntOpt(ent, "user") != NULL);
     BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
     BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
     
@@ -361,7 +361,8 @@ winCheckMount(void)
       continue;
     level = curlevel;
 
-    if (winCheckMntOpt(ent, "binmode") == NULL)
+    if ((winCheckMntOpt(ent, "binary") == NULL) ||
+        (winCheckMntOpt(ent, "binmode") == NULL))
       binary = 0;
     else
       binary = 1;
@@ -374,7 +375,7 @@ winCheckMount(void)
   }
   
  if (!binary) 
-   winMsg(X_WARNING, "/tmp mounted int textmode\n"); 
+   winMsg(X_WARNING, "/tmp mounted in textmode\n");
 }
 #else
 static void
commit 35901ece6a49e5f8e245364c27723da2f9009a1d
Author: Paul Loewenstein <paul.loewenstein at gmail.com>
Date:   Sun Nov 1 18:18:45 2009 +0000

    Cygwin/X: Handle fake keypresses generated by speech recognizers
    
    Apparently, fake keypresses generated by speech recognizers may not bother
    with a scan code, so look up what scan code corresponds to the virtual key
    code if this occurs.
    
    Patch by Paul Loewenstein <paul.loewenstein at gmail.com>
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 611ea5d..317f14d 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -73,10 +73,31 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
 {
   int		iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
   int		iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
-  int		iParamScanCode = LOBYTE (HIWORD (lParam));
+  int		iParam = HIWORD (lParam);
+  int		iParamScanCode = LOBYTE (iParam);
+
+/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
+ * scan code.
+ *
+ * Vocola 3 (Rick Mohr's supplement to WSR) uses
+ * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
+ * scan code of 1
+ */
+  if (iParamScanCode <= 1)
+    {
+      if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
+        /* Trigger special case table to translate to extended
+         * keycode, otherwise if num_lock is on, we can get keypad
+         * numbers instead of navigation keys. */
+        iParam |= KF_EXTENDED;
+      else
+        iParamScanCode = MapVirtualKeyEx(wParam,
+                         /*MAPVK_VK_TO_VSC*/0,
+                         GetKeyboardLayout(0));
+    }
 
   /* Branch on special extended, special non-extended, or normal key */
-  if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx)
+  if ((iParam & KF_EXTENDED) && iKeyFixupEx)
     *piScanCode = iKeyFixupEx;
   else if (iKeyFixup)
     *piScanCode = iKeyFixup;
diff --git a/hw/xwin/winkeybd.h b/hw/xwin/winkeybd.h
index 09eed14..d0d6b9c 100644
--- a/hw/xwin/winkeybd.h
+++ b/hw/xwin/winkeybd.h
@@ -45,6 +45,9 @@
 
 #define		WIN_KEYMAP_COLS		3
 
+/* Rows 160 through 165 correspond to software-generated codes, which
+ * may not be associated with the appropriate scan code.
+ */
 const int
 g_iKeyMap [] = {
   /* count	Windows VK,	ASCII,		ASCII when extended VK */
@@ -208,12 +211,12 @@ g_iKeyMap [] = {
   /* 157 */	0,		0,		0,
   /* 158 */	0,		0,		0,
   /* 159 */	0,		0,		0,
-  /* 160 */	0,		0,		0,
-  /* 161 */	0,		0,		0,
-  /* 162 */	0,		0,		0,
-  /* 163 */	0,		0,		0,
-  /* 164 */	0,		0,		0,
-  /* 165 */	0,		0,		0,
+  /* 160 */	VK_LSHIFT,	KEY_ShiftL,	0,
+  /* 161 */	VK_RSHIFT,	KEY_ShiftR,	0,
+  /* 162 */	VK_LCONTROL,	KEY_LCtrl,	0,
+  /* 163 */	VK_RCONTROL,	KEY_RCtrl,	0,
+  /* 164 */	VK_LMENU,	KEY_Alt,	0,
+  /* 165 */	VK_RMENU,	KEY_AltLang,	0,
   /* 166 */	0,		0,		0,
   /* 167 */	0,		0,		0,
   /* 168 */	0,		0,		0,
commit 0866322b574b1f3695467535ed5fa8f9e629ad1d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Jul 13 13:46:45 2009 +0100

    Cygwin/X: Always use an authorization cookie for internal clients
    
    Don't conditionalize use of an authorization cookie for internal client
    threads on XCSECURITY, always use one (this avoids certain problems
    with XDMCP setups where the XDMCP host removes localhost from the access
    list etc.)
    
    Conditionalize the use of a XCSECURITY authorization descriptor on XCSECURITY
    
    Consolidate the various places where the authorization cookie is set
    for internal threads into a new function, winSetAuthorization()
    
    Use authorization cookie for multiwindow WM X message thread as well
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 45dccce..a33056d 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -1022,11 +1022,9 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
 
 #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
 
-#if defined(XCSECURITY)
   /* Generate a cookie used by internal clients for authorization */
   if (g_fXdmcpEnabled || g_fAuthEnabled)
     winGenerateAuthorization ();
-#endif
 
   /* Perform some one time initialization */
   if (1 == serverGeneration)
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 9009df2..9ab8ed9 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -766,10 +766,9 @@ winAllocateCmapPrivates (ColormapPtr pCmap);
  */
 
 #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
-# if defined(XCSECURITY)  
 Bool
 winGenerateAuthorization (void);
-# endif
+void winSetAuthorization(void);
 #endif
 
 
diff --git a/hw/xwin/winauth.c b/hw/xwin/winauth.c
index b57a35a..fcd1872 100644
--- a/hw/xwin/winauth.c
+++ b/hw/xwin/winauth.c
@@ -1,7 +1,3 @@
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#if defined(XCSECURITY)
 /*
  *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
  *
@@ -32,12 +28,14 @@
  * Authors:	Harold L Hunt II
  */
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
 #include "win.h"
 
 /* Includes for authorization */
-#include <X11/Xauth.h>
 #include "securitysrv.h"
-#include <X11/extensions/securstr.h>
 
 
 /*
@@ -48,13 +46,76 @@
 
 
 /*
- * Globals
+ * Locals
+ */
+
+static XID g_authId = 0;
+static unsigned int g_uiAuthDataLen = 0;
+static char *g_pAuthData = NULL;
+
+/*
+ * Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY
  */
 
-XID		g_authId = 0;
-unsigned int	g_uiAuthDataLen = 0;
-char		*g_pAuthData = NULL;
+#ifndef XCSECURITY
+static
+void
+GenerateRandomData (int len, char *buf)
+{
+    int fd;
+
+    fd = open("/dev/urandom", O_RDONLY);
+    read(fd, buf, len);
+    close(fd);
+}
+
+
+static char cookie[16]; /* 128 bits */
+
+XID
+static MitGenerateCookie (
+    unsigned	data_length,
+    char	*data,
+    XID		id,
+    unsigned	*data_length_return,
+    char	**data_return)
+{
+    int i = 0;
+    int status;
+
+    while (data_length--)
+    {
+	cookie[i++] += *data++;
+	if (i >= sizeof (cookie)) i = 0;
+    }
+    GenerateRandomData(sizeof (cookie), cookie);
+    status = MitAddCookie(sizeof (cookie), cookie, id);
+    if (!status)
+    {
+	id = -1;
+    }
+    else
+    {
+	*data_return = cookie;
+	*data_length_return = sizeof (cookie);
+    }
+    return id;
+}
 
+static
+XID
+GenerateAuthorization(
+	unsigned name_length,
+	char	*name,
+	unsigned data_length,
+	char	*data,
+	unsigned *data_length_return,
+	char	**data_return)
+{
+    return MitGenerateCookie(data_length, data,
+                             FakeClientID(0), data_length_return, data_return);
+}
+#endif
 
 /*
  * Generate authorization cookie for internal server clients
@@ -78,15 +139,15 @@ winGenerateAuthorization ()
       ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n");
       goto auth_bailout;
     }
-#if 0
+
   else
     {
-      ErrorF ("winGenerateAuthorization - GenerateAuthorization success!\n"
+      winDebug("winGenerateAuthorization - GenerateAuthorization success!\n"
 	      "AuthDataLen: %d AuthData: %s\n",
 	      g_uiAuthDataLen, g_pAuthData);
     }
-#endif
-  
+
+#ifdef XCSECURITY
   /* Allocate structure for additional auth information */
   pAuth = (SecurityAuthorizationPtr) 
     xalloc (sizeof (SecurityAuthorizationRec));
@@ -119,7 +180,8 @@ winGenerateAuthorization ()
   
   /* Don't free the auth data, since it is still used internally */
   pAuth = NULL;
-  
+#endif
+
   return TRUE;
 
  auth_bailout:
@@ -128,4 +190,13 @@ winGenerateAuthorization ()
   
   return FALSE;
 }
-#endif
+
+/* Use our generated cookie for authentication */
+void
+winSetAuthorization(void)
+{
+  XSetAuthorization (AUTH_NAME,
+		     strlen (AUTH_NAME),
+		     g_pAuthData,
+		     g_uiAuthDataLen);
+}
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 8eb825f..e5b2dc1 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -38,27 +38,15 @@
 #ifdef __CYGWIN__
 #include <errno.h>
 #endif
-#include "X11/Xauth.h"
 #include "misc.h"
 
 
 /*
- * Constants
- */
-
-#define AUTH_NAME	"MIT-MAGIC-COOKIE-1"
-
-
-/*
  * References to external symbols
  */
 
 extern Bool		g_fUnicodeClipboard;
 extern unsigned long	serverGeneration;
-#if defined(XCSECURITY)
-extern unsigned int	g_uiAuthDataLen;
-extern char		*g_pAuthData;
-#endif
 extern Bool		g_fClipboardStarted;
 extern HWND		g_hwndClipboard;
 extern void		*g_pClipboardDisplay;
@@ -154,13 +142,8 @@ winClipboardProc (void *pvNotUsed)
       pthread_exit (NULL);
     }
 
-#if defined(XCSECURITY)
   /* Use our generated cookie for authentication */
-  XSetAuthorization (AUTH_NAME,
-		     strlen (AUTH_NAME),
-		     g_pAuthData,
-		     g_uiAuthDataLen);
-#endif
+  winSetAuthorization();
 
   /* Set error handler */
   XSetErrorHandler (winClipboardErrorHandler);
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 7cdac0c..27f5e32 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -90,8 +90,6 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
 #endif
 #define WIN_JMP_OKAY		0
 #define WIN_JMP_ERROR_IO	2
-#define AUTH_NAME		"MIT-MAGIC-COOKIE-1"
-
 
 /*
  * Local structures
@@ -140,11 +138,6 @@ typedef struct _XMsgProcArgRec {
 
 extern char *display;
 extern void ErrorF (const char* /*f*/, ...);
-#if defined(XCSECURITY)
-extern unsigned int	g_uiAuthDataLen;
-extern char		*g_pAuthData;
-#endif
-
 
 /*
  * Prototypes for local functions
@@ -948,6 +941,9 @@ winMultiWindowXMsgProc (void *pArg)
 
   /* Print the display connection string */
   ErrorF ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
+
+  /* Use our generated cookie for authentication */
+  winSetAuthorization();
   
   /* Initialize retry count */
   iRetries = 0;
@@ -1323,14 +1319,9 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
   /* Print the display connection string */
   ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
 
-#if defined(XCSECURITY)
   /* Use our generated cookie for authentication */
-  XSetAuthorization (AUTH_NAME,
-		     strlen (AUTH_NAME),
-		     g_pAuthData,
-		     g_uiAuthDataLen);
-#endif
-  
+  winSetAuthorization();
+
   /* Open the X display */
   do
     {
commit 72f81f4e449defb0654e9bdb2c9ec014475a3977
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Fri Nov 6 17:46:58 2009 +0000

    Xming: Make -auth option work in with -multiwindow
    
    Use an internally generated cookie for authentication of the internal
    window manager client when using the -auth option in -multiwindow mode.
    
    Copyright (C) Colin Harrison 2005-2008
    http://www.straightrunning.com/XmingNotes/
    http://sourceforge.net/projects/xming/
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 9aff336..45dccce 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -1,6 +1,7 @@
 /*
 
 Copyright 1993, 1998  The Open Group
+Copyright (C) Colin Harrison 2005-2008
 
 Permission to use, copy, modify, distribute, and sell this software and its
 documentation for any purpose is hereby granted without fee, provided that
@@ -73,6 +74,7 @@ extern int			g_iLogVerbose;
 Bool				g_fLogInited;
 
 extern Bool			g_fXdmcpEnabled;
+extern Bool			g_fAuthEnabled;
 #ifdef HAS_DEVWINDOWS
 extern int			g_fdMessageQueue;
 #endif
@@ -1022,7 +1024,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
 
 #if defined(XCSECURITY)
   /* Generate a cookie used by internal clients for authorization */
-  if (g_fXdmcpEnabled)
+  if (g_fXdmcpEnabled || g_fAuthEnabled)
     winGenerateAuthorization ();
 #endif
 
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 3eb6091..57b3bf3 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -1,5 +1,6 @@
 /*
  *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
  *
  *Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
  *from Harold L Hunt II.
  *
  * Authors:	Harold L Hunt II
+ *              Colin Harrison
  */
 
 #ifdef HAVE_XWIN_CONFIG_H
@@ -63,6 +65,7 @@ HWND		g_hDlgExit = NULL;
 HWND		g_hDlgAbout = NULL;
 const char *	g_pszQueryHost = NULL;
 Bool		g_fXdmcpEnabled = FALSE;
+Bool           g_fAuthEnabled = FALSE;
 HICON		g_hIconX = NULL;
 HICON		g_hSmallIconX = NULL;
 #ifndef RELOCATE_PROJECTROOT
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 8fb80f4..7cdac0c 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -90,6 +90,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
 #endif
 #define WIN_JMP_OKAY		0
 #define WIN_JMP_ERROR_IO	2
+#define AUTH_NAME		"MIT-MAGIC-COOKIE-1"
 
 
 /*
@@ -139,6 +140,10 @@ typedef struct _XMsgProcArgRec {
 
 extern char *display;
 extern void ErrorF (const char* /*f*/, ...);
+#if defined(XCSECURITY)
+extern unsigned int	g_uiAuthDataLen;
+extern char		*g_pAuthData;
+#endif
 
 
 /*
@@ -1317,6 +1322,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
 
   /* Print the display connection string */
   ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+
+#if defined(XCSECURITY)
+  /* Use our generated cookie for authentication */
+  XSetAuthorization (AUTH_NAME,
+		     strlen (AUTH_NAME),
+		     g_pAuthData,
+		     g_uiAuthDataLen);
+#endif
   
   /* Open the X display */
   do
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 56af643..3732ecb 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1,6 +1,7 @@
 /*
 
 Copyright 1993, 1998  The Open Group
+Copyright (C) Colin Harrison 2005-2008
 
 Permission to use, copy, modify, distribute, and sell this software and its
 documentation for any purpose is hereby granted without fee, provided that
@@ -57,6 +58,7 @@ extern char *			g_pszLogFile;
 extern Bool			g_fLogFileChanged;
 #endif
 extern Bool			g_fXdmcpEnabled;
+extern Bool			g_fAuthEnabled;
 extern char *			g_pszCommandLine;
 extern Bool			g_fKeyboardHookLL;
 extern Bool			g_fNoHelpMessageBox;                     
@@ -1289,6 +1291,15 @@ ddxProcessArgument (int argc, char *argv[], int i)
     }
 
   /*
+   * Look for the '-auth' argument
+   */
+  if (IS_OPTION ("-auth"))
+    {
+      g_fAuthEnabled = TRUE;
+      return 0; /* Let DIX parse this again */
+    }
+
+  /*
    * Look for the '-indirect' or '-broadcast' arguments
    */
   if (IS_OPTION ("-indirect")
commit 6dbf8f27c885ea3a761548183fb00ba3df2df553
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Tue Jul 21 01:15:25 2009 +0100

    Xming: Tidy up code for initial native window positioning
    
    Tidy up code for initial native window positioning and avoid a
    duplicate call to winMultiWindowGetTransientFor()
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 447c99b..8b91296 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -512,21 +512,10 @@ winCreateWindowsWindow (WindowPtr pWin)
   iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
   iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
 
-  /* Default positions if none specified */
-  if (!winMultiWindowGetWMNormalHints(pWin, &hints))
-    hints.flags = 0;
-  if ( !(hints.flags & (USPosition|PPosition)) &&
-       !winMultiWindowGetTransientFor (pWin, NULL) &&
-       !pWin->overrideRedirect )
-    {
-      iX = CW_USEDEFAULT;
-      iY = CW_USEDEFAULT;
-    }
-
   iWidth = pWin->drawable.width;
   iHeight = pWin->drawable.height;
 
-    if (winMultiWindowGetTransientFor (pWin, &pDaddy))
+  if (winMultiWindowGetTransientFor (pWin, &pDaddy))
     {
       if (pDaddy)
       {
@@ -534,6 +523,18 @@ winCreateWindowsWindow (WindowPtr pWin)
         if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL;
       }
     }
+  else
+    {
+      /* Default positions if none specified */
+      if (!winMultiWindowGetWMNormalHints(pWin, &hints))
+        hints.flags = 0;
+      if (!(hints.flags & (USPosition|PPosition)) &&
+          !pWin->overrideRedirect)
+      {
+        iX = CW_USEDEFAULT;
+        iY = CW_USEDEFAULT;
+      }
+    }
 
   /* Create the window */
   /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
commit 28eb61fc04811bb9bbb523e0a252933313bb16ce
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Nov 1 18:19:14 2009 +0000

    Avoid a null dereference if IFF_BROADCAST is set but there is no broadcast address
    
    It seems that the getifaddrs() function can return interfaces with
    IFF_BROADCAST & IFF_UP set, but no broadcast address (at least
    under Cygwin 1.7, this seems to happen for v6 mapped v4 addresses)
    
    Avoid a null dereference if this ever happens
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/os/access.c b/os/access.c
index 8c5b50a..2a171fa 100644
--- a/os/access.c
+++ b/os/access.c
@@ -811,7 +811,8 @@ DefineSelf (int fd)
 		continue;
 #endif
 	    if ((ifr->ifa_flags & IFF_BROADCAST) &&
-		(ifr->ifa_flags & IFF_UP))
+		(ifr->ifa_flags & IFF_UP) &&
+                ifr->ifa_broadaddr)
 		broad_addr = *ifr->ifa_broadaddr;
 	    else
 		continue;
commit 091cbbaed7aafab6f9839a40fe977ab067d1ace1
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Mon Oct 12 13:40:11 2009 +0100

    Xming: Fix UT8String and CompoundText clipboard text sharing with windows clipboard
    
    XConvertSelection() in libX11 always returns 1, so there is no point in
    testing it incorrectly against Success. This is possibly a bug in
    XConvertSelection()
    
    This should fix UTF8String and CompoundText selection via the clipboard.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index fee50f6..ae8262e 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -492,20 +492,12 @@ winClipboardFlushXEvents (HWND hwnd,
 		  winDebug("winClipboardFlushXEvents - SelectionNotify - "
                            "Requesting conversion of UTF8 target.\n");
 
-		  iReturn = XConvertSelection (pDisplay,
-					       event.xselection.selection,
-					       XA_STRING,
-					       atomLocalProperty,
-					       iWindow,
-					       CurrentTime);
-		  if (iReturn != Success)
-		    {
-		      ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
-			      "XConvertSelection () failed for UTF8String, "
-			      "aborting: %d\n",
-			      iReturn);
-		      break;
-		    }
+		  XConvertSelection (pDisplay,
+				     event.xselection.selection,
+				     XA_STRING,
+				     atomLocalProperty,
+				     iWindow,
+				     CurrentTime);
 
 		  /* Process the ConvertSelection event */
 		  XFlush (pDisplay);
@@ -517,20 +509,12 @@ winClipboardFlushXEvents (HWND hwnd,
 		  winDebug("winClipboardFlushXEvents - SelectionNotify - "
                            "Requesting conversion of CompoundText target.\n");
 
-		  iReturn = XConvertSelection (pDisplay,
-					       event.xselection.selection,
-					       atomUTF8String,
-					       atomLocalProperty,
-					       iWindow,
-					       CurrentTime);
-		  if (iReturn != Success)
-		    {
-		      ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
-			      "XConvertSelection () failed for CompoundText, "
-			      "aborting: %d\n",
-			      iReturn);
-		      break;
-		    }
+		  XConvertSelection (pDisplay,
+				     event.xselection.selection,
+				     atomUTF8String,
+				     atomLocalProperty,
+				     iWindow,
+				     CurrentTime);
 
 		  /* Process the ConvertSelection event */
 		  XFlush (pDisplay);
commit 9657eae5d65eff289089afc46dfb629758ebbdf7
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Nov 1 18:18:51 2009 +0000

    Cygwin/X: Clearly diagnose a timeout while waiting for SelectionNotify event
    
    Clearly diagnose a timeout while waiting for SelectionNotify event
    in the clipboard integration internal client.
    (which seems to be behind some of the reported failures)
    
    Turn useless #if 0/ErrorF()/#endif into useful winDebug()
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winclipboardtextconv.c b/hw/xwin/winclipboardtextconv.c
index fd2e696..400f560 100644
--- a/hw/xwin/winclipboardtextconv.c
+++ b/hw/xwin/winclipboardtextconv.c
@@ -84,9 +84,7 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength)
   unsigned char		*pszEnd = pszSrc + iLength;
   unsigned char		*pszDest = NULL, *pszDestBegin = NULL;
 
-#if 0
-  ErrorF ("UNIXtoDOS () - Original data:\n%s\n", *ppszData);
-#endif
+  winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
 
   /* Count \n characters without leading \r */
   while (pszSrc < pszEnd)
@@ -153,7 +151,5 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength)
   free (*ppszData);
   *ppszData = pszDestBegin;
 
-#if 0
-  ErrorF ("UNIXtoDOS () - Final string:\n%s\n", pszDestBegin);
-#endif
+  winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin);
 }
diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c
index 292ca87..9394b04 100644
--- a/hw/xwin/winclipboardwndproc.c
+++ b/hw/xwin/winclipboardwndproc.c
@@ -104,13 +104,13 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
       if (tv.tv_sec < 0)
 	return WIN_XEVENTS_SUCCESS;
 
-      /* Wait for a Windows event or an X event */
+      /* Wait for an X event */
       iReturn = select (iConnNumber + 1,/* Highest fds number */
 			&fdsRead,	/* Read mask */
 			NULL,		/* No write mask */
 			NULL,		/* No exception mask */
 			&tv);		/* No timeout */
-      if (iReturn <= 0)
+      if (iReturn < 0)
 	{
 	  ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d.  "
 		  "Bailing.\n", iReturn);
@@ -440,9 +440,9 @@ winClipboardWindowProc (HWND hwnd, UINT message,
        * follow this message and reassert ownership of the X11
        * selections, handling the issue for us.
        */
+      winDebug ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n");
       return 0;
 
-
     case WM_RENDERFORMAT:
     case WM_RENDERALLFORMATS:
       {
@@ -536,6 +536,8 @@ winClipboardWindowProc (HWND hwnd, UINT message,
 	    if (g_fUnicodeSupport)
 	      SetClipboardData (CF_UNICODETEXT, NULL);
 	    SetClipboardData (CF_TEXT, NULL);
+
+            ErrorF("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n");
 	  }
 
 	/* BPS - Post ourselves a user message whose handler will reset the
diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c
index c68d78a..658d050 100755
--- a/hw/xwin/winclipboardwrappers.c
+++ b/hw/xwin/winclipboardwrappers.c
@@ -324,9 +324,7 @@ winProcSetSelectionOwner (ClientPtr client)
   
   REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
 
-#if 0
-  ErrorF ("winProcSetSelectionOwner - Hello.\n");
-#endif
+  winDebug("winProcSetSelectionOwner - Hello.\n");
 
   /* Watch for server reset */
   if (s_ulServerGeneration != serverGeneration)
@@ -369,10 +367,8 @@ winProcSetSelectionOwner (ClientPtr client)
 	{
 	  fOwnedToNotOwned = TRUE;
 
-#if 0
-	  ErrorF ("winProcSetSelectionOwner - PRIMARY - Going from "
+	  winDebug("winProcSetSelectionOwner - PRIMARY - Going from "
 		  "owned to not owned.\n");
-#endif
 
 	  /* Adjust last owned selection */
 	  if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
@@ -384,10 +380,8 @@ winProcSetSelectionOwner (ClientPtr client)
       /* Save new selection owner or None */
       s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
 
-#if 0
-      ErrorF ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
+      winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
 	      stuff->window);
-#endif
     }
   else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
     {
@@ -396,11 +390,9 @@ winProcSetSelectionOwner (ClientPtr client)
 	  && None != s_iOwners[CLIP_OWN_CLIPBOARD])
 	{
 	  fOwnedToNotOwned = TRUE;
-	  
-#if 0
-	  ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Going from "
-		  "owned to not owned.\n");
-#endif
+
+	  winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from "
+                   "owned to not owned.\n");
 
 	  /* Adjust last owned selection */
 	  if (None != s_iOwners[CLIP_OWN_PRIMARY])
@@ -412,10 +404,9 @@ winProcSetSelectionOwner (ClientPtr client)
       /* Save new selection owner or None */
       s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
 
-#if 0
-      ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
-	      stuff->window);
-#endif
+      winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
+               stuff->window);
+
     }
   else
     goto winProcSetSelectionOwner_Done;
@@ -444,13 +435,11 @@ winProcSetSelectionOwner (ClientPtr client)
       && g_hwndClipboard != NULL
       && g_hwndClipboard == GetClipboardOwner ())
     {
-#if 0
-      ErrorF ("winProcSetSelectionOwner - We currently own the "
-	      "clipboard and neither the PRIMARY nor the CLIPBOARD "
-	      "selections are owned, releasing ownership of Win32 "
-	      "clipboard.\n");
-#endif
-      
+      winDebug("winProcSetSelectionOwner - We currently own the "
+               "clipboard and neither the PRIMARY nor the CLIPBOARD "
+               "selections are owned, releasing ownership of Win32 "
+               "clipboard.\n");
+
       /* Release ownership of the Windows clipboard */
       OpenClipboard (NULL);
       EmptyClipboard ();
@@ -462,9 +451,7 @@ winProcSetSelectionOwner (ClientPtr client)
   /* Abort if no window at this point */
   if (None == stuff->window)
     {
-#if 0
-      ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
-#endif
+      winDebug("winProcSetSelectionOwner - No window, returning.\n");
       goto winProcSetSelectionOwner_Done;
     }
 
@@ -481,10 +468,8 @@ winProcSetSelectionOwner (ClientPtr client)
   /* Abort if clipboard manager is owning the selection */
   if (pDrawable->id == g_iClipboardWindow)
     {
-#if 0
-      ErrorF ("winProcSetSelectionOwner - We changed ownership, "
-	      "aborting.\n");
-#endif
+      winDebug("winProcSetSelectionOwner - We changed ownership, "
+               "aborting.\n");
       goto winProcSetSelectionOwner_Done;
     }
 
diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index ec40814..fee50f6 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -105,20 +105,17 @@ winClipboardFlushXEvents (HWND hwnd,
 	   */
 
 	case SelectionRequest:
-#if 0
 	  {
 	    char			*pszAtomName = NULL;
-	    
-	    ErrorF ("SelectionRequest - target %d\n",
-		    event.xselectionrequest.target);
-	    
+	    winDebug("SelectionRequest - target %d\n",
+                     event.xselectionrequest.target);
+
 	    pszAtomName = XGetAtomName (pDisplay,
 					event.xselectionrequest.target);
-	    ErrorF ("SelectionRequest - Target atom name %s\n", pszAtomName);
+	    winDebug("SelectionRequest - Target atom name %s\n", pszAtomName);
 	    XFree (pszAtomName);
 	    pszAtomName = NULL;
 	  }
-#endif
 
 	  /* Abort if invalid target type */
 	  if (event.xselectionrequest.target != XA_STRING
@@ -466,21 +463,17 @@ winClipboardFlushXEvents (HWND hwnd,
 	   */ 
 
 	case SelectionNotify:
-#if 0
-	  ErrorF ("winClipboardFlushXEvents - SelectionNotify\n");
+
+	  winDebug ("winClipboardFlushXEvents - SelectionNotify\n");
 	  {
 	    char		*pszAtomName;
-	    
 	    pszAtomName = XGetAtomName (pDisplay,
 					event.xselection.selection);
 
-	    ErrorF ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
-		    pszAtomName);
-	    
+	    winDebug("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
+                     pszAtomName);
 	    XFree (pszAtomName);
 	  }
-#endif
-
 
 	  /*
 	   * Request conversion of UTF8 and CompoundText targets.
@@ -489,18 +482,16 @@ winClipboardFlushXEvents (HWND hwnd,
 	    {
 	      if (event.xselection.target == XA_STRING)
 		{
-#if 0
-		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
-			  "XA_STRING\n");
-#endif
+		  winDebug ("winClipboardFlushXEvents - SelectionNotify - "
+                            "XA_STRING\n");
+
 		  return WIN_XEVENTS_CONVERT;
 		}
 	      else if (event.xselection.target == atomUTF8String)
 		{
-#if 0
-		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
-			  "Requesting conversion of UTF8 target.\n");
-#endif
+		  winDebug("winClipboardFlushXEvents - SelectionNotify - "
+                           "Requesting conversion of UTF8 target.\n");
+
 		  iReturn = XConvertSelection (pDisplay,
 					       event.xselection.selection,
 					       XA_STRING,
@@ -523,10 +514,9 @@ winClipboardFlushXEvents (HWND hwnd,
 #ifdef X_HAVE_UTF8_STRING
 	      else if (event.xselection.target == atomCompoundText)
 		{
-#if 0
-		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
-			  "Requesting conversion of CompoundText target.\n");
-#endif
+		  winDebug("winClipboardFlushXEvents - SelectionNotify - "
+                           "Requesting conversion of CompoundText target.\n");
+
 		  iReturn = XConvertSelection (pDisplay,
 					       event.xselection.selection,
 					       atomUTF8String,
@@ -577,10 +567,8 @@ winClipboardFlushXEvents (HWND hwnd,
 	      break;
 	    }
 
-#if 0
-	  ErrorF ("SelectionNotify - returned data %d left %d\n",
-		  xtpText.nitems, ulReturnBytesLeft);
-#endif
+	  winDebug("SelectionNotify - returned data %d left %d\n",
+                   xtpText.nitems, ulReturnBytesLeft);
 
 	  /* Request the selection data */
 	  iReturn = XGetWindowProperty (pDisplay,
@@ -603,19 +591,16 @@ winClipboardFlushXEvents (HWND hwnd,
 	      break;
 	    }
 
-#if 0
 	    {
 	      char		*pszAtomName = NULL;
 
-	      ErrorF ("SelectionNotify - returned data %d left %d\n",
-		      xtpText.nitems, ulReturnBytesLeft);
-	      
+	      winDebug("SelectionNotify - returned data %d left %d\n",
+                       xtpText.nitems, ulReturnBytesLeft);
 	      pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
-	      ErrorF ("Notify atom name %s\n", pszAtomName);
+	      winDebug("Notify atom name %s\n", pszAtomName);
 	      XFree (pszAtomName);
 	      pszAtomName = NULL;
 	    }
-#endif
 
 	  if (fUseUnicode)
 	    {
@@ -816,7 +801,15 @@ winClipboardFlushXEvents (HWND hwnd,
 	    SetClipboardData (CF_TEXT, NULL);
 	  return WIN_XEVENTS_NOTIFY;
 
+        case SelectionClear:
+          winDebug("SelectionClear - doing nothing\n");
+          break;
+
+	case PropertyNotify:
+	  break;
+
 	default:
+          ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type);
 	  break;
 	}
     }
commit 062f49a8e0d1afb4dd32e9451a47ab2792639e7f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Nov 4 17:36:54 2009 +0000

    Cygwin/X: Add a workaround for a SWT/Motif bug to internal window manager
    
    SWT/Motif expects all top-level windows to get reparented, and waits until they
    do. So workaround that in our internal WM by forcing a reparent event to
    occur, even though we don't actually need to reparent the window to
    frame it (as the frame is a native window, not an X window)
    
    http://sourceware.org/bugzilla/show_bug.cgi?id=9848
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=36806
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index d7f13c7..8fb80f4 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1061,6 +1061,60 @@ winMultiWindowXMsgProc (void *pArg)
 				  event.xcreatewindow.window,
 				  0);
 	}
+      else if (event.type == MapNotify)
+        {
+          /* Fake a reparentNotify event as SWT/Motif expects a
+             Window Manager to reparent a top-level window when
+             it is mapped and waits until they do.
+
+             We don't actually need to reparent, as the frame is
+             a native window, not an X window
+
+             We do this on MapNotify, not MapRequest like a real
+             Window Manager would, so we don't have do get involved
+             in actually mapping the window via it's (non-existent)
+             parent...
+
+             See sourceware bugzilla #9848
+          */
+
+          XWindowAttributes attr;
+          Window root;
+          Window parent;
+          Window *children;
+          unsigned int nchildren;
+
+          if (XGetWindowAttributes(event.xmap.display,
+                                   event.xmap.window,
+                                   &attr) &&
+              XQueryTree(event.xmap.display,
+                         event.xmap.window,
+                         &root, &parent, &children, &nchildren))
+            {
+              if (children) XFree(children);
+
+              /*
+                It's a top-level window if the parent window is a root window
+                Only non-override_redirect windows can get reparented
+              */
+              if ((attr.root == parent) && !event.xmap.override_redirect)
+                {
+                  XEvent event_send;
+
+                  event_send.type = ReparentNotify;
+                  event_send.xreparent.event = event.xmap.window;
+                  event_send.xreparent.window = event.xmap.window;
+                  event_send.xreparent.parent = parent;
+                  event_send.xreparent.x = attr.x;
+                  event_send.xreparent.y = attr.y;
+
+                  XSendEvent(event.xmap.display,
+                             event.xmap.window,
+                             True, StructureNotifyMask,
+                             &event_send);
+                }
+            }
+        }
       else if (event.type == PropertyNotify
 	       && event.xproperty.atom == atmWmName)
 	{
commit 71519a572fe15b85c0eb2b02636c9e871f2c858f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Nov 4 17:34:40 2009 +0000

    Cygwin/X: Fix typo in g_fAnotherWMRunning and tidy up WM detection code
    
    Tidy up code for detecting another WM is already running
    Fix typo g_fAnotherWMRunnig -> g_fAnotherWMRunning
    Remove some unused event mask macros
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 631f1a9..447c99b 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -64,18 +64,6 @@ winUpdateWindowsWindow (WindowPtr pWin);
 static void
 winFindWindow (pointer value, XID id, pointer cdata);
 
-/*
- * Macros
- */
-
-#define SubSend(pWin) \
-    ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
-
-#define StrSend(pWin) \
-    ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
-
-#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
-
 static
 void winInitMultiWindowClass(void)
 {
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 18d9aed..d7f13c7 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -209,7 +209,7 @@ static jmp_buf			g_jmpWMEntry;
 static jmp_buf			g_jmpXMsgProcEntry;
 static Bool			g_shutdown = FALSE;
 static Bool			redirectError = FALSE;
-static Bool			g_fAnotherWMRunnig = FALSE;
+static Bool			g_fAnotherWMRunning = FALSE;
 
 /*
  * PushMessage - Push a message onto the queue
@@ -651,7 +651,7 @@ winMultiWindowWMProc (void *pArg)
     {
       WMMsgNodePtr	pNode;
 
-      if(g_fAnotherWMRunnig)/* Another Window manager exists. */
+      if(g_fAnotherWMRunning)/* Another Window manager exists. */
 	{
 	  Sleep (1000);
 	  continue;
@@ -978,26 +978,15 @@ winMultiWindowXMsgProc (void *pArg)
 	  "successfully opened the display.\n");
 
   /* Check if another window manager is already running */
-  if (pProcArg->pWMInfo->fAllowOtherWM)
-  {
-    g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
-  } else {
-    redirectError = FALSE;
-    XSetErrorHandler (winRedirectErrorHandler); 	 
-    XSelectInput(pProcArg->pDisplay, 	 
-        RootWindow (pProcArg->pDisplay, pProcArg->dwScreen), 	 
-        SubstructureNotifyMask | ButtonPressMask); 	 
-    XSync (pProcArg->pDisplay, 0); 	 
-    XSetErrorHandler (winMultiWindowXMsgProcErrorHandler); 	 
-    if (redirectError) 	 
-    { 	 
-      ErrorF ("winMultiWindowXMsgProc - " 	 
-          "another window manager is running.  Exiting.\n"); 	 
-      pthread_exit (NULL); 	 
+  g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+
+  if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM)
+    {
+      ErrorF ("winMultiWindowXMsgProc - "
+          "another window manager is running.  Exiting.\n");
+      pthread_exit (NULL);
     }
-    g_fAnotherWMRunnig = FALSE;
-  }
-  
+
   /* Set up the supported icon sizes */
   xis = XAllocIconSize ();
   if (xis)
@@ -1032,17 +1021,17 @@ winMultiWindowXMsgProc (void *pArg)
 	{
 	  if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
 	    {
-	      if (!g_fAnotherWMRunnig)
+	      if (!g_fAnotherWMRunning)
 		{
-		  g_fAnotherWMRunnig = TRUE;
+		  g_fAnotherWMRunning = TRUE;
 		  SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
 		}
 	    }
 	  else
 	    {
-	      if (g_fAnotherWMRunnig)
+	      if (g_fAnotherWMRunning)
 		{
-		  g_fAnotherWMRunnig = FALSE;
+		  g_fAnotherWMRunning = FALSE;
 		  SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0);
 		}
 	    }
@@ -1454,27 +1443,23 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
 static Bool
 CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
 {
+  /*
+    Try to select the events which only one client at a time is allowed to select.
+    If this causes an error, another window manager is already running...
+   */
   redirectError = FALSE;
   XSetErrorHandler (winRedirectErrorHandler);
   XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
-	       // SubstructureNotifyMask | ButtonPressMask
-	       ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
-	       SubstructureRedirectMask | KeyPressMask |
-	       ButtonPressMask | ButtonReleaseMask);
+               ResizeRedirectMask | SubstructureRedirectMask | ButtonPressMask);
   XSync (pDisplay, 0);
   XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
-  XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
-	       SubstructureNotifyMask);
+
+  /*
+    Side effect: select the events we are actually interested in...
+  */
+  XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), SubstructureNotifyMask);
   XSync (pDisplay, 0);
-  if (redirectError)
-    {
-      //ErrorF ("CheckAnotherWindowManager() - another window manager is running.  Exiting.\n");
-      return TRUE;
-    }
-  else
-    {
-      return FALSE;
-    }
+  return redirectError;
 }
 
 /*
commit f3fad371cce0f3836514ad5b29e59fa1ca0627a7
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Wed Nov 4 15:33:53 2009 +0000

    Xming: Add FORCEEXIT option to configuration file
    
    Add a new option to configuration file: FORCEEXIT, like SILENTEXIT
    but ignores the client count. Unsaved client work may be lost with
    this option but it is useful if you want no dialogs.
    
    Add description of this new keyword to XWinrc man page
    
    Also fix grammar of the exit confirmation dialog warning to be correct
    when there is only one(1) client connected.
    
    Also rearrange yacc tokens to one per line to make future merges
    easier
    
    Also amend default system.XWinrc so that SILENTEXIT is on by default
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/XWinrc.man.pre b/hw/xwin/XWinrc.man.pre
index 4fb436d..5c1fb97 100755
--- a/hw/xwin/XWinrc.man.pre
+++ b/hw/xwin/XWinrc.man.pre
@@ -65,8 +65,13 @@ system tray area.
 .TP 8
 .B SILENTEXIT
 The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the
-exit confirmation dialog.
+exit confirmation dialog if no clients are connected.
 
+.TP 8
+.B FORCEEXIT
+The \fBFORCEEXIT\fP keyword, which takes no parameters, disables the
+exit confirmation dialog always.  Unsaved client work may be lost but
+this may be useful if you want no dialogs.
 
 .SH Menu instructions
 .TP 8
diff --git a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
index d9c2d42..1de6e2a 100644
--- a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
+++ b/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
@@ -119,7 +119,7 @@ SysMenu {
 # 	"xterm"	"uninstall.ico"
 # }
 
-# SilentExit
+SilentExit
 
 DEBUG "Done parsing the configuration file..."
 
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 31a3766..582b865 100755
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -282,8 +282,9 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
   if (liveClients < 0)
     liveClients = 0;      
 
-  /* Don't show the exit confirmation dialog if SilentExit is enabled */
-  if (pref.fSilentExit && liveClients <= 0)
+  /* Don't show the exit confirmation dialog if SilentExit & no clients,
+     or ForceExit, is enabled */
+  if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit)
     {
       if (g_hDlgExit != NULL)
 	{
@@ -326,7 +327,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
 	       GetDlgItem (g_hDlgExit, IDCANCEL), TRUE);
 }
 
-#define CONNECTED_CLIENTS_FORMAT	"There are currently %d clients connected."
+#define CONNECTED_CLIENTS_FORMAT	"There %s currently %d client%s connected."
 
 
 /*
@@ -353,7 +354,9 @@ winExitDlgProc (HWND hDialog, UINT message,
 
 	/* Format the connected clients string */
 	pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT,
-            s_pScreenPriv->iConnectedClients);
+           (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are",
+            s_pScreenPriv->iConnectedClients,
+           (s_pScreenPriv->iConnectedClients == 1) ? "" : "s");
 	if (!pszConnectedClients)
 	    return TRUE;
      
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 6d641da..4daf474 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -143,6 +143,9 @@ typedef struct WINPREFS
   STYLEITEM *style;
   int styleItems;
 
+  /* Force exit flag */
+  Bool fForceExit;
+
   /* Silent exit flag */
   Bool fSilentExit;
 
diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 0c27751..73f1659 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -92,10 +92,34 @@ extern int yylex(void);
   int iVal;
 }
 
-%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS STYLES
-%token TOPMOST MAXIMIZE MINIMIZE BOTTOM NOTITLE OUTLINE NOFRAME DEFAULTSYSMENU
-%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
-%token RELOAD TRAYICON SILENTEXIT
+%token NEWLINE
+%token MENU
+%token LB
+%token RB
+%token ICONDIRECTORY
+%token DEFAULTICON
+%token ICONS
+%token STYLES
+%token TOPMOST
+%token MAXIMIZE
+%token MINIMIZE
+%token BOTTOM
+%token NOTITLE
+%token OUTLINE
+%token NOFRAME
+%token DEFAULTSYSMENU
+%token SYSMENU
+%token ROOTMENU
+%token SEPARATOR
+%token ATSTART
+%token ATEND
+%token EXEC
+%token ALWAYSONTOP
+%token DEBUG
+%token RELOAD
+%token TRAYICON
+%token FORCEEXIT
+%token SILENTEXIT
 
 %token <sVal> STRING
 %type <uVal>  group1
@@ -128,6 +152,7 @@ command:	defaulticon
 	| defaultsysmenu
 	| debug
 	| trayicon
+	| forceexit
 	| silentexit
 	;
 
@@ -212,6 +237,9 @@ sysmenulist:	sysmenuline
 sysmenu:	SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
 	;
 
+forceexit:	FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
+	;
+
 silentexit:	SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
 	;
 
commit 019a601de6a8ae083852c2d384c814dcc7aeeb72
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Wed Nov 4 15:16:03 2009 +0000

    Xming: Add mouse motion events with flag POINTER_SCREEN in winEnqueueMotion()
    
    Add mouse motion events with flag POINTER_SCREEN in winEnqueueMotion(), as
    they are in screen coordindates and may need to be scaled to the axis range
    appropriately
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 99eb6b8..342f20d 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -381,7 +381,7 @@ void winEnqueueMotion(int x, int y)
 
   GetEventList(&events);
   nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0,
-			     POINTER_ABSOLUTE, 0, 2, valuators);
+			     POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators);
 
   for (i = 0; i < nevents; i++)
     mieqEnqueue(g_pwinPointer, events[i].event);
commit 7af1240b57daa4ec55512276a9fda499d923eaa0
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Wed Nov 4 14:20:17 2009 +0000

    Xming: Replace all the uses of deprecated functions in hw/xwin with current ones
    
    Replace uses of LookupIDByType() and SecurityLookupIDByType()
    with dixLookupResourceByType()
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/wincmap.c b/hw/xwin/wincmap.c
index 7ebe002..9da0388 100644
--- a/hw/xwin/wincmap.c
+++ b/hw/xwin/wincmap.c
@@ -185,8 +185,8 @@ winUninstallColormap (ColormapPtr pmap)
   /* Install the default cmap in place of the cmap to be uninstalled */
   if (pmap->mid != pmap->pScreen->defColormap)
     {
-      curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
-					     RT_COLORMAP);
+      dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
+				RT_COLORMAP, NullClient, DixUnknownAccess);
       (*pmap->pScreen->InstallColormap) (curpmap);
     }
 }
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index 9f46a64..cb27d2f 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -462,7 +462,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
   winMultiWindowGetWMHints (pWin, &hints);
   if (!hints.icon_pixmap) return NULL;
 
-  iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP);
+  dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP,
+				NullClient, DixUnknownAccess);
   
   if (!iconPtr) return NULL;
 
@@ -484,7 +485,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
   mask = calloc (maskStride, iconSize);
   
   winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image);
-  maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP);
+  dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP,
+				NullClient, DixUnknownAccess);
 
   if (maskPtr) 
     {
@@ -542,7 +544,7 @@ winUpdateIcon (Window id)
   WindowPtr		pWin;
   HICON			hIcon, hIconSmall=NULL, hIconOld;
 
-  pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
+  dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
   if (pWin)
     {
       winWindowPriv(pWin);
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index e2b5ed2..631f1a9 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -810,7 +810,7 @@ winMinimizeWindow (Window id)
   ErrorF ("winMinimizeWindow\n");
 #endif
 
-  pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
+  dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
   if (!pWin) 
   { 
       ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); 
diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c
index 2b2f630..3a49ead 100755
--- a/hw/xwin/winwin32rootlesswindow.c
+++ b/hw/xwin/winwin32rootlesswindow.c
@@ -164,7 +164,7 @@ winMWExtWMUpdateIcon (Window id)
   WindowPtr		pWin;
   HICON			hIcon, hiconOld;
 
-  pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
+  dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess);
   hIcon = winOverrideIcon ((unsigned long)pWin);
 
   if (!hIcon)
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 5b164ea..3d4d8c2 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -148,7 +148,8 @@ WMFreeClient (pointer data, XID id)
   WMEventPtr   *pHead, pCur, pPrev;
 
   pEvent = (WMEventPtr) data;
-  pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType);
+  dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+				NullClient, DixUnknownAccess);
   if (pHead)
     {
       pPrev = 0;
@@ -193,8 +194,7 @@ ProcWindowsWMSelectInput (register ClientPtr client)
   XID			clientResource;
 
   REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
-  pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource,
-					       eventResourceType, DixWriteAccess);
+  dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, client, DixWriteAccess);
   if (stuff->mask != 0)
     {
       if (pHead)
@@ -294,7 +294,8 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
   ErrorF ("winWindowsWMSendEvent %d %d %d %d,  %d %d - %d %d\n",
 	  type, mask, which, arg, x, y, w, h);
 #endif
-  pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType);
+  dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType,
+				NullClient, DixUnknownAccess);
   if (!pHead)
     return;
   for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
commit 2a38f7c0dbc890e6408eee143d77719f265d583d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Jun 19 21:12:55 2009 +0100

    Cygwin/X: Remove a couple of extraneous '\n' in logged version info
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index f20598d..56af643 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1514,8 +1514,8 @@ winLogVersionInfo (void)
 
   ErrorF ("Welcome to the XWin X Server\n");
   ErrorF ("Vendor: %s\n", VENDOR_STRING);
-  ErrorF ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT);
-  ErrorF ("Contact: %s\n\n", VENDOR_CONTACT);
+  ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT);
+  ErrorF ("Contact: %s\n", VENDOR_CONTACT);
 }
 
 /*
commit 56658fc06cb773ed20ef1b23a3fe918c0d3b36bb
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Thu Oct 15 22:40:02 2009 -0500

    Set default font path with fontutil 1.1 and fontpath.d
    
    Look for $sysconfdir/X11/fontpath.d and, if it exists, set it to the
    default font path as a catalogue: entry. Based on app/xfs commit
    c66a46e35ae40a23ad9acee838ab42300eddbd67.
    
    Otherwise, use the font-util 1.1 macros to determine the system
    fontrootdir and standard subdirectories, or let the user configure it
    and the subdirectories themselves.
    
    This adds a build-time (or at least an autoconf/autogen time) dependency
    on font-util, and changes the --with-fontdir argument to --with-fontrootdir.
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith-xsfywfwIY+M at public.gmane.org>
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/configure.ac b/configure.ac
index fd2118a..077f7a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,9 @@ AM_MAINTAINER_MODE
 m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
 XORG_MACROS_VERSION(1.3)
 
+m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
+XORG_FONT_MACROS_VERSION(1.1)
+
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.
 AC_CONFIG_HEADERS(include/do-not-use-config.h)
@@ -488,13 +491,26 @@ AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name o
 AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
 				[ BUILDERSTRING="$withval" ]
 				[ ])
-AC_ARG_WITH(fontdir,         AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
-                                [ FONTDIR="$withval" ],
-                                [ FONTDIR="${libdir}/X11/fonts" ])
-DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
-case $host_os in
-	darwin*)    DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
-esac
+
+dnl Determine font path
+XORG_FONTROOTDIR
+XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
+XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
+XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
+XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
+XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
+XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
+
+dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
+dnl otherwise uses standard subdirectories of FONTROOTDIR
+AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
+	[DEFAULT_FONT_PATH='catalogue:$(sysconfdir)/X11/fontpath.d'],
+	[
+		DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
+		case $host_os in
+			darwin*)    DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
+		esac
+	])
 AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
 				[ FONTPATH="$withval" ],
 				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
@@ -1185,7 +1201,7 @@ fi
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
 AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
 AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
-AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
+AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
 AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
 AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
 AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])


More information about the Xquartz-changes mailing list