public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Ryan Pavlik <rpavlik@iastate.edu>
To: cygwin-xfree <cygwin-xfree@cygwin.com>
Subject: Re: Built XWin on mingw - with patches
Date: Fri, 04 Nov 2011 23:39:00 -0000	[thread overview]
Message-ID: <CABMFTE-7HAX5DhPT0abeNvgysFmOJU6a+DmAkRp3Ly4YnU4CFw@mail.gmail.com> (raw)
In-Reply-To: <4EB2E8FE.6020305@dronecode.org.uk>

[-- Attachment #1: Type: text/plain, Size: 4272 bytes --]

On Thu, Nov 3, 2011 at 2:18 PM, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
>
> On 01/11/2011 20:39, Ryan Pavlik wrote:
>>
>> Not sure if this is the right forum for this, but it seemed more
>
> This is absolutely the correct list.
>
> Thanks very much for putting in the effort to do this.
>
>> specific and probably more appropriate than the overall xorg lists.
>> I wanted to build a native windows X server (essentially an
>> open-source Xming). I had to patch a number of the packages along the
>> way, but did eventually arrive at a build that worked.  I looked at
>> and used a few of the Xming patches, but only generally went to those
>> when the naive approach didn't work.
>
> This may be a problem.
>
> The material on the Xming website is licensed under a Creative Commons license, which is not compatible with the X11 license.  So, patches from the Xming website are not acceptable unless the author has agreed to re-license them appropriately.

I emailed him and he indicated that he already has a process worked
out for re-licensing a patch at a time to submit to you.

As such, I have re-worked my patch queue to remove all patches derived
from the Xming web site. It doesn't add everything that the previous
branch did, but it does build and start to work, and all these patches
are licensed like the X11 source itself as they are my work.  I also
re-worked the commit messages and patches a bit, and added some
additional patches.

https://github.com/rpavlik/Xserver/tree/cleanpatches-1.11-branch

>>
>> I'm looking for some feedback on the patches so that they can get into
>> the main line of the projects.
>>
>> I built using mingw-cross-env, with my fork here that includes the
>> dependency packages: https://bitbucket.org/rpavlik/mingw-cross-env/
>> This builds everything except the xorg-server module (ignore the fact
>> there's an xorg-server makefile there - the patches aren't up to date
>> for that module.)
>>
>> Patches for these dependencies are as follows, in that mingw-cross-env
>> repo (These should all have commit messages from being exported from
>> git format-patch):
>> libX11-1-add-xwinsock-include, libX11-2-windows-threads,
>> libX11-3-MinGW-lacks-caddr_t
>> libXaw-1-need-winsock
>> libXfont-1-dummy-readlink
>> libxcb-1-fix-include-order-with-Xdmcp, libxcb-2-wsastartup - this last
>> one fixes running libX11 apps built for Windows, including the
>> integrated multi-window WM.
>> xkbcomp-1-Use-X11-Xwindows.h, xkbcomp-2-Look-in-windows-base-dir-too -
>> this last one supports the "RELOCATE_PROJECTROOT" option in the XWin
>> server - should still work fine in the normal case though.
>
> I've quickly looked over these patches and in general they look good, and I'd be happy to help get them merged upstream.
>
> A couple of general points I'd make though:
>
> It helps a great deal in reviewing if the comments state why the change is a good idea (e.g. what problem it fixes), rather than just describing the change which is made.

I've revised the commit messages for xorg-server accordingly -
hopefully these are better.

>
> I also noticed that a bit more care might be needed with the define you are using to enable platform specific code: WIN32 and __MINGW__ should not be used interchangeably.  WIN32 will also be defined when building VcXsrv, and neither is defined on Cygwin.
>


Ah, true. I have gone through and improved this in my cleanpatches
branch, and have also added some convenience defines to make this
easier to get right - this is the last half of the commits.

>
> So, can you post your patches here, preferably in git-send-email format so we can review them in detail?
>

I wasn't sure if you wanted one email per patch, and 43 emails seemed
like an awful lot, so I've attached them all (git format-patch) to
this one. If you prefer, I can send them individually to this (or
another) list with git send-email.  These are just the xserver
patches, not the ones for other packages that I mentioned in the
mingw-cross-env repository.

Thanks!

Ryan
--
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik@iastate.edu
http://academic.cleardefinition.com

[-- Attachment #2: 0001-os-osinit.c-Exclude-new-signal-sigaction-code-on-non.patch --]
[-- Type: application/octet-stream, Size: 877 bytes --]

From 502544be07011972fc810e370ba7d490b96115ad Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 15:21:35 -0500
Subject: [PATCH 01/43] os/osinit.c: Exclude new signal (sigaction) code on
 non-posix.

In particular, this is needed for MinGW builds.
---
 os/osinit.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/os/osinit.c b/os/osinit.c
index 45d202d..d1163c3 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -155,6 +155,7 @@ OsInit(void)
     char fname[PATH_MAX];
 
     if (!been_here) {
+#ifndef X_NO_POSIX
 	struct sigaction act, oact;
 	int i;
 	int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
@@ -199,6 +200,8 @@ OsInit(void)
 	dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
 #endif
 
+#endif /* !X_NO_POSIX */
+
 #if !defined(__CYGWIN__) 
 	fclose(stdin);
 	fclose(stdout);
-- 
1.7.7.1


[-- Attachment #3: 0002-os-xsha1.c-Preemptively-include-X11-Xwindows.h-on-Wi.patch --]
[-- Type: application/octet-stream, Size: 925 bytes --]

From f62592718e7ceec53a04c9c30055c9ba858d596e Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 14:49:15 -0500
Subject: [PATCH 02/43] os/xsha1.c: Preemptively include <X11/Xwindows.h> on
 Win32.

Avoids duplicate defines if someone includes windows.h before
the specially wrapped X11/Xwindows.h header.
---
 os/xsha1.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/os/xsha1.c b/os/xsha1.c
index 5ea71da..f13dd1f 100644
--- a/os/xsha1.c
+++ b/os/xsha1.c
@@ -64,6 +64,13 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 
 #elif defined(HAVE_SHA1_IN_LIBGCRYPT) /* Use libgcrypt for SHA1 */
 
+# if defined(WIN32) && !defined(__CYGWIN__)
+/*
+ * Must be included before any other header includes windows.h, to avoid
+ * conflicting definitions.
+ */
+#  include <X11/Xwindows.h>
+# endif
 # include <gcrypt.h>
 
 void *x_sha1_init(void)
-- 
1.7.7.1


[-- Attachment #4: 0003-os-utils.c-sigaction-is-POSIX.patch --]
[-- Type: application/octet-stream, Size: 869 bytes --]

From 92f7115b61feba83f364b5f128a301f1e826eb62 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 15:14:50 -0500
Subject: [PATCH 03/43] os/utils.c: sigaction is POSIX

MinGW doesn't have it, so this patch is needed for building.
---
 os/utils.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index d9aa65e..2b8c119 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -208,6 +208,9 @@ int auditTrailLevel = 1;
 OsSigHandlerPtr
 OsSignal(int sig, OsSigHandlerPtr handler)
 {
+#ifdef X_NOT_POSIX
+    return signal(sig, handler);
+#else
     struct sigaction act, oact;
 
     sigemptyset(&act.sa_mask);
@@ -218,6 +221,7 @@ OsSignal(int sig, OsSigHandlerPtr handler)
     if (sigaction(sig, &act, &oact))
       perror("sigaction");
     return oact.sa_handler;
+#endif
 }
 
 /*
-- 
1.7.7.1


[-- Attachment #5: 0004-os-utils.c-Windows-non-cygwin-get-only-stubs-for-Loc.patch --]
[-- Type: application/octet-stream, Size: 1893 bytes --]

From fdf546a221bacd4fc5937e1173d3ac2fe96a7ec2 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 21 Oct 2011 12:32:49 -0500
Subject: [PATCH 04/43] os/utils.c: Windows non-cygwin get only stubs for
 Lock/UnlockServer

MinGW and MSVC lack the POSIX functions to compile the locking code.
---
 os/utils.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 2b8c119..97e6a6c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -235,6 +235,15 @@ OsSignal(int sig, OsSigHandlerPtr handler)
 #define LOCK_PREFIX "/.X"
 #define LOCK_SUFFIX "-lock"
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+void
+LockServer(void)
+{}
+
+void
+UnlockServer(void)
+{}
+#else
 static Bool StillLocking = FALSE;
 static char LockFile[PATH_MAX];
 static Bool nolock = FALSE;
@@ -382,6 +391,7 @@ UnlockServer(void)
   }
 }
 
+#endif /* not windows non-cygwin */
 /* Force connections to close on SIGHUP from init */
 
 void
@@ -502,7 +512,9 @@ void UseMsg(void)
 #ifdef RLIMIT_STACK
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
+#if !defined(WIN32) || defined(__CYGWIN__)
     ErrorF("-nolock                disable the locking mechanism\n");
+#endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
     ErrorF("-background [none]     create root window with no background\n");
@@ -750,6 +762,8 @@ ProcessCommandLine(int argc, char *argv[])
 		UseMsg();
 	}
 #endif
+
+#if !defined(WIN32) || defined(__CYGWIN__)
 	else if ( strcmp ( argv[i], "-nolock") == 0)
 	{
 #if !defined(WIN32) && !defined(__CYGWIN__)
@@ -759,6 +773,8 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
 	    nolock = TRUE;
 	}
+#endif
+
 	else if ( strcmp( argv[i], "-nolisten") == 0)
 	{
             if(++i < argc) {
-- 
1.7.7.1


[-- Attachment #6: 0005-hw-xwin-XWin.exe.manifest-Modify-to-be-more-generic.patch --]
[-- Type: application/octet-stream, Size: 864 bytes --]

From 45c10cfb0c1b46e033e6cb774df72bc33060efea Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 14:28:45 -0500
Subject: [PATCH 05/43] hw/xwin/XWin.exe.manifest: Modify to be more generic

Not every build of XWin is Cygwin/X.
---
 hw/xwin/XWin.exe.manifest |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/XWin.exe.manifest b/hw/xwin/XWin.exe.manifest
index 221150d..6650d34 100755
--- a/hw/xwin/XWin.exe.manifest
+++ b/hw/xwin/XWin.exe.manifest
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-	<description>The XWin X Windows server for Cygwin.</description>
+	<description>The XWin X Windows server.</description>
 	<dependency>
 	   <dependentAssembly>
 	     <assemblyIdentity
-- 
1.7.7.1


[-- Attachment #7: 0006-hw-xwin-Makefile.am-Include-manifest-in-the-dist-tar.patch --]
[-- Type: application/octet-stream, Size: 667 bytes --]

From e8094a64ad6b0ef02cbfb65bbda8e89508901bb5 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 14:29:01 -0500
Subject: [PATCH 06/43] hw/xwin/Makefile.am: Include manifest in the dist
 tarball.

---
 hw/xwin/Makefile.am |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 256af0b..c490163 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -175,7 +175,8 @@ install-exec-hook:
 EXTRA_DIST = \
 	$(xwinconfig_DATA) \
 	X.ico \
-	XWin.rc
+	XWin.rc \
+	XWin.exe.manifest
 
 relink:
 	$(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT)
-- 
1.7.7.1


[-- Attachment #8: 0007-configure.ac-use-ws2_32-instead-of-winsock2-on-MinGW.patch --]
[-- Type: application/octet-stream, Size: 942 bytes --]

From 5ff2053b78b66a0be5b9f095b9ec38cec751d605 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 21 Oct 2011 12:47:38 -0500
Subject: [PATCH 07/43] configure.ac: use ws2_32 instead of winsock2 on MinGW

---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index cc4292b..cf3d80b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1834,7 +1834,7 @@ if test "x$XWIN" = xyes; then
 			XWIN_SERVER_NAME=Xming
 			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
 			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
-			XWIN_SYS_LIBS=-lwinsock2
+			XWIN_SYS_LIBS=-lws2_32
 			;;
 	esac
 	XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
-- 
1.7.7.1


[-- Attachment #9: 0008-os-osinit.c-no-getpgrp-and-friends-on-windows-except.patch --]
[-- Type: application/octet-stream, Size: 629 bytes --]

From c5b4e5b6f25df5b2e73d93bc39ce85329f1366df Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:25:57 -0500
Subject: [PATCH 08/43] os/osinit.c: no getpgrp and friends on windows except
 with cygwin

---
 os/osinit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/os/osinit.c b/os/osinit.c
index d1163c3..ac5aceb 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -240,8 +240,10 @@ OsInit(void)
 #endif
 	}
 
+#if !defined(WIN32) || defined(__CYGWIN__)
 	if (getpgrp () == 0)
 	    setpgid (0, 0);
+#endif
 
 #ifdef RLIMIT_DATA
 	if (limitDataSpace >= 0)
-- 
1.7.7.1


[-- Attachment #10: 0009-os-utils.c-Use-winxp-or-better-for-Winsock-API.patch --]
[-- Type: application/octet-stream, Size: 644 bytes --]

From c8a5317e67c66ccbbb3acabf922fd45dae2fefb0 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:27:37 -0500
Subject: [PATCH 09/43] os/utils.c: Use winxp or better for Winsock API

---
 os/utils.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 97e6a6c..12b9deb 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -64,6 +64,9 @@ __stdcall unsigned long GetTickCount(void);
 #endif
 
 #if defined(WIN32) && !defined(__CYGWIN__)
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
 #include <X11/Xwinsock.h>
 #endif
 #include <X11/Xos.h>
-- 
1.7.7.1


[-- Attachment #11: 0010-include-xwin-config.h.in-Add-RELOCATE_PROJECTROOT-to.patch --]
[-- Type: application/octet-stream, Size: 684 bytes --]

From ebb78bd11cf320585c358ed4f19a7d5a19792c9c Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Wed, 26 Oct 2011 17:03:25 -0500
Subject: [PATCH 10/43] include/xwin-config.h.in: Add RELOCATE_PROJECTROOT to
 config header

---
 include/xwin-config.h.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 13b51ca..b4e99fd 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -34,3 +34,7 @@
 
 /* Default log location */
 #undef DEFAULT_LOGDIR
+
+/* Whether we should re-located the root to where the executable lives */
+#undef RELOCATE_PROJECTROOT
+
-- 
1.7.7.1


[-- Attachment #12: 0011-hw-xwin-InitOutput.c-Only-reset-the-xkb-directory-if.patch --]
[-- Type: application/octet-stream, Size: 2148 bytes --]

From 6bd530b4b0814ee2f6fcb0265cf69e981040bb40 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 11:55:21 -0500
Subject: [PATCH 11/43] hw/xwin/InitOutput.c: Only reset the xkb directory if
 the new one exists.

This is for running builds with RELOCATE_PROJECTROOT in their default
install locations.
---
 hw/xwin/InitOutput.c |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 4fe5053..682e9f0 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -49,6 +49,9 @@ from The Open Group.
 #endif
 #ifdef RELOCATE_PROJECTROOT
 #include <shlobj.h>
+#include <io.h>
+#include <sys/stat.h>
+
 typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)(
     HWND hwndOwner,
     int nFolder,
@@ -358,7 +361,26 @@ winCheckMount(void)
 #endif
 
 #ifdef RELOCATE_PROJECTROOT
-const char * 
+
+static BOOL
+winDirectoryExists(const char * path)
+{
+  BOOL ret = FALSE;
+  if (access(path, 0) == 0)
+  {
+    struct stat pathstat;
+    stat(path, &pathstat);
+    if (pathstat.st_mode & S_IFDIR)
+    {
+      ret = TRUE;
+    }
+  }
+  ErrorF("winDirectoryExists(\"%s\") = %d\n", path, ret);
+  return ret;
+}
+
+
+const char *
 winGetBaseDir(void)
 {
     static BOOL inited = FALSE;
@@ -642,16 +664,20 @@ winFixupPaths (void)
             g_pszLogFile = buffer;
             winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
         }
+  {
+    static char xkbbasedir[MAX_PATH];
+
+    snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir);
+    if (sizeof(xkbbasedir) > 0)
+    {
+      xkbbasedir[sizeof(xkbbasedir) - 1] = 0;
     }
+    if (winDirectoryExists(xkbbasedir))
     {
-        static char xkbbasedir[MAX_PATH];
-
-        snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir);
-        if (sizeof(xkbbasedir) > 0)
-            xkbbasedir[sizeof(xkbbasedir)-1] = 0;
-        XkbBaseDirectory = xkbbasedir;
-	XkbBinDirectory = basedir;
+      XkbBaseDirectory = xkbbasedir;
     }
+    XkbBinDirectory = basedir;
+  }
 #endif /* RELOCATE_PROJECTROOT */
 }
 
-- 
1.7.7.1


[-- Attachment #13: 0012-hw-xwin-InitOutput.c-reformat-winGetBaseDir.patch --]
[-- Type: application/octet-stream, Size: 1768 bytes --]

From f97289411cb1cabcf48d55de0a3e856071d48e69 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 11:57:04 -0500
Subject: [PATCH 12/43] hw/xwin/InitOutput.c: reformat winGetBaseDir

---
 hw/xwin/InitOutput.c |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 682e9f0..5e50807 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -383,29 +383,31 @@ winDirectoryExists(const char * path)
 const char *
 winGetBaseDir(void)
 {
-    static BOOL inited = FALSE;
-    static char buffer[MAX_PATH];
-    if (!inited)
+  static BOOL inited = FALSE;
+  static char buffer[MAX_PATH];
+  if (!inited)
+  {
+    char *fendptr;
+    HMODULE module = GetModuleHandle(NULL);
+    DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
+    if (sizeof(buffer) > 0)
     {
-        char *fendptr;
-        HMODULE module = GetModuleHandle(NULL);
-        DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
-        if (sizeof(buffer) > 0)
-            buffer[sizeof(buffer)-1] = 0;
-    
-        fendptr = buffer + size;
-        while (fendptr > buffer)
-        {
-            if (*fendptr == '\\' || *fendptr == '/')
-            {
-                *fendptr = 0;
-                break;
-            }
-            fendptr--;
-        }
-        inited = TRUE;
+      buffer[sizeof(buffer) - 1] = 0;
     }
-    return buffer;
+
+    fendptr = buffer + size;
+    while (fendptr > buffer)
+    {
+      if (*fendptr == '\\' || *fendptr == '/')
+      {
+        *fendptr = 0;
+        break;
+      }
+      fendptr--;
+    }
+    inited = TRUE;
+  }
+  return buffer;
 }
 #endif
 
-- 
1.7.7.1


[-- Attachment #14: 0013-hw-xwin-InitOutput.c-Remove-duplicated-code-for-sett.patch --]
[-- Type: application/octet-stream, Size: 6069 bytes --]

From 2ee4e5b2d27fc9b4c261af2527d1a02c9c3e492a Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 11:59:40 -0500
Subject: [PATCH 13/43] hw/xwin/InitOutput.c: Remove duplicated code for
 setting up environment variables

---
 hw/xwin/InitOutput.c |  160 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 102 insertions(+), 58 deletions(-)

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 5e50807..50b38bd 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -379,6 +379,22 @@ winDirectoryExists(const char * path)
   return ret;
 }
 
+static BOOL
+winFileIs(const char * path, mode_t mask)
+{
+  BOOL ret = FALSE;
+  if (access(path, 0) == 0)
+  {
+    struct stat pathstat;
+    stat(path, &pathstat);
+    if (pathstat.st_mode & mask)
+    {
+      ret = TRUE;
+    }
+  }
+  ErrorF("winFileExists(\"%s\") = %d\n", path, ret);
+  return ret;
+}
 
 const char *
 winGetBaseDir(void)
@@ -409,6 +425,46 @@ winGetBaseDir(void)
   }
   return buffer;
 }
+
+
+static void
+winVerifyEnvironment(const char * basedir, mode_t mask, const char * varname, const char * dirsuffix)
+{
+  if (getenv(varname) == NULL)
+  {
+    char buffer[MAX_PATH];
+    snprintf(buffer, sizeof(buffer), "%s\\%s",
+             PROJECTROOT, dirsuffix);
+    buffer[sizeof(buffer) - 1] = 0;
+    if (winFileIs(buffer, mask))
+    {
+      snprintf(buffer, sizeof(buffer), "%s=%s\\%s",
+               varname, PROJECTROOT, dirsuffix);
+      buffer[sizeof(buffer) - 1] = 0;
+      putenv(buffer);
+    }
+    else
+    {
+      snprintf(buffer, sizeof(buffer), "%s\\%s",
+               basedir, dirsuffix);
+      buffer[sizeof(buffer) - 1] = 0;
+      if (winFileIs(buffer, mask))
+      {
+        snprintf(buffer, sizeof(buffer), "%s=%s\\%s",
+                 varname, basedir, dirsuffix);
+        buffer[sizeof(buffer) - 1] = 0;
+        putenv(buffer);
+      }
+      else
+      {
+        ErrorF("winVerifyEnvironment: Could not find a valid path for \"%s\"\n", varname);
+      }
+    }
+
+    putenv(buffer);
+  }
+
+}
 #endif
 
 static void
@@ -600,72 +656,60 @@ winFixupPaths (void)
         winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath);
 
 #ifdef RELOCATE_PROJECTROOT
-    if (getenv("XKEYSYMDB") == NULL)
+  winVerifyEnvironment(basedir, S_IFREG, "XKEYSYMDB", "XKeysymDB");
+  winVerifyEnvironment(basedir, S_IFREG, "XERRORDB", "XErrorDB");
+  winVerifyEnvironment(basedir, S_IFDIR, "XLOCALEDIR", "locale");
+  if (getenv("HOME") == NULL)
+  {
+    HMODULE shfolder;
+    SHGETFOLDERPATHPROC shgetfolderpath = NULL;
+    char buffer[MAX_PATH + 5];
+    strncpy(buffer, "HOME=", 5);
+
+    /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */
+
+    shfolder = LoadLibrary("shfolder.dll");
+    /* fallback to shell32.dll */
+    if (shfolder == NULL)
     {
-        char buffer[MAX_PATH];
-        snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB",
-                basedir);
-        buffer[sizeof(buffer)-1] = 0;
-        putenv(buffer);
+      shfolder = LoadLibrary("shell32.dll");
     }
-    if (getenv("XERRORDB") == NULL)
+
+    /* resolve SHGetFolderPath */
+    if (shfolder != NULL)
     {
-        char buffer[MAX_PATH];
-        snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB",
-                basedir);
-        buffer[sizeof(buffer)-1] = 0;
-        putenv(buffer);
+      shgetfolderpath = (SHGETFOLDERPATHPROC) GetProcAddress(shfolder, "SHGetFolderPathA");
+    }
+
+    /* query appdata directory */
+    if (shgetfolderpath &&
+        shgetfolderpath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0,
+                        buffer + 5) == 0)
+    {
+      putenv(buffer);
     }
-    if (getenv("XLOCALEDIR") == NULL)
+    else
     {
-        char buffer[MAX_PATH];
-        snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale",
-                basedir);
-        buffer[sizeof(buffer)-1] = 0;
-        putenv(buffer);
+      winMsg(X_ERROR, "Can not determine HOME directory\n");
     }
-    if (getenv("HOME") == NULL)
+    if (shfolder != NULL)
     {
-        HMODULE shfolder;
-        SHGETFOLDERPATHPROC shgetfolderpath = NULL;
-        char buffer[MAX_PATH + 5];
-        strncpy(buffer, "HOME=", 5);
-
-        /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */
-        
-        shfolder = LoadLibrary("shfolder.dll");
-        /* fallback to shell32.dll */
-        if (shfolder == NULL)
-            shfolder = LoadLibrary("shell32.dll");
-
-        /* resolve SHGetFolderPath */
-        if (shfolder != NULL)
-            shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA");
-
-        /* query appdata directory */
-        if (shgetfolderpath &&
-                shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0, 
-                    buffer + 5) == 0)
-        { 
-            putenv(buffer);
-        } else
-        {
-            winMsg (X_ERROR, "Can not determine HOME directory\n");
-        } 
-        if (shfolder != NULL)
-            FreeLibrary(shfolder);
+      FreeLibrary(shfolder);
     }
-    if (!g_fLogFileChanged) {
-        static char buffer[MAX_PATH];
-        DWORD size = GetTempPath(sizeof(buffer), buffer);
-        if (size && size < sizeof(buffer))
-        {
-            snprintf(buffer + size, sizeof(buffer) - size, 
-                    "XWin.%s.log", display); 
-            buffer[sizeof(buffer)-1] = 0;
-            g_pszLogFile = buffer;
-            winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
-        }
+  }
+  if (!g_fLogFileChanged)
+  {
+    static char buffer[MAX_PATH];
+    DWORD size = GetTempPath(sizeof(buffer), buffer);
+    if (size && size < sizeof(buffer))
+    {
+      snprintf(buffer + size, sizeof(buffer) - size,
+               "XWin.%s.log", display);
+      buffer[sizeof(buffer) - 1] = 0;
+      g_pszLogFile = buffer;
+      winMsg(X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
+    }
+  }
   {
     static char xkbbasedir[MAX_PATH];
 
-- 
1.7.7.1


[-- Attachment #15: 0014-hw-xwin-winwindow.h-Add-missing-include-xwin-config..patch --]
[-- Type: application/octet-stream, Size: 623 bytes --]

From 447b46369bc475af1d462fca5a8ee461a89d5d40 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 12:04:32 -0500
Subject: [PATCH 14/43] hw/xwin/winwindow.h: Add missing include xwin-config.h

---
 hw/xwin/winwindow.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index a6c8e05..0d90a65 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -32,6 +32,10 @@
  *              Colin Harrison
  */
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
 #ifndef NO
 #define NO			0
 #endif
-- 
1.7.7.1


[-- Attachment #16: 0015-hw-xwin-winwindow.h-change-window-class-and-window-c.patch --]
[-- Type: application/octet-stream, Size: 971 bytes --]

From 400ec55da89f70f4eba234ace96cee98e21465f5 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 12:43:02 -0500
Subject: [PATCH 15/43] hw/xwin/winwindow.h: change window class and window
 class X

---
 hw/xwin/winwindow.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 0d90a65..5f3cc65 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -48,11 +48,11 @@
 #  define PROJECT_NAME		"Cygwin/X"
 #endif
 #define EXECUTABLE_NAME         "XWin"
-#define WINDOW_CLASS		"cygwin/x"
+#define WINDOW_CLASS		PROJECT_NAME
 #define WINDOW_TITLE		PROJECT_NAME ":%s.%d"
 #define WINDOW_TITLE_XDMCP	"%s:%s.%d"
 #define WIN_SCR_PROP		"cyg_screen_prop rl"
-#define WINDOW_CLASS_X		"cygwin/x X rl"
+#define WINDOW_CLASS_X		PROJECT_NAME " X"
 #define WINDOW_TITLE_X		PROJECT_NAME " X"
 #define WIN_WINDOW_PROP		"cyg_window_prop_rl"
 #ifdef HAS_DEVWINDOWS
-- 
1.7.7.1


[-- Attachment #17: 0016-hw-xwin-winwindow.h-make-project-name-aware-of-non-C.patch --]
[-- Type: application/octet-stream, Size: 903 bytes --]

From 2c52d098bbdb85b885da3b5f4f5c90da5b0be50b Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:28:58 -0500
Subject: [PATCH 16/43] hw/xwin/winwindow.h: make project name aware of
 non-Cygwin builds

---
 hw/xwin/winwindow.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 5f3cc65..fa78c5a 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -45,8 +45,15 @@
 
 /* Constant strings */
 #ifndef PROJECT_NAME
-#  define PROJECT_NAME		"Cygwin/X"
+#  if defined(__MINGW32__)
+#    define PROJECT_NAME "XWin-MinGW"
+#  elif defined(__CYGWIN__)
+#    define PROJECT_NAME		"Cygwin/X"
+#  else
+#    define PROJECT_NAME		"XWin"
+#  endif
 #endif
+
 #define EXECUTABLE_NAME         "XWin"
 #define WINDOW_CLASS		PROJECT_NAME
 #define WINDOW_TITLE		PROJECT_NAME ":%s.%d"
-- 
1.7.7.1


[-- Attachment #18: 0017-dix-registry.c-non-cygwin-find-protocol.txt-in-reloc.patch --]
[-- Type: application/octet-stream, Size: 1480 bytes --]

From 9448110682ae8ac0c4343f7df2139b1b06389078 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:30:46 -0500
Subject: [PATCH 17/43] dix/registry.c: non-cygwin find protocol.txt in
 relocated root

---
 dix/registry.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dix/registry.c b/dix/registry.c
index fc35dbb..ba588c4 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -32,8 +32,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define BASE_SIZE 16
 #define CORE "X11"
+
+/* Should this actually be checking RELOCATE_PROJECTROOT ? */
+#if defined(WIN32) && !defined(__CYGWIN__)
+#define FILENAME_ONLY "protocol.txt"
+extern const char *winGetBaseDir(void);
+#endif
 #define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
 
+
 #define PROT_COMMENT '#'
 #define PROT_REQUEST 'R'
 #define PROT_EVENT 'V'
@@ -311,7 +318,19 @@ dixResetRegistry(void)
     /* Open the protocol file */
     if (fh)
 	fclose(fh);
+#if defined(WIN32) && !defined(__CYGWIN__)
+    {
+	char filename[MAX_PATH];
+	snprintf(filename, sizeof(filename), "%s\\%s", winGetBaseDir(), FILENAME_ONLY);
+	filename[sizeof(filename)-1] = 0;
+	fh = fopen(filename, "r");
+    }
+    if (!fh) {
+#endif
     fh = fopen(FILENAME, "r");
+#if defined(WIN32) && !defined(__CYGWIN__)
+	}
+#endif
     if (!fh)
 	LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
 
-- 
1.7.7.1


[-- Attachment #19: 0018-hw-xwin-winrandr.c-Fix-function-pointer-mismatch.patch --]
[-- Type: application/octet-stream, Size: 711 bytes --]

From dd7a2abb28861d6d3d9bcfccfbd9c333a8d3f0ee Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 27 Oct 2011 15:49:59 -0500
Subject: [PATCH 18/43] hw/xwin/winrandr.c: Fix function pointer mismatch

---
 hw/xwin/winrandr.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index c581193..596c1ab 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -122,8 +122,6 @@ Bool
 winRandRScreenSetSize (ScreenPtr  pScreen,
 		       CARD16	    width,
 		       CARD16	    height,
-		       CARD16       pixWidth,
-		       CARD16       pixHeight,
 		       CARD32	    mmWidth,
 		       CARD32	    mmHeight)
 {
-- 
1.7.7.1


[-- Attachment #20: 0019-hw-xwin-winmultiwindowwm.c-fix-memory-leak.patch --]
[-- Type: application/octet-stream, Size: 1111 bytes --]

From 3e7512e24d2f2bf117b3db0c1659cd3336f83a29 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:46:45 -0500
Subject: [PATCH 19/43] hw/xwin/winmultiwindowwm.c: fix memory leak

---
 hw/xwin/winmultiwindowwm.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 67a58a0..4178756 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1201,11 +1201,13 @@ winInitWM (void **ppWMInfo,
   XMsgProcArgPtr	pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec));
 
   /* Bail if the input parameters are bad */
-  if (pArg == NULL || pWMInfo == NULL)
-    {
-      ErrorF ("winInitWM - malloc failed.\n");
-      return FALSE;
-    }
+  if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) {
+    ErrorF ("winInitWM - malloc failed.\n");
+    if (pArg) free(pArg);
+    if (pWMInfo) free(pWMInfo);
+    if (pXMsgArg) free(pXMsgArg);
+    return FALSE;
+  }
   
   /* Zero the allocated memory */
   ZeroMemory (pArg, sizeof (WMProcArgRec));
-- 
1.7.7.1


[-- Attachment #21: 0020-hw-xwin-winengine.c-clarify-if-statement-mixed-with-.patch --]
[-- Type: application/octet-stream, Size: 866 bytes --]

From 26cf5793cd988257ecc650acd7f9e2337d082d34 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:46:56 -0500
Subject: [PATCH 20/43] hw/xwin/winengine.c: clarify if statement mixed with
 ifdef

---
 hw/xwin/winengine.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c
index e866e1e..752c4fe 100644
--- a/hw/xwin/winengine.c
+++ b/hw/xwin/winengine.c
@@ -192,15 +192,12 @@ winSetEngine (ScreenPtr pScreen)
 
   /* ShadowGDI is the only engine that supports Multi Window Mode */
   if (
-#ifdef XWIN_MULTIWINDOWEXTWM
-      pScreenInfo->fMWExtWM
-#else
       FALSE
+#ifdef XWIN_MULTIWINDOWEXTWM
+      || pScreenInfo->fMWExtWM
 #endif
 #ifdef XWIN_MULTIWINDOW
       || pScreenInfo->fMultiWindow
-#else
-      || FALSE
 #endif
       )
     {
-- 
1.7.7.1


[-- Attachment #22: 0021-hw-xwin-winnativegdi.c-Fix-potential-null-ptr-deref.patch --]
[-- Type: application/octet-stream, Size: 1312 bytes --]

From 3f1f4847160e4d915ead881e790bf1cccdbb9084 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:49:00 -0500
Subject: [PATCH 21/43] hw/xwin/winnativegdi.c: Fix potential null ptr deref.

---
 hw/xwin/winnativegdi.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c
index 4d7afe8..68f8020 100644
--- a/hw/xwin/winnativegdi.c
+++ b/hw/xwin/winnativegdi.c
@@ -315,7 +315,6 @@ static Bool
 winActivateAppNativeGDI (ScreenPtr pScreen)
 {
   winScreenPriv(pScreen);
-  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
 
   /*
    * Are we active?
@@ -323,7 +322,8 @@ winActivateAppNativeGDI (ScreenPtr pScreen)
    */
   if (pScreenPriv != NULL
       && pScreenPriv->fActive
-      && pScreenInfo->fFullScreen)
+      && pScreenPriv->pScreenInfo
+      && pScreenPriv->pScreenInfo->fFullScreen)
     {
       /*
        * Activating, attempt to bring our window 
@@ -338,7 +338,8 @@ winActivateAppNativeGDI (ScreenPtr pScreen)
    */
   if (pScreenPriv != NULL
       && !pScreenPriv->fActive
-      && pScreenInfo->fFullScreen)
+      && pScreenPriv->pScreenInfo
+      && pScreenPriv->pScreenInfo->fFullScreen)
     {
       /*
        * Deactivating, stuff our window onto the
-- 
1.7.7.1


[-- Attachment #23: 0022-hw-xwin-winpfbdd.c-fix-possible-null-ptr-deref.patch --]
[-- Type: application/octet-stream, Size: 1291 bytes --]

From 5e3f0b90cc06c552c7b53661168f913b15541d00 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:52:34 -0500
Subject: [PATCH 22/43] hw/xwin/winpfbdd.c: fix possible null ptr deref

---
 hw/xwin/winpfbdd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c
index a399020..1a5a0e7 100644
--- a/hw/xwin/winpfbdd.c
+++ b/hw/xwin/winpfbdd.c
@@ -461,12 +461,12 @@ static Bool
 winActivateAppPrimaryDD (ScreenPtr pScreen)
 {
   winScreenPriv(pScreen);
-  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
   RECT			rcSrc, rcClient;
   HRESULT		ddrval = DD_OK;
 
   /* Check for errors */
   if (pScreenPriv == NULL
+      || pScreenPriv->pScreenInfo == NULL
       || pScreenPriv->pddsPrimary == NULL
       || pScreenPriv->pddsOffscreen == NULL)
     return FALSE;
@@ -500,8 +500,8 @@ winActivateAppPrimaryDD (ScreenPtr pScreen)
   /* Setup a source rectangle */
   rcSrc.left = 0;
   rcSrc.top = 0;
-  rcSrc.right = pScreenInfo->dwWidth;
-  rcSrc.bottom = pScreenInfo->dwHeight;
+  rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
+  rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
 
   ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
 				    &rcClient,
-- 
1.7.7.1


[-- Attachment #24: 0023-hw-xwin-winshadgdi.c-fix-double-free.patch --]
[-- Type: application/octet-stream, Size: 662 bytes --]

From 76fc9f3e0eecbe27fd2ee7a30edad800635a416f Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:52:37 -0500
Subject: [PATCH 23/43] hw/xwin/winshadgdi.c: fix double-free

---
 hw/xwin/winshadgdi.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c
index 1e7cb00..6339010 100644
--- a/hw/xwin/winshadgdi.c
+++ b/hw/xwin/winshadgdi.c
@@ -270,7 +270,6 @@ winQueryRGBBitsAndMasks (ScreenPtr pScreen)
   else
     {
       ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n");
-      free (pbmih);
       fReturn = FALSE;
     }
 
-- 
1.7.7.1


[-- Attachment #25: 0024-hw-xwin-winwin32rootless.c-Fix-possible-null-ptr-der.patch --]
[-- Type: application/octet-stream, Size: 829 bytes --]

From 3718322fa2d651df9939029b74eb629a404de6a8 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:56:11 -0500
Subject: [PATCH 24/43] hw/xwin/winwin32rootless.c: Fix possible null ptr
 deref

---
 hw/xwin/winwin32rootless.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index 8f9917a..f9b9420 100644
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -551,7 +551,7 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid)
   winDebug ("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
 #endif
 
-  if (pScreenPriv->fRestacking) return;
+  if (pScreenPriv && pScreenPriv->fRestacking) return;
 
   if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
 
-- 
1.7.7.1


[-- Attachment #26: 0025-hw-xwin-winwin32rootlesswindow.c-Fix-possible-null-p.patch --]
[-- Type: application/octet-stream, Size: 1232 bytes --]

From 0cf878d6788c2fc42fa3cefa5e400fea7e6d55e5 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:56:19 -0500
Subject: [PATCH 25/43] hw/xwin/winwin32rootlesswindow.c: Fix possible null
 ptr deref

---
 hw/xwin/winwin32rootlesswindow.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c
index 214e895..fbff838 100644
--- a/hw/xwin/winwin32rootlesswindow.c
+++ b/hw/xwin/winwin32rootlesswindow.c
@@ -202,7 +202,8 @@ winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam)
   /* Check if the Windows window property for our X window pointer is valid */
   if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
     {
-      pScreen				= pRLWinPriv->pFrame->win->drawable.pScreen;
+      if (pRLWinPriv != NULL && pRLWinPriv->pFrame != NULL && pRLWinPriv->pFrame->win != NULL)
+        pScreen				= pRLWinPriv->pFrame->win->drawable.pScreen;
       if (pScreen) pScreenPriv		= winGetScreenPriv(pScreen);
       if (pScreenPriv) pScreenInfo	= pScreenPriv->pScreenInfo;
       if (pRLWinPriv && pScreenInfo) winMWExtWMUpdateWindowDecoration (pRLWinPriv, pScreenInfo);
-- 
1.7.7.1


[-- Attachment #27: 0026-hw-xwin-winwin32rootless.c-remove-empty-if0.patch --]
[-- Type: application/octet-stream, Size: 827 bytes --]

From e1715664ee17485cdff079e95f9ab783177d619a Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 09:56:26 -0500
Subject: [PATCH 26/43] hw/xwin/winwin32rootless.c: remove empty if0

---
 hw/xwin/winwin32rootless.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index f9b9420..91399c2 100644
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -640,8 +640,6 @@ winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid)
       SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
 		    0, 0, 0, 0,
 		    SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
-#if 0
-#endif
     }
 #if CYGMULTIWINDOW_DEBUG
   winDebug ("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
-- 
1.7.7.1


[-- Attachment #28: 0027-dix-registry.c-Free-old-memory-upon-realloc-failure.patch --]
[-- Type: application/octet-stream, Size: 778 bytes --]

From 631e4ef632ddddafc6a0f58e7ead6b0be6d6f830 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 28 Oct 2011 10:05:35 -0500
Subject: [PATCH 27/43] dix/registry.c: Free old memory upon realloc failure

---
 dix/registry.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dix/registry.c b/dix/registry.c
index ba588c4..6505fc4 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -67,8 +67,14 @@ static int double_size(void *p, unsigned n, unsigned size)
 	s = 0;
 	n = f = BASE_SIZE * size;
     }
-
-    *ptr = realloc(*ptr, n);
+	{
+	    char * newptr = realloc(*ptr, n);
+	    if (!newptr) {
+	    	free(*ptr);
+	    }
+	    *ptr = newptr;
+	}
+    
     if (!*ptr) {
 	dixResetRegistry();
 	return FALSE;
-- 
1.7.7.1


[-- Attachment #29: 0028-os-access.c-Windows-non-cygwin-isn-t-just-mingw.patch --]
[-- Type: application/octet-stream, Size: 654 bytes --]

From 731348a546ba7d18e7d22d4168313b27234b1fff Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:39:49 -0500
Subject: [PATCH 28/43] os/access.c: Windows non-cygwin isn't just mingw

---
 os/access.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os/access.c b/os/access.c
index b7b1927..ca6b9d7 100644
--- a/os/access.c
+++ b/os/access.c
@@ -874,7 +874,7 @@ ResetHosts (char *display)
         FreeHost (host);
     }
 
-#if defined WIN32 && defined __MINGW32__
+#if defined(WIN32)&& !defined(__CYGWIN__)
 #define ETC_HOST_PREFIX "X"
 #else
 #define ETC_HOST_PREFIX "/etc/X"
-- 
1.7.7.1


[-- Attachment #30: 0029-os-utils.c-core-policy-needs-non-Windows-or-Cygwin.patch --]
[-- Type: application/octet-stream, Size: 747 bytes --]

From 597896074a2738b2d9fba57019c2d1a64b671f15 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:41:20 -0500
Subject: [PATCH 29/43] os/utils.c: core policy needs non-Windows or Cygwin

---
 os/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 12b9deb..1755bf8 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -660,7 +660,7 @@ ProcessCommandLine(int argc, char *argv[])
 	}
 	else if ( strcmp( argv[i], "-core") == 0)
 	{
-#if !defined(WIN32) || !defined(__MINGW32__)
+#if !defined(WIN32) || defined(__CYGWIN__)
 	    struct rlimit   core_limit;
 	    getrlimit (RLIMIT_CORE, &core_limit);
 	    core_limit.rlim_cur = core_limit.rlim_max;
-- 
1.7.7.1


[-- Attachment #31: 0030-os-utils.c-All-Windows-gets-GetTimeInMillis.patch --]
[-- Type: application/octet-stream, Size: 617 bytes --]

From bf67e5845f01f919c9100013fd06b3c1659e5b77 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Thu, 3 Nov 2011 19:42:05 -0500
Subject: [PATCH 30/43] os/utils.c: All Windows gets GetTimeInMillis

---
 os/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 1755bf8..5b431c4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -419,7 +419,7 @@ GiveUp(int sig)
     errno = olderrno;
 }
 
-#if (defined WIN32 && defined __MINGW32__) || defined(__CYGWIN__)
+#if defined(WIN32) || defined(__CYGWIN__)
 CARD32
 GetTimeInMillis (void)
 {
-- 
1.7.7.1


[-- Attachment #32: 0031-os-xdmcp.c-fix-_XSERVTransWSAStartup-warning.patch --]
[-- Type: application/octet-stream, Size: 551 bytes --]

From a8fc83bb4b861c08caec79d2e6b166da063023bd Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:10:33 -0500
Subject: [PATCH 31/43] os/xdmcp.c: fix _XSERVTransWSAStartup warning

---
 os/xdmcp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/os/xdmcp.c b/os/xdmcp.c
index f5331e1..a7516cc 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -19,6 +19,8 @@
 
 #ifdef WIN32
 #include <X11/Xwinsock.h>
+#define XSERV_t
+#include <X11/Xtrans/Xtrans.h>
 #endif
 
 #include <X11/Xos.h>
-- 
1.7.7.1


[-- Attachment #33: 0032-dix-dispatch.c-os-utils.c-Disable-smart-scheduler-fo.patch --]
[-- Type: application/octet-stream, Size: 2638 bytes --]

From 67ca7659b8203ce78f661dd2875f4152d18dfa17 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 18:00:38 -0500
Subject: [PATCH 32/43] dix/dispatch.c, os/utils.c: Disable smart scheduler
 for windows non-cygwin

---
 dix/dispatch.c |    4 ++++
 os/utils.c     |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index f8200b1..7bcda91 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -225,7 +225,11 @@ UpdateCurrentTimeIf(void)
 #define SMART_SCHEDULE_DEFAULT_INTERVAL	20	    /* ms */
 #define SMART_SCHEDULE_MAX_SLICE	200	    /* ms */
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+Bool SmartScheduleDisable = TRUE;
+#else
 Bool SmartScheduleDisable = FALSE;
+#endif
 long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
 long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
 long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
diff --git a/os/utils.c b/os/utils.c
index 5b431c4..6fefdc6 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -75,6 +75,7 @@ __stdcall unsigned long GetTickCount(void);
 #if !defined(WIN32) || !defined(__MINGW32__)
 #include <sys/time.h>
 #include <sys/resource.h>
+# define HAVE_SMARTSCHEDULE
 #endif
 #include "misc.h"
 #include <X11/X.h>
@@ -907,10 +908,12 @@ ProcessCommandLine(int argc, char *argv[])
 	    i = skip - 1;
 	}
 #endif
+#ifdef HAVE_SMARTSCHEDULE
 	else if ( strcmp( argv[i], "-dumbSched") == 0)
 	{
 	    SmartScheduleDisable = TRUE;
 	}
+#endif
 	else if ( strcmp( argv[i], "-schedInterval") == 0)
 	{
 	    if (++i < argc)
@@ -1145,6 +1148,7 @@ XNFstrdup(const char *s)
 void
 SmartScheduleStopTimer (void)
 {
+#ifdef HAVE_SMARTSCHEDULE
     struct itimerval	timer;
     
     if (SmartScheduleDisable)
@@ -1154,11 +1158,13 @@ SmartScheduleStopTimer (void)
     timer.it_value.tv_sec = 0;
     timer.it_value.tv_usec = 0;
     (void) setitimer (ITIMER_REAL, &timer, 0);
+#endif
 }
 
 void
 SmartScheduleStartTimer (void)
 {
+#ifdef HAVE_SMARTSCHEDULE
     struct itimerval	timer;
     
     if (SmartScheduleDisable)
@@ -1168,6 +1174,7 @@ SmartScheduleStartTimer (void)
     timer.it_value.tv_sec = 0;
     timer.it_value.tv_usec = SmartScheduleInterval * 1000;
     setitimer (ITIMER_REAL, &timer, 0);
+#endif
 }
 
 static void
@@ -1179,6 +1186,7 @@ SmartScheduleTimer (int sig)
 void
 SmartScheduleInit (void)
 {
+#ifdef HAVE_SMARTSCHEDULE
     struct sigaction	act;
 
     if (SmartScheduleDisable)
@@ -1195,6 +1203,7 @@ SmartScheduleInit (void)
 	perror ("sigaction for smart scheduler");
 	SmartScheduleDisable = TRUE;
     }
+#endif
 }
 
 #ifdef SIG_BLOCK
-- 
1.7.7.1


[-- Attachment #34: 0033-include-misc.h-Add-simplified-defines-for-windowsnes.patch --]
[-- Type: application/octet-stream, Size: 975 bytes --]

From 29916288cc47eb81b1ec2bab2851f6fcafc94668 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 12:58:09 -0500
Subject: [PATCH 33/43] include/misc.h: Add simplified defines for windowsness

---
 include/misc.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index bdcc8cc..a876a10 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -81,6 +81,25 @@ OF THIS SOFTWARE.
 #include <stddef.h>
 #include <stdint.h>
 
+
+/* Simplified definitions describing varieties of Win32-ness */
+#if defined(__CYGWIN__)
+#define IS_WIN32_CYGWIN
+#undef IS_WIN32_NATIVE
+#define IS_WIN32_NATIVE_OR_CYGWIN
+
+#elif defined(WIN32)
+#undef IS_WIN32_CYGWIN
+#define IS_WIN32_NATIVE
+#define IS_WIN32_NATIVE_OR_CYGWIN
+
+#else
+#undef IS_WIN32_CYGWIN
+#undef IS_WIN32_NATIVE
+#undef IS_WIN32_NATIVE_OR_CYGWIN
+#endif
+
+
 #ifndef MAXSCREENS
 #define MAXSCREENS	16
 #endif
-- 
1.7.7.1


[-- Attachment #35: 0034-xkb-xkbInit.c-use-new-Win32-defines.patch --]
[-- Type: application/octet-stream, Size: 761 bytes --]

From faad4321970e2ae32f8e23a1db87651dcbcf9538 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:11:21 -0500
Subject: [PATCH 34/43] xkb/xkbInit.c: use new Win32 defines.

---
 xkb/xkbInit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 3d3febb..4b255ae 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -685,7 +685,7 @@ XkbProcessArguments(int argc,char *argv[],int i)
 {
     if (strncmp(argv[i], "-xkbdir", 7) == 0) {
 	if(++i < argc) {
-#if !defined(WIN32) && !defined(__CYGWIN__)
+#ifndef IS_WIN32_NATIVE_OR_CYGWIN
 	    if (getuid() != geteuid()) {
 		LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n");
 		return -1;
-- 
1.7.7.1


[-- Attachment #36: 0035-os-utils.c-New-win32-defines.patch --]
[-- Type: application/octet-stream, Size: 1280 bytes --]

From f611ec9984eded8b3d2c20ca3518f11e5dbd13f4 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 18:00:47 -0500
Subject: [PATCH 35/43] os/utils.c: New win32 defines

---
 os/utils.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index 6fefdc6..a50b6e2 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -63,20 +63,22 @@ OR PERFORMANCE OF THIS SOFTWARE.
 __stdcall unsigned long GetTickCount(void);
 #endif
 
-#if defined(WIN32) && !defined(__CYGWIN__)
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
-#include <X11/Xwinsock.h>
+#ifdef IS_WIN32_NATIVE
+# ifndef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0501
+# endif
+# include <X11/Xwinsock.h>
 #endif
 #include <X11/Xos.h>
 #include <stdio.h>
 #include <time.h>
-#if !defined(WIN32) || !defined(__MINGW32__)
-#include <sys/time.h>
-#include <sys/resource.h>
+#ifndef IS_WIN32_NATIVE
 # define HAVE_SMARTSCHEDULE
+
+# include <sys/time.h>
+# include <sys/resource.h>
 #endif
+
 #include "misc.h"
 #include <X11/X.h>
 #define XSERV_t
@@ -420,7 +422,7 @@ GiveUp(int sig)
     errno = olderrno;
 }
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef IS_WIN32_NATIVE_OR_CYGWIN
 CARD32
 GetTimeInMillis (void)
 {
-- 
1.7.7.1


[-- Attachment #37: 0036-miext-rootless-rootlessConfig.h-New-win32-defines.patch --]
[-- Type: application/octet-stream, Size: 905 bytes --]

From d66b5a281efe3ffdd094fedab6e63139d59f0cec Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:17:30 -0500
Subject: [PATCH 36/43] miext/rootless/rootlessConfig.h: New win32 defines

---
 miext/rootless/rootlessConfig.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index a6c0d25..85c8e21 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -48,7 +48,7 @@
 
 #endif /* __APPLE__ */
 
-#if defined(__CYGWIN__) || defined(WIN32)
+#ifdef IS_WIN32_NATIVE_OR_CYGWIN
 
 # define ROOTLESS_PROTECT_ALPHA NO
 # define ROOTLESS_REDISPLAY_DELAY 10
@@ -57,6 +57,6 @@
 
 # define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0)
 
-#endif /* __CYGWIN__ */
+#endif /* IS_WIN32_NATIVE_OR_CYGWIN */
 
 #endif /* _ROOTLESSCONFIG_H */
-- 
1.7.7.1


[-- Attachment #38: 0037-hw-xwin-winclipboard.h-Fix-duplicate-definition.patch --]
[-- Type: application/octet-stream, Size: 618 bytes --]

From 11e1f231ce4c4f836174e9038f8f8c80e5d9337c Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:17:50 -0500
Subject: [PATCH 37/43] hw/xwin/winclipboard.h: Fix duplicate definition

---
 hw/xwin/winclipboard.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h
index 089c291..6b5249f 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -39,7 +39,6 @@
 #include <sys/select.h>
 #else
 #include <X11/Xwinsock.h>
-#define HAS_WINSOCK
 #endif
 #include <fcntl.h>
 #include <setjmp.h>
-- 
1.7.7.1


[-- Attachment #39: 0038-dix-registry.c-New-win32-defines.patch --]
[-- Type: application/octet-stream, Size: 1236 bytes --]

From 8e77a8bad3b5f99fa3b8607d36ba6095eadcfdf8 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:18:21 -0500
Subject: [PATCH 38/43] dix/registry.c: New win32 defines.

---
 dix/registry.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dix/registry.c b/dix/registry.c
index 6505fc4..fc80b93 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -34,7 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define CORE "X11"
 
 /* Should this actually be checking RELOCATE_PROJECTROOT ? */
-#if defined(WIN32) && !defined(__CYGWIN__)
+#ifdef IS_WIN32_NATIVE
 #define FILENAME_ONLY "protocol.txt"
 extern const char *winGetBaseDir(void);
 #endif
@@ -324,7 +324,7 @@ dixResetRegistry(void)
     /* Open the protocol file */
     if (fh)
 	fclose(fh);
-#if defined(WIN32) && !defined(__CYGWIN__)
+#ifdef IS_WIN32_NATIVE
     {
 	char filename[MAX_PATH];
 	snprintf(filename, sizeof(filename), "%s\\%s", winGetBaseDir(), FILENAME_ONLY);
@@ -334,7 +334,7 @@ dixResetRegistry(void)
     if (!fh) {
 #endif
     fh = fopen(FILENAME, "r");
-#if defined(WIN32) && !defined(__CYGWIN__)
+#ifdef IS_WIN32_NATIVE
 	}
 #endif
     if (!fh)
-- 
1.7.7.1


[-- Attachment #40: 0039-dix-dispatch.c-New-win32-defines.patch --]
[-- Type: application/octet-stream, Size: 720 bytes --]

From 1acc61f04b36a29d2d03e89e64148fdd530877a3 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:18:35 -0500
Subject: [PATCH 39/43] dix/dispatch.c: New win32 defines.

---
 dix/dispatch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 7bcda91..bef62f0 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -225,7 +225,7 @@ UpdateCurrentTimeIf(void)
 #define SMART_SCHEDULE_DEFAULT_INTERVAL	20	    /* ms */
 #define SMART_SCHEDULE_MAX_SLICE	200	    /* ms */
 
-#if defined(WIN32) && !defined(__CYGWIN__)
+#ifdef IS_WIN32_NATIVE
 Bool SmartScheduleDisable = TRUE;
 #else
 Bool SmartScheduleDisable = FALSE;
-- 
1.7.7.1


[-- Attachment #41: 0040-os-utils.c-include-misc.h.patch --]
[-- Type: application/octet-stream, Size: 606 bytes --]

From 7a36439cfe6c0ede3dd1e48f1912b13644ac4680 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:21:42 -0500
Subject: [PATCH 40/43] os/utils.c: include misc.h

Needed to make the new Win32 defines available.
---
 os/utils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index a50b6e2..f2f04dc 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -53,6 +53,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
 #include <dix-config.h>
 #endif
 
+#include <misc.h>
+
 #ifdef __CYGWIN__
 #include <stdlib.h>
 #include <signal.h>
-- 
1.7.7.1


[-- Attachment #42: 0041-configure.ac-mingw-doesn-t-have-setuid-either.patch --]
[-- Type: application/octet-stream, Size: 754 bytes --]

From f9ba736acf4ad2f39f27471ffec2cc349087c000 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:26:14 -0500
Subject: [PATCH 41/43] configure.ac: mingw doesn't have setuid either.

Fixes having to pass this flag for a successful MinGW build.
---
 configure.ac |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index cf3d80b..af78235 100644
--- a/configure.ac
+++ b/configure.ac
@@ -670,6 +670,7 @@ AC_MSG_CHECKING([to see if we can install the Xorg server as root])
 if test "x$SETUID" = "xauto" ; then
 	case $host_os in
 	    cygwin*)		SETUID="no"  ;;
+	    mingw*)			SETUID="no"  ;;
 	    darwin*)		SETUID="no"  ;;
 	    *)
 	   	case $host_cpu in
-- 
1.7.7.1


[-- Attachment #43: 0042-configure.ac-auto-disable-MITSHM-if-we-lack-IPC.patch --]
[-- Type: application/octet-stream, Size: 2014 bytes --]

From 981f4e720d014663bf1123ce755b611cfa30cda5 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:30:43 -0500
Subject: [PATCH 42/43] configure.ac: auto-disable MITSHM if we lack IPC

The MITSHM extension uses SYSV IPC, but even if configure's test
for IPC failed, MITSHM was still enabled by default, breaking
MinGW builds by default.
---
 configure.ac |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index af78235..6de0c9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -608,7 +608,7 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
 dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
-AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
+AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
 AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
@@ -966,6 +966,9 @@ if test "x$COMPOSITE" = xyes; then
 	COMPOSITE_INC='-I$(top_srcdir)/composite'
 fi
 
+if test "x$MITSHM" = xauto; then
+	MITSHM="$HAVE_SYSV_IPC"
+fi
 AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
 if test "x$MITSHM" = xyes; then
 	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
-- 
1.7.7.1


[-- Attachment #44: 0043-configure.ac-Fix-typo-in-extension-flag-help.patch --]
[-- Type: application/octet-stream, Size: 1653 bytes --]

From 002a1c678aedd3d232caadf4c77c1b2398b9ba4f Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <rpavlik@iastate.edu>
Date: Fri, 4 Nov 2011 13:31:09 -0500
Subject: [PATCH 43/43] configure.ac: Fix typo in extension flag help

The help said it was --disable-shm when that isn't actually what
you had to pass to get it to work.
---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6de0c9d..bee0f72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -608,7 +608,7 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
 dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
-AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
+AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
 AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
-- 
1.7.7.1


[-- Attachment #45: Type: text/plain, Size: 223 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

  reply	other threads:[~2011-11-04 23:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 20:40 Ryan Pavlik
2011-11-03 19:18 ` Jon TURNEY
2011-11-04 23:39   ` Ryan Pavlik [this message]
2011-11-07 18:10     ` Jon TURNEY
2011-11-07 19:36       ` Charles Wilson
2011-11-09 18:46         ` Jon TURNEY
2011-11-09 19:11           ` Charles Wilson
     [not found]             ` <CABMFTE8wrNqbNLX+jmd7WcxT-xqfxYctB-ZgmxfwBg38_g5xmw@mail.gmail.com>
2011-11-10 22:58               ` Charles Wilson
2011-11-10 16:50       ` Ryan Pavlik
2011-11-22  2:55         ` SeongNam Oh
2012-01-09 19:31         ` Jon TURNEY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABMFTE-7HAX5DhPT0abeNvgysFmOJU6a+DmAkRp3Ly4YnU4CFw@mail.gmail.com \
    --to=rpavlik@iastate.edu \
    --cc=cygwin-xfree@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).