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

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Feb 12 20:05:03 PST 2010


Rebased ref, commits from common ancestor:
commit ae0fb1f426e85420cce76ac4f03a929eddc05a07
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Feb 10 17:56:30 2010 -0800

    XQuartz: clang static analysis fixes
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 1762825..44380ff 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -548,7 +548,7 @@ static CGLPixelFormatObj makeFormat(__GLXconfig *conf) {
        attr[i++] = conf->samples;
     }
      
-    attr[i++] = 0;
+    attr[i + 1] = 0;
 
     error = CGLChoosePixelFormat(attr, &fobj, &formats);
     if(error) {
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index f926778..bef27f0 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -62,7 +62,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
     int numConfigs = 0;
     __GLXconfig *visualConfigs, *c;
     struct glCapabilities caps;
-    struct glCapabilitiesConfig *conf = NULL;
+    struct glCapabilitiesConfig *conf;
     int stereo, depth, aux, buffers, stencil, accum, color, msample;
     
     if(getGlCapabilities(&caps)) {
@@ -94,7 +94,6 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
      */
     
     assert(NULL != caps.configurations);
-    conf = caps.configurations;
     
     numConfigs = 0;
     
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index f3c8a30..3faa1cb 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -482,7 +482,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
 	return out;
 }
 
-- (CFPropertyListRef) prefs_get:(NSString *)key {
+- (CFPropertyListRef) prefs_get_copy:(NSString *)key {
     CFPropertyListRef value;
 	
     value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr);
@@ -543,7 +543,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
   CFPropertyListRef value;
   int ret;
   
-  value = [self prefs_get:key];
+  value = [self prefs_get_copy:key];
   
   if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
     CFNumberGetValue (value, kCFNumberIntType, &ret);
@@ -561,7 +561,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
   CFPropertyListRef value;
   const char *ret = NULL;
   
-  value = [self prefs_get:key];
+  value = [self prefs_get_copy:key];
   
   if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
     NSString *s = (NSString *) value;
@@ -578,12 +578,13 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
     CFPropertyListRef value;
     NSURL *ret = NULL;
     
-    value = [self prefs_get:key];
+    value = [self prefs_get_copy:key];
     
     if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
         NSString *s = (NSString *) value;
 
         ret = [NSURL URLWithString:s];
+        [ret retain];
     }
     
     if (value != NULL) CFRelease (value);
@@ -595,7 +596,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
   CFPropertyListRef value;
   float ret = def;
   
-  value = [self prefs_get:key];
+  value = [self prefs_get_copy:key];
   
   if (value != NULL
       && CFGetTypeID (value) == CFNumberGetTypeID ()
@@ -613,7 +614,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
   CFPropertyListRef value;
   int ret = def;
   
-  value = [self prefs_get:key];
+  value = [self prefs_get_copy:key];
   
   if (value != NULL) {
     if (CFGetTypeID (value) == CFNumberGetTypeID ())
@@ -637,7 +638,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
   NSArray *ret = nil;
   CFPropertyListRef value;
   
-  value = [self prefs_get:key];
+  value = [self prefs_get_copy:key];
   
   if (value != NULL) {
     if (CFGetTypeID (value) == CFArrayGetTypeID ())
@@ -757,7 +758,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
     NSURL *url =  [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil];
     if(url) {
         [[SUUpdater sharedUpdater] setFeedURL:url];
-        CFRelease(url);
+        [url release];
     }
 #endif
 }
@@ -970,6 +971,7 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
 //    [[SUUpdater sharedUpdater] checkForUpdates:X11App];
 #endif
 
+    [pool release];
     [NSApp run];
     /* not reached */
 }
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 0366f3b..4872ff5 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -641,30 +641,46 @@ static int execute(const char *command) {
 static char *command_from_prefs(const char *key, const char *default_value) {
     char *command = NULL;
     
-    CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
-    CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
+    CFStringRef cfKey;
+    CFPropertyListRef PlistRef;
+
+    if(!key)
+        return NULL;
+
+    cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
+
+    if(!cfKey)
+        return NULL;
+
+    PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
     
     if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
         CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
         int len = strlen(default_value) + 1;
 
+        if(!cfDefaultValue)
+            goto command_from_prefs_out;
+
         CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
         CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+        CFRelease(cfDefaultValue);
         
         command = (char *)malloc(len * sizeof(char));
         if(!command)
-            return NULL;
+            goto command_from_prefs_out;
         strcpy(command, default_value);
     } else {
         int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
         command = (char *)malloc(len * sizeof(char));
         if(!command)
-            return NULL;
+            goto command_from_prefs_out;
         CFStringGetCString((CFStringRef)PlistRef, command, len,  kCFStringEncodingASCII);
-	}
-    
+    }
+
+command_from_prefs_out:
     if (PlistRef)
         CFRelease(PlistRef);
-    
+    if(cfKey)
+        CFRelease(cfKey);
     return command;
 }
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 89f9e10..ccf5ab4 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -73,7 +73,6 @@ static void set_x11_path(void) {
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 
     CFURLRef appURL = NULL;
-    CFBundleRef bundle = NULL;
     OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
 
     switch (osstatus) {
@@ -84,12 +83,6 @@ static void set_x11_path(void) {
                 exit(1);
             }
 
-            bundle = CFBundleCreate(NULL, appURL);
-            if(!bundle) {
-                fprintf(stderr, "Xquartz: Null value returned from CFBundleCreate().\n");
-                exit(2);                
-            }
-
             if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) {
                 fprintf(stderr, "Xquartz: Error resolving URL for %s\n", kX11AppBundleId);
                 exit(3);
diff --git a/hw/xquartz/pbproxy/x-selection.h b/hw/xquartz/pbproxy/x-selection.h
index fc903d0..614c8b0 100644
--- a/hw/xquartz/pbproxy/x-selection.h
+++ b/hw/xquartz/pbproxy/x-selection.h
@@ -58,15 +58,6 @@ struct atom_list {
     /* The unmapped window we use for fetching selections. */
     Window _selection_window;
 
-    /* Last time we declared anything on the pasteboard. */
-    int _my_last_change;
-
-    /* Name of the selection we're proxying onto the pasteboard. */
-    Atom _proxied_selection;
-
-    /* When true, we're expecting a SelectionNotify event. */
-    unsigned int _pending_notify :1;
- 
     Atom request_atom;
     
     struct {
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 2723259..d6e9a72 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -204,6 +204,7 @@ QuartzAudioIOProc(
     if (wasPlaying  &&  !data->playing) {
         OSStatus err;
         err = AudioDeviceStop(inDevice, QuartzAudioIOProc);
+        fprintf(stderr, "Error stopping audio device: %ld\n", (long int)err);
     }
     pthread_mutex_unlock(&data->lock);
     return 0;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 96b5fa5..3b4eac3 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -368,7 +368,7 @@ void DarwinKeyboardReloadHandler(void) {
     KeySymsRec keySyms;
     CFIndex initialKeyRepeatValue, keyRepeatValue;
     BOOL ok;
-    DeviceIntPtr pDev = darwinKeyboard;
+    DeviceIntPtr pDev;
     const char *xmodmap = PROJECTROOT "/bin/xmodmap";
     const char *sysmodmap = PROJECTROOT "/lib/X11/xinit/.Xmodmap";
     const char *homedir = getenv("HOME");
commit 1e9491f12b8a20fde07b7bd86e8e0ad87a6f0e08
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Feb 10 17:22:58 2010 -0800

    XQuartz: Fix a possible crash in quartzAudio fade
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index af63d18..2723259 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -141,7 +141,7 @@ static void QuartzFillBuffer(
         data->prevFrame = 0;
 
         // adjust for space eaten by prev fade
-        buffer += audiobuffer->mNumberChannels*frame;
+        b += audiobuffer->mNumberChannels*frame;
         bufferFrameCount -= frame;
         frameCount = min(bufferFrameCount, data->remainingFrames);
     }
commit 001ce71dc11287dc94cc2fbc5d35677c046e6c04
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Feb 12 23:34:57 2010 +0100

    dix: restore lastDeviceEventTime update in dixSaveScreens
    
    This was removed in 6b5978dcf1f7ac3ecc2f22df06f7000f360e2066 (Do not
    reset lastDeviceEventTime when we do dixSaveScreens), but caused a
    regression for XResetScreenSaver.  Add the lastDeviceEventTime update
    back, but restrict it to that case.
    
    X.Org bug#25855 <http://bugs.freedesktop.org/25855>
    
    Reported-by: Lubos Lunak <l.lunak at suse.cz>
    Tested-by: Lubos Lunak <l.lunak at suse.cz>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index caff1cb..2676a54 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3233,8 +3233,13 @@ dixSaveScreens(ClientPtr client, int on, int mode)
 	}
     }
     screenIsSaved = what;
-    if (mode == ScreenSaverReset)
-       SetScreenSaverTimer();
+    if (mode == ScreenSaverReset) {
+	if (on == SCREEN_SAVER_FORCER) {
+	    UpdateCurrentTimeIf();
+	    lastDeviceEventTime = currentTime;
+	}
+	SetScreenSaverTimer();
+    }
     return Success;
 }
 
commit 97b03037f4d99fcebc7603011f41c3aff9871ce2
Author: Peter Harris <pharris at opentext.com>
Date:   Fri Feb 12 15:36:30 2010 -0500

    Don't double-swap the RandR PropertyNotify event
    
    The event is already swapped in randr.c/SRROutputPropertyNotifyEvent, so
    it should not be swapped here.
    
    X.Org Bugzilla #26511: http://bugs.freedesktop.org/show_bug.cgi?id=26511
    
    Tested-by: Leonardo Chiquitto <leonardo at ngdn.org>
    Acked-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Peter Harris <pharris at opentext.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 146facb..12e30e4 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -47,11 +47,6 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
 
 	event->sequenceNumber = client->sequence;
 	event->window = pRREvent->window->drawable.id;
-	if (client->swapped) {
-	    int n;
-	    swaps(&event->sequenceNumber, n);
-	    swapl(&event->window, n);
-	}
 	WriteEventsToClient(pRREvent->client, 1, (xEvent *)event);
     }
 
commit 0b73f98cbd1803b82c2faf1a40f1a0037673d712
Author: Soeren Sandmann <sandmann at daimi.au.dk>
Date:   Fri Feb 12 20:04:53 2010 +0100

    xfree86: Add qxl driver to the autoconfig logic
    
    The qxl driver is for the QXL virtualized graphics device.
    
    Signed-off-by: Søren Sandmann Pedersen <ssp at redhat.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 1c4595e..7f4ada8 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -194,6 +194,7 @@ videoPtrToDriverList(struct pci_device *dev,
 	case 0x10c8:		    driverList[0] = "neomagic"; break;
 	case 0x10de: case 0x12d2:   driverList[0] = "nv";	break;
 	case 0x1106:		    driverList[0] = "openchrome"; break;
+        case 0x1b36:		    driverList[0] = "qxl"; break;
 	case 0x1163:		    driverList[0] = "rendition"; break;
 	case 0x5333:
 	    switch (dev->device_id)
commit 9c5bb550a2234e4bee2a144417d74c6bdf160e89
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Feb 12 13:46:03 2010 -0800

    Bump to 1.7.99.901 -- 1.8 RC1

diff --git a/configure.ac b/configure.ac
index e3280b4..de252f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.7.99.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="(unreleased)"
+AC_INIT([xorg-server], 1.7.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2010-02-12"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 57ffeb3f2b3313dcef92a396f1f55fdbc064b2c5
Merge: c6d9bc0... c76248f...
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Feb 12 13:36:32 2010 -0800

    Merge remote branch 'jturney/master'

commit c6d9bc092c84ad5c68083a126aa7577baa42cef7
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 10 15:36:50 2010 +1000

    Add tag matching to input attributes.
    
    Tags may be a list of comma-separated strings that match against a MatchTag
    InputClass section. If any of the tags specified for a device match against
    the MatchTag of the section, this match is evaluated true and passed on to
    the next match condition.
    
    Tags are specified as "input.tags" (hal) or "ID_INPUT.tags" (udev), the
    value of the tags is case-sensitive and require an exact match (not a
    substring match).
    
    i.e. "quirk" will not match "QUIRK", "need_quirk" or "quirk_needed".
    
    Example configuration:
    udev:
        ENV{ID_INPUT.tags}="foo,bar"
    
    hal:
        <merge key="input.tags" type="string">foo,bar</merge>
    
    xorg.conf:
        Section "InputClass"
                Identifier "foobar quirks"
                MatchTag "foo|foobar"
                Option "Foobar" "on"
        EndSection
    
    Where the xorg.conf section matches against any device with the tag "foo"
    or tag "foobar" set.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/config/hal.c b/config/hal.c
index 1b01ecc..d3daa84 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -164,6 +164,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
         attrs.product = xstrdup(name);
 
     attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor");
+    attrs.tags = xstrtokenize(get_prop_string(hal_ctx, udi, "input.tags"), ",");
 
     if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL))
         attrs.flags |= ATTR_KEYBOARD;
@@ -391,6 +392,14 @@ unwind:
     xfree(attrs.product);
     xfree(attrs.vendor);
     xfree(attrs.device);
+    if (attrs.tags) {
+        char **tag = attrs.tags;
+        while (*tag) {
+            xfree(*tag);
+            tag++;
+        }
+        xfree(attrs.tags);
+    }
 
     if (xkb_opts.layout)
         xfree(xkb_opts.layout);
diff --git a/config/udev.c b/config/udev.c
index 3ef0d7f..432ab85 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -84,6 +84,7 @@ device_added(struct udev_device *udev_device)
     add_option(&options, "path", path);
     add_option(&options, "device", path);
     attrs.device = path;
+    attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ",");
 
     config_info = Xprintf("udev:%s", syspath);
     if (!config_info)
@@ -150,6 +151,15 @@ device_added(struct udev_device *udev_device)
         xfree(tmpo);
     }
 
+    if (attrs.tags) {
+        char **tag = attrs.tags;
+        while (*tag) {
+            xfree(*tag);
+            tag++;
+        }
+        xfree(attrs.tags);
+    }
+
     return;
 }
 
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 4604710..c2d9f49 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -545,6 +545,24 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs)
         if (!match)
             return FALSE;
     }
+    if (iclass->match_tag) {
+        if (!attrs->tags)
+            return FALSE;
+
+        for (cur = iclass->match_tag, match = FALSE; *cur && !match; cur++) {
+            const char *tag;
+            for(tag = *attrs->tags; *tag; tag++) {
+                if (!strcmp(tag, *cur)) {
+                    match = TRUE;
+                    break;
+                }
+            }
+        }
+
+        if (!match)
+            return FALSE;
+    }
+
     if (iclass->is_keyboard.set &&
         iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD))
         return FALSE;
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 69f4751..c8a3c3a 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -1054,6 +1054,15 @@ This entry can be used to check if the device file matches the
 pathname pattern. Multiple patterns can be matched by separating arguments
 with a '|' character.
 .TP 7
+.BI "MatchTag \*q" matchtag \*q
+This entry can be used to check if tags assigned by the config backend
+matches the
+.RI \*q matchtag \*q
+pattern.  Multiple patterns can be matched by separating arguments
+with a '|' character. A match is found if at least one of the tags given in
+.RI \*q matchtag \*q
+matches at least one of the tags assigned by the backend.
+.TP 7
 .BI "MatchIsKeyboard     \*q" bool \*q
 .TP 7
 .BI "MatchIsPointer      \*q" bool \*q
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 9fabb22..7fb2866 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -47,6 +47,7 @@ xf86ConfigSymTabRec InputClassTab[] =
     {MATCH_PRODUCT, "matchproduct"},
     {MATCH_VENDOR, "matchvendor"},
     {MATCH_DEVICE_PATH, "matchdevicepath"},
+    {MATCH_TAG, "matchtag"},
     {MATCH_IS_KEYBOARD, "matchiskeyboard"},
     {MATCH_IS_POINTER, "matchispointer"},
     {MATCH_IS_JOYSTICK, "matchisjoystick"},
@@ -107,6 +108,11 @@ xf86parseInputClassSection(void)
                 Error(QUOTE_MSG, "MatchDevicePath");
             ptr->match_device = xstrtokenize(val.str, TOKEN_SEP);
             break;
+        case MATCH_TAG:
+            if (xf86getSubToken(&(ptr->comment)) != STRING)
+                Error(QUOTE_MSG, "MatchTag");
+            ptr->match_tag = xstrtokenize(val.str, TOKEN_SEP);
+            break;
         case MATCH_IS_KEYBOARD:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchIsKeyboard");
@@ -211,6 +217,14 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
                         *list);
             fprintf(cf, "\"\n");
         }
+        if (ptr->match_tag) {
+            fprintf(cf, "\tMatchTag \"");
+            for (list = ptr->match_tag; *list; list++)
+                fprintf(cf, "%s%s",
+                        list == ptr->match_tag ? "" : TOKEN_SEP,
+                        *list);
+            fprintf(cf, "\"\n");
+        }
         if (ptr->is_keyboard.set)
             fprintf(cf, "\tIsKeyboard      \"%s\"\n",
                     ptr->is_keyboard.val ? "yes" : "no");
@@ -259,6 +273,11 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
                 free(*list);
             free(ptr->match_device);
         }
+        if (ptr->match_tag) {
+            for (list = ptr->match_tag; *list; list++)
+                free(*list);
+            free(ptr->match_tag);
+        }
         TestFree(ptr->comment);
         xf86optionListFree(ptr->option_lst);
 
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index b6d40a1..d79544a 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -346,6 +346,7 @@ typedef struct
 	char **match_product;
 	char **match_vendor;
 	char **match_device;
+	char **match_tag;
 	xf86TriState is_keyboard;
 	xf86TriState is_pointer;
 	xf86TriState is_joystick;
diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h
index e3a9d71..cb60070 100644
--- a/hw/xfree86/parser/xf86tokens.h
+++ b/hw/xfree86/parser/xf86tokens.h
@@ -279,6 +279,7 @@ typedef enum {
     MATCH_PRODUCT,
     MATCH_VENDOR,
     MATCH_DEVICE_PATH,
+    MATCH_TAG,
     MATCH_IS_KEYBOARD,
     MATCH_IS_POINTER,
     MATCH_IS_JOYSTICK,
diff --git a/include/input.h b/include/input.h
index 7a6242d..4a845be 100644
--- a/include/input.h
+++ b/include/input.h
@@ -215,6 +215,7 @@ typedef struct _InputAttributes {
     char                *product;
     char                *vendor;
     char                *device;
+    char                **tags; /* null-terminated */
     uint32_t            flags;
 } InputAttributes;
 
commit 3ac43df5d4a25d6e0058b327fa05a1c1436b4794
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 10 15:36:49 2010 +1000

    Add xstrtokenize to the dix.
    
    Move tokenize out of the parser, make it a dix util function instead.
    Splitting a string into multiple substrings is useful by other places, so
    let's use it across the line. Future users include config/hal, config/udev
    and of course the parser.
    
    Example usage:
    char **substrings = xstrtokenize(my_string, "\n");
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 8041740..9fabb22 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -60,44 +60,6 @@ xf86ConfigSymTabRec InputClassTab[] =
 
 #define TOKEN_SEP "|"
 
-/*
- * Tokenize a string into a NULL terminated array of strings. Always returns
- * an allocated array unless an error occurs.
- */
-static char **
-tokenize(const char *str)
-{
-    char **list, **nlist;
-    char *tok, *tmp;
-    unsigned num = 0, n;
-
-    list = calloc(1, sizeof(*list));
-    if (!list)
-        return NULL;
-    tmp = strdup(str);
-    if (!tmp)
-        goto error;
-    for (tok = strtok(tmp, TOKEN_SEP); tok; tok = strtok(NULL, TOKEN_SEP)) {
-        nlist = realloc(list, (num + 2) * sizeof(*list));
-        if (!nlist)
-            goto error;
-        list = nlist;
-        list[num] = strdup(tok);
-        if (!list[num])
-            goto error;
-        list[++num] = NULL;
-    }
-    free(tmp);
-    return list;
-
-error:
-    TestFree(tmp);
-    for (n = 0; n < num; n++)
-        free(list[n]);
-    TestFree(list);
-    return NULL;
-}
-
 XF86ConfInputClassPtr
 xf86parseInputClassSection(void)
 {
@@ -133,17 +95,17 @@ xf86parseInputClassSection(void)
         case MATCH_PRODUCT:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchProduct");
-            ptr->match_product = tokenize(val.str);
+            ptr->match_product = xstrtokenize(val.str, TOKEN_SEP);
             break;
         case MATCH_VENDOR:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchVendor");
-            ptr->match_vendor = tokenize(val.str);
+            ptr->match_vendor = xstrtokenize(val.str, TOKEN_SEP);
             break;
         case MATCH_DEVICE_PATH:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDevicePath");
-            ptr->match_device = tokenize(val.str);
+            ptr->match_device = xstrtokenize(val.str, TOKEN_SEP);
             break;
         case MATCH_IS_KEYBOARD:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
diff --git a/include/misc.h b/include/misc.h
index 877c682..62d813e 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -210,6 +210,9 @@ pad_to_int32(const int bytes) {
     return (((bytes) + 3) & ~3);
 }
 
+extern char**
+xstrtokenize(const char *str, const char* separators);
+
 /* some macros to help swap requests, replies, and events */
 
 #define LengthRestB(stuff) \
diff --git a/os/utils.c b/os/utils.c
index d7c8388..71ab6f0 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1870,6 +1870,46 @@ CheckUserAuthorization(void)
 #endif
 }
 
+/*
+ * Tokenize a string into a NULL terminated array of strings. Always returns
+ * an allocated array unless an error occurs.
+ */
+char**
+xstrtokenize(const char *str, const char *separators)
+{
+    char **list, **nlist;
+    char *tok, *tmp;
+    unsigned num = 0, n;
+
+    if (!str)
+        return NULL;
+    list = calloc(1, sizeof(*list));
+    if (!list)
+        return NULL;
+    tmp = strdup(str);
+    if (!tmp)
+        goto error;
+    for (tok = strtok(tmp, separators); tok; tok = strtok(NULL, separators)) {
+        nlist = realloc(list, (num + 2) * sizeof(*list));
+        if (!nlist)
+            goto error;
+        list = nlist;
+        list[num] = strdup(tok);
+        if (!list[num])
+            goto error;
+        list[++num] = NULL;
+    }
+    free(tmp);
+    return list;
+
+error:
+    free(tmp);
+    for (n = 0; n < num; n++)
+        free(list[n]);
+    free(list);
+    return NULL;
+}
+
 #ifdef __SCO__
 #include <fcntl.h>
 
commit 27d1b86d1b858f931b4cb1b6ddf857c76d92a6d9
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Wed Feb 10 15:36:48 2010 +1000

    xfree86: Set fnmatch pathname flag for InputClass device matching
    
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 8ac9d26..4604710 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -535,7 +535,7 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs)
         /* see if any of the values match */
         for (cur = iclass->match_device, match = FALSE; *cur; cur++)
 #ifdef HAVE_FNMATCH_H
-            if (fnmatch(*cur, attrs->device, 0) == 0) {
+            if (fnmatch(*cur, attrs->device, FNM_PATHNAME) == 0) {
 #else
             if (strstr(attrs->device, *cur)) {
 #endif
commit 9b369f71273fb117c982e6ce16cd4462f206d365
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Wed Feb 10 15:36:47 2010 +1000

    xfree86: Allow multiple arguments to InputClass matches
    
    In order to keep the number of InputClass sections manageable, allow
    matches to contain multiple arguments. The arguments will be separated
    by the '|' character. This allows a policy to apply to multiple types of
    devices. For example:
    
        Section "InputClass"
            Identifier "Inverted Mice"
            MatchProduct "Crazy Mouse|Silly Mouse"
            Option "InvertX" "yes"
        EndSection
    
    This applies to the MatchProduct, MatchVendor and MatchDevicePath
    entries. Currently there is no way to escape characters, so names or
    patterns cannot contain '|'.
    
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index b37dae6..8ac9d26 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -502,20 +502,49 @@ AddOtherInputDevices(void)
 static Bool
 InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs)
 {
-    if (iclass->match_product &&
-        (!attrs->product || !strstr(attrs->product, iclass->match_product)))
-        return FALSE;
-    if (iclass->match_vendor &&
-        (!attrs->vendor || !strstr(attrs->vendor, iclass->match_vendor)))
-        return FALSE;
-    if (iclass->match_device &&
+    char **cur;
+    Bool match;
+
+    if (iclass->match_product) {
+        if (!attrs->product)
+            return FALSE;
+        /* see if any of the values match */
+        for (cur = iclass->match_product, match = FALSE; *cur; cur++)
+            if (strstr(attrs->product, *cur)) {
+                match = TRUE;
+                break;
+            }
+        if (!match)
+            return FALSE;
+    }
+    if (iclass->match_vendor) {
+        if (!attrs->vendor)
+            return FALSE;
+        /* see if any of the values match */
+        for (cur = iclass->match_vendor, match = FALSE; *cur; cur++)
+            if (strstr(attrs->vendor, *cur)) {
+                match = TRUE;
+                break;
+            }
+        if (!match)
+            return FALSE;
+    }
+    if (iclass->match_device) {
+        if (!attrs->device)
+            return FALSE;
+        /* see if any of the values match */
+        for (cur = iclass->match_device, match = FALSE; *cur; cur++)
 #ifdef HAVE_FNMATCH_H
-        (!attrs->device ||
-         fnmatch(iclass->match_device, attrs->device, 0) != 0))
+            if (fnmatch(*cur, attrs->device, 0) == 0) {
 #else
-        (!attrs->device || !strstr(attrs->device, iclass->match_device)))
+            if (strstr(attrs->device, *cur)) {
 #endif
-        return FALSE;
+                match = TRUE;
+                break;
+            }
+        if (!match)
+            return FALSE;
+    }
     if (iclass->is_keyboard.set &&
         iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD))
         return FALSE;
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index ee91b9a..69f4751 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -1039,17 +1039,20 @@ The allowed matching entries are shown below.
 .BI "MatchProduct  \*q" matchproduct \*q
 This entry can be used to check if the substring
 .RI \*q matchproduct \*q
-occurs in the device's product name.
+occurs in the device's product name. Multiple substrings can be matched by
+separating arguments with a '|' character.
 .TP 7
 .BI "MatchVendor  \*q" matchvendor \*q
 This entry can be used to check if the substring
 .RI \*q matchvendor \*q
-occurs in the device's vendor name.
+occurs in the device's vendor name. Multiple substrings can be matched by
+separating arguments with a '|' character.
 .TP 7
 .BI "MatchDevicePath \*q" matchdevice \*q
 This entry can be used to check if the device file matches the
 .RI \*q matchdevice \*q
-pathname pattern.
+pathname pattern. Multiple patterns can be matched by separating arguments
+with a '|' character.
 .TP 7
 .BI "MatchIsKeyboard     \*q" bool \*q
 .TP 7
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 1c98160..8041740 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -29,6 +29,8 @@
 #include <xorg-config.h>
 #endif
 
+#include <string.h>
+#include "os.h"
 #include "xf86Parser.h"
 #include "xf86tokens.h"
 #include "Configint.h"
@@ -56,6 +58,46 @@ xf86ConfigSymTabRec InputClassTab[] =
 
 #define CLEANUP xf86freeInputClassList
 
+#define TOKEN_SEP "|"
+
+/*
+ * Tokenize a string into a NULL terminated array of strings. Always returns
+ * an allocated array unless an error occurs.
+ */
+static char **
+tokenize(const char *str)
+{
+    char **list, **nlist;
+    char *tok, *tmp;
+    unsigned num = 0, n;
+
+    list = calloc(1, sizeof(*list));
+    if (!list)
+        return NULL;
+    tmp = strdup(str);
+    if (!tmp)
+        goto error;
+    for (tok = strtok(tmp, TOKEN_SEP); tok; tok = strtok(NULL, TOKEN_SEP)) {
+        nlist = realloc(list, (num + 2) * sizeof(*list));
+        if (!nlist)
+            goto error;
+        list = nlist;
+        list[num] = strdup(tok);
+        if (!list[num])
+            goto error;
+        list[++num] = NULL;
+    }
+    free(tmp);
+    return list;
+
+error:
+    TestFree(tmp);
+    for (n = 0; n < num; n++)
+        free(list[n]);
+    TestFree(list);
+    return NULL;
+}
+
 XF86ConfInputClassPtr
 xf86parseInputClassSection(void)
 {
@@ -91,17 +133,17 @@ xf86parseInputClassSection(void)
         case MATCH_PRODUCT:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchProduct");
-            ptr->match_product = val.str;
+            ptr->match_product = tokenize(val.str);
             break;
         case MATCH_VENDOR:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchVendor");
-            ptr->match_vendor = val.str;
+            ptr->match_vendor = tokenize(val.str);
             break;
         case MATCH_DEVICE_PATH:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
                 Error(QUOTE_MSG, "MatchDevicePath");
-            ptr->match_device = val.str;
+            ptr->match_device = tokenize(val.str);
             break;
         case MATCH_IS_KEYBOARD:
             if (xf86getSubToken(&(ptr->comment)) != STRING)
@@ -173,6 +215,8 @@ xf86parseInputClassSection(void)
 void
 xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
 {
+    char **list;
+
     while (ptr) {
         fprintf(cf, "Section \"InputClass\"\n");
         if (ptr->comment)
@@ -181,12 +225,30 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
             fprintf(cf, "\tIdentifier      \"%s\"\n", ptr->identifier);
         if (ptr->driver)
             fprintf(cf, "\tDriver          \"%s\"\n", ptr->driver);
-        if (ptr->match_product)
-            fprintf(cf, "\tMatchProduct    \"%s\"\n", ptr->match_product);
-        if (ptr->match_vendor)
-            fprintf(cf, "\tMatchVendor     \"%s\"\n", ptr->match_vendor);
-        if (ptr->match_device)
-            fprintf(cf, "\tMatchDevicePath \"%s\"\n", ptr->match_device);
+        if (ptr->match_product) {
+            fprintf(cf, "\tMatchProduct    \"");
+            for (list = ptr->match_product; *list; list++)
+                fprintf(cf, "%s%s",
+                        list == ptr->match_product ? "" : TOKEN_SEP,
+                        *list);
+            fprintf(cf, "\"\n");
+        }
+        if (ptr->match_vendor) {
+            fprintf(cf, "\tMatchVendor     \"");
+            for (list = ptr->match_vendor; *list; list++)
+                fprintf(cf, "%s%s",
+                        list == ptr->match_vendor ? "" : TOKEN_SEP,
+                        *list);
+            fprintf(cf, "\"\n");
+        }
+        if (ptr->match_device) {
+            fprintf(cf, "\tMatchDevicePath \"");
+            for (list = ptr->match_device; *list; list++)
+                fprintf(cf, "%s%s",
+                        list == ptr->match_device ? "" : TOKEN_SEP,
+                        *list);
+            fprintf(cf, "\"\n");
+        }
         if (ptr->is_keyboard.set)
             fprintf(cf, "\tIsKeyboard      \"%s\"\n",
                     ptr->is_keyboard.val ? "yes" : "no");
@@ -215,13 +277,26 @@ void
 xf86freeInputClassList (XF86ConfInputClassPtr ptr)
 {
     XF86ConfInputClassPtr prev;
+    char **list;
 
     while (ptr) {
         TestFree(ptr->identifier);
         TestFree(ptr->driver);
-        TestFree(ptr->match_product);
-        TestFree(ptr->match_vendor);
-        TestFree(ptr->match_device);
+        if (ptr->match_product) {
+            for (list = ptr->match_product; *list; list++)
+                free(*list);
+            free(ptr->match_product);
+        }
+        if (ptr->match_vendor) {
+            for (list = ptr->match_vendor; *list; list++)
+                free(*list);
+            free(ptr->match_vendor);
+        }
+        if (ptr->match_device) {
+            for (list = ptr->match_device; *list; list++)
+                free(*list);
+            free(ptr->match_device);
+        }
         TestFree(ptr->comment);
         xf86optionListFree(ptr->option_lst);
 
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index 5e8351f..b6d40a1 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -343,9 +343,9 @@ typedef struct
 	GenericListRec list;
 	char *identifier;
 	char *driver;
-	char *match_product;
-	char *match_vendor;
-	char *match_device;
+	char **match_product;
+	char **match_vendor;
+	char **match_device;
 	xf86TriState is_keyboard;
 	xf86TriState is_pointer;
 	xf86TriState is_joystick;
commit a378e361a5de89f0be8b68ebc3e854f56cefe666
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Wed Feb 10 15:36:46 2010 +1000

    xfree86: Use "Ignore" option in InputClass to skip devices
    
    Sometimes it is desirable to skip adding specific input devices to the
    server. The "Ignore" option is used similarly to Monitor sections so
    that matched devices will not be added. BadIDChoice is returned to the
    config backend so that it will clean up all resources.
    
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 6cbc23e..b37dae6 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -574,6 +574,27 @@ MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
     return Success;
 }
 
+static Bool
+IgnoreInputClass(IDevPtr idev, InputAttributes *attrs)
+{
+    XF86ConfInputClassPtr cl;
+    Bool ignore;
+
+    for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) {
+        if (!InputClassMatches(cl, attrs))
+            continue;
+        if (xf86findOption(cl->option_lst, "Ignore")) {
+            ignore = xf86CheckBoolOption(cl->option_lst, "Ignore", FALSE);
+            if (ignore)
+                xf86Msg(X_CONFIG,
+                        "%s: Ignoring device from InputClass \"%s\"\n",
+                        idev->identifier, cl->identifier);
+            return ignore;
+        }
+    }
+    return FALSE;
+}
+
 /**
  * Create a new input device, activate and enable it.
  *
@@ -736,6 +757,11 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
 
     /* Apply InputClass settings */
     if (attrs) {
+        if (IgnoreInputClass(idev, attrs)) {
+            rval = BadIDChoice;
+            goto unwind;
+        }
+
         rval = MergeInputClasses(idev, attrs);
         if (rval != Success)
             goto unwind;
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index baabdb5..ee91b9a 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -1070,11 +1070,20 @@ When an input device has been matched to the
 .B InputClass
 section, any
 .B Option
-entries are applied to the device. See the
+entries are applied to the device. One
+.B InputClass
+specific
+.B Option
+is recognized. See the
 .B InputDevice
-section above for a description of the various
+section above for a description of the remaining
 .B Option
 entries.
+.TP 7
+.BI "Option \*qIgnore\*q \*q" boolean \*q
+This optional entry specifies that the device should be ignored entirely,
+and not added to the server. This can be useful when the device is handled
+by another program and no X events should be generated.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
commit 8b1a685f00ae76be864cc188943a0874f48b8d64
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Wed Feb 10 15:36:45 2010 +1000

    xfree86: Handle config files ending without newline
    
    The config parser expects to find a newline at the end of each line, so
    files ending without one would confuse it. A newline is inserted at the
    end of the buffer in these situations. Additionally, switching to the
    next config file is moved to the higher level to allow parsing of the
    last line of the previous file to complete before shifting the index and
    resetting the line number.
    
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
    Tested-by: Stephan Raue<stephan.raue at gmx.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index b80fbfb..03cbc8a 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -227,13 +227,15 @@ xf86getNextLine(void)
 			    configFiles[curFileIndex].file);
 
 		if (!ret) {
-			/* stop if there are no more files */
-			if (++curFileIndex >= numFiles) {
-				curFileIndex = 0;
+			/*
+			 * if the file doesn't end in a newline, add one
+			 * and trigger another read
+			 */
+			if (pos != 0) {
+				strcpy(&configBuf[pos], "\n");
+				ret = configBuf;
+			} else
 				break;
-			}
-			configLineNo = 0;
-			continue;
 		}
 
 		/* search for EOL in the new block of chars */
@@ -338,7 +340,17 @@ again:
 			}
 			if (ret == NULL)
 			{
-				return (pushToken = EOF_TOKEN);
+				/*
+				 * if necessary, move to the next file and
+				 * read the first line
+				 */
+				if (curFileIndex + 1 < numFiles) {
+					curFileIndex++;
+					configLineNo = 0;
+					goto again;
+				}
+				else
+					return (pushToken = EOF_TOKEN);
 			}
 			configLineNo++;
 			configPos = 0;
commit 67bc278a511ca6ec42e1f8d2d5897c0109e94e2c
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Wed Feb 10 15:36:44 2010 +1000

    xfree86: Make InputClass docs and comments match reality
    
    Drivers and options specified in InputClass sections work on a "first
    match wins" strategy. Let's be consistent when documenting it.
    
    Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index fb0ee9c..6cbc23e 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -538,9 +538,9 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs)
 }
 
 /*
- * Merge in any InputClass configurations. Each InputClass section can
- * add to the original device configuration as well as any previous
- * InputClass sections.
+ * Merge in any InputClass configurations. Options in each InputClass
+ * section have less priority than the original device configuration as
+ * well as any previous InputClass sections.
  */
 static int
 MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 222530b..baabdb5 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -1021,7 +1021,7 @@ The
 entry specifies the name of the driver to use for this input device.
 After all classes have been examined, the
 .RI \*q inputdriver \*q
-module from the final
+module from the first
 .B Driver
 entry will be enabled when using the loadable server.
 .PP
commit c76248fda99c38aef0ccf0ed6b58fbe95f6fe497
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Feb 2 20:53:44 2010 +0000

    Cygwin/X: Avoid a collision between DEBUG and a token name
    
    Rename a token to avoid a collision between DEBUG defined via AC_DEFINE
    if --enable-debug is configured, and the token for the 'debug' instruction
    in the XWin preferences file
    
    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/winprefslex.l b/hw/xwin/winprefslex.l
index 9a384a2..463dff4 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -88,7 +88,7 @@ ATSTART                 { return ATSTART; }
 ATEND                   { return ATEND; }
 EXEC                    { return EXEC; }
 ALWAYSONTOP             { return ALWAYSONTOP; }
-DEBUG                   { return DEBUG; }
+DEBUG                   { return DEBUGOUTPUT; }
 RELOAD                  { return RELOAD; }
 TRAYICON                { return TRAYICON; }
 SILENTEXIT		{ return SILENTEXIT; }
diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 73f1659..0acf160 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -115,7 +115,7 @@ extern int yylex(void);
 %token ATEND
 %token EXEC
 %token ALWAYSONTOP
-%token DEBUG
+%token DEBUGOUTPUT "DEBUG"
 %token RELOAD
 %token TRAYICON
 %token FORCEEXIT
@@ -243,7 +243,7 @@ forceexit:	FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
 silentexit:	SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
 	;
 
-debug: 	DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
+debug: 	DEBUGOUTPUT STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
 	;
 
 
commit b7dbbd3cd4d28cd4939706b3bf6394ba8ecafaff
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Nov 22 23:35:09 2009 +0000

    Cygwin/X: Avoid cursor size log spam
    
    Fedora 12 likes to use a 39x26 animated wait cursor.  Avoid spamming
    the log with warnings that each frame can't be completely contained
    in the 32x32 native cursor
    
    Also reformat log message so it doesn't contain a '\n\t'. I mean,
    it's not like we might want to grep the log or something...
    
    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/wincursor.c b/hw/xwin/wincursor.c
index ce98162..7f1935a 100644
--- a/hw/xwin/wincursor.c
+++ b/hw/xwin/wincursor.c
@@ -188,8 +188,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
   if (pScreenPriv->cursor.sm_cx < pCursor->bits->width || 
       pScreenPriv->cursor.sm_cy < pCursor->bits->height)
     {
-      winErrorFVerb (2, "winLoadCursor - Windows requires %dx%d cursor\n"
-	      "\tbut X requires %dx%d\n",
+      winErrorFVerb (3, "winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n",
 	      pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
 	      pCursor->bits->width, pCursor->bits->height);
     }
commit c9cbbd5d1cfa58a2d9f08e25534ea8439284322d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sat Nov 28 17:51:33 2009 +0000

    Repair '-nolock'
    
    commit 446fe9eecddd1337f9d5164dd7c301e1ba3dfe32 removes the AC_DEFINE for
    SERVER_LOCK and conditional compilation checking it, making it always on
    everywhere, except in os/utils.c where code is left under SERVER_LOCK, which
    now never gets built, making the '-nolock' option non-functional...
    
    This seems to have been broken since Xserver 1.7.0, but this option is
    actually of some slight use on cygwin, as if /tmp resides on a FAT filesystem
    (yes, I know...), hard links aren't supported.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/os/utils.c b/os/utils.c
index d7c8388..1edbc5b 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -504,9 +504,7 @@ void UseMsg(void)
 #ifdef RLIMIT_STACK
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
-#ifdef SERVER_LOCK
     ErrorF("-nolock                disable the locking mechanism\n");
-#endif
 #ifndef NOLOGOHACK
     ErrorF("-logo                  enable logo in screen saver\n");
     ErrorF("nologo                 disable logo in screen saver\n");
@@ -758,7 +756,6 @@ ProcessCommandLine(int argc, char *argv[])
 		UseMsg();
 	}
 #endif
-#ifdef SERVER_LOCK
 	else if ( strcmp ( argv[i], "-nolock") == 0)
 	{
 #if !defined(WIN32) && !defined(__CYGWIN__)
@@ -768,7 +765,6 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
 	    nolock = TRUE;
 	}
-#endif
 #ifndef NOLOGOHACK
 	else if ( strcmp( argv[i], "-logo") == 0)
 	{
commit 7f54ccafadf99c0a1a3e788734199b306b4fa51d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Jan 16 13:12:12 2009 +0000

    Cygwin/X: Make transient windows resizable again
    
    Reverts the change which makes parented windows non-resizeable
    
    Because this was trying to do something which we should be doing, as an alternative we
    try checking WM_NORMAL_HINTS for windows which shouldn't  be resizable
    
    If a window has a maximum size specified, no maximize box
    If a window has a fixed size (max size == min size, per EWMH 1.3 Implementation Notes), no resizing frame
    
    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 e92170d..21d913e 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1537,6 +1537,7 @@ winDeinitMultiWindowWM (void)
 #define HINT_BORDER	(1L<<1)
 #define HINT_SIZEBOX	(1l<<2)
 #define HINT_CAPTION	(1l<<3)
+#define HINT_NOMAXIMIZE (1L<<4)
 /* These two are used on their own */
 #define HINT_MAX	(1L<<0)
 #define HINT_MIN	(1L<<1)
@@ -1618,7 +1619,32 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
     if (pAtom) XFree(pAtom);
   }
 
-  /* Apply Styles, overriding hint settings from above */
+  {
+    XSizeHints *normal_hint = XAllocSizeHints();
+    long supplied;
+    if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) == Success))
+      {
+        if (normal_hint->flags & PMaxSize)
+          {
+            /* Not maximizable if a maximum size is specified */
+            hint |= HINT_NOMAXIMIZE;
+
+            if (normal_hint->flags & PMinSize)
+              {
+                /*
+                  If both minimum size and maximum size are specified and are the same,
+                  don't bother with a resizing frame
+                */
+                if ((normal_hint->min_width == normal_hint->max_width)
+                    && (normal_hint->min_height == normal_hint->max_height))
+                  hint = (hint & ~HINT_SIZEBOX);
+              }
+          }
+      }
+    XFree(normal_hint);
+  }
+
+  /* Override hint settings from above with settings from config file */
   style = winOverrideStyle((unsigned long)pWin);
   if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
   else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
@@ -1635,14 +1661,21 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
   else if (style & STYLE_NOFRAME)
 	hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME;
 
+  /* Now apply styles to window */
   style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */
   if (!style) return;
-  if (!hint) /* All on, but no resize of children is allowed */
-    style = style | WS_CAPTION | (GetParent(hWnd) ? 0 : WS_SIZEBOX);
-  else if (hint & HINT_NOFRAME); /* All off, so do nothing */
+
+  if (!hint) /* All on */
+    style = style | WS_CAPTION | WS_SIZEBOX;
+  else if (hint & HINT_NOFRAME) /* All off */
+    style = style & ~WS_CAPTION & ~WS_SIZEBOX;
   else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) |
-		((hint & HINT_SIZEBOX) ? (GetParent(hWnd) ? 0 : WS_SIZEBOX) : 0) |
+		((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
 		((hint & HINT_CAPTION) ? WS_CAPTION : 0);
+
+  if (hint & HINT_NOMAXIMIZE)
+    style = style & ~WS_MAXIMIZEBOX;
+
   SetWindowLongPtr (hWnd, GWL_STYLE, style);
 }
 
commit 654d2e372dc2978ce379ab9f02137333ec224f0c
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Nov 10 13:24:40 2009 +0000

    Cygwin/X: Discourage other WMs in multiwindow mode
    
    Tidying up of other WM detection code when ading SWT/Motif
    fix in commit 71519a572fe15b85c0eb2b02636c9e871f2c858f
    was rather over-agressive and now allows other WMs to think
    they can start when the internal WM is running.
    
    Revert to the behaviour of selecting ButtonPressMask events
    as well on the root window, so other WMs will be dissuaded
    from starting
    
    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 e39cbc1..e92170d 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -191,7 +191,7 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
 #endif
 
 static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen);
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM);
 
 static void
 winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle);
@@ -967,7 +967,7 @@ winMultiWindowXMsgProc (void *pArg)
 	  "successfully opened the display.\n");
 
   /* Check if another window manager is already running */
-  g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+  g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, pProcArg->pWMInfo->fAllowOtherWM);
 
   if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM)
     {
@@ -1018,7 +1018,7 @@ winMultiWindowXMsgProc (void *pArg)
 
       if (pProcArg->pWMInfo->fAllowOtherWM && !XPending (pProcArg->pDisplay))
 	{
-	  if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
+	  if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen, TRUE))
 	    {
 	      if (!g_fAnotherWMRunning)
 		{
@@ -1496,7 +1496,7 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
  */
 
 static Bool
-CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen, Bool fAllowOtherWM)
 {
   /*
     Try to select the events which only one client at a time is allowed to select.
@@ -1511,8 +1511,12 @@ CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
 
   /*
     Side effect: select the events we are actually interested in...
+
+    If other WMs are not allowed, also select one of the events which only one client
+    at a time is allowed to select, so other window managers won't start...
   */
-  XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), SubstructureNotifyMask);
+  XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
+               SubstructureNotifyMask | ( !fAllowOtherWM ? ButtonPressMask : 0));
   XSync (pDisplay, 0);
   return redirectError;
 }
commit 26857b1c2003797b02e258247f63064aa1e37c10
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sat Oct 31 17:19:17 2009 +0000

    Cygwin/X: Update XWin man page
    
    Restructure to group similar options and offer some commentary on those groups
    Review option descriptions, clarify and bring up-to-date
    
    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/XWin.man.pre b/hw/xwin/XWin.man.pre
index 0bad65c..6b28b51 100644
--- a/hw/xwin/XWin.man.pre
+++ b/hw/xwin/XWin.man.pre
@@ -9,83 +9,171 @@ XWin \- X Server for the Cygwin environment on Microsoft Windows
 
 
 .SH DESCRIPTION
-.I XWin is an X Server for the X Window System on the Cygwin environment
+\fIXWin\fP is an X Server for the X Window System on the Cygwin environment
 running on Microsoft Windows.
 
 
 .SH MODES
-\fIXWin\fP can operate in five different and incompatible modes:
+\fIXWin\fP can operate in 3 different modes:
 .br
-* \fISingle Window\fP: This is the default option.  The X server
-appears as a single Windows window and all X windows are contained
-within this window.  This mode requires an external window manager.
-.br
-* \fINo Decoration\fP: This mode is like single window mode except
-that the X server window does not have a title bar or border, thus
-maximizing the amount of space available for X windows within the X
-server window.  This mode requires an external window manager.
-.br
-* \fIFull Screen\fP: This mode is like single window mode except that
-the X server window takes the full screen, covering completely the
-Windows desktop.  This mode requires an external window manager.
-.br
-* \fIRootless\fP: The X server works on a window covering the whole
-screen but the root window (traditionally covered with an X hatch
-pattern) is hidden from view.  This mode requires an external window
-manager.
+* \fISingle Window\fP: This is the default mode.  Each X screen
+appears as a single \fIWindows\fP window and all X windows are contained
+within this window.
+(In X terminology, the \fIWindows\fP window contains the root window for
+the screen)
 .br
 * \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated
 window manager in order to handle the top-level X windows, in such a
-way that they appear as normal Windows windows.
+way that they appear as normal \fIWindows\fP windows.
+.br
+* \fIRootless\fP: In this mode the X server works in a window
+containing the whole screen but this root window (traditionally covered with an X hatch
+pattern) is hidden from view, so only top-level X windows are seen.
+
+.SH OPTIONS
+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:
+
+.SH OPTIONS CONTROLLING WINDOWING MODE
+Only one of these options may be specified.
+.TP 8
+.B (default)
+Windowed or rooted mode.
+Each X screen appears as a single \fIWindows\fP window and all X windows are
+contained within those windows.
+.TP 8
+.B \-multiwindow
+Each top-level X window appears in its own \fIWindows\fP window.
+Also start the integrated \fIWindows\fP-based window manager.
+.TP 8
+.B \-rootless
+Run the server in rootless mode.
+The X server works on a window covering the whole screen but the root window
+is hidden from view.
+.TP 8
+.B \-mwextwm
+Experimental.
+The mode combines \fB\-rootless\fP mode drawing with native \fIWindows\fP
+window frames managed by the experimental external window manager \fIxwinwm\fP.
 .PP
-NOTE: \fIMulti-Window\fP mode will crash if an external window manager
-such as \fItwm\fP or \fIfvwm\fP is launched since \fIMulti-Window\fP
-uses its own internal window manager; all other modes require an
-external window manager in order to move, resize, and perform other
+\fBNOTE:\fP \fI-multiwindow\fP mode uses its own internal window manager.
+All other modes require an external window manager in order to move, resize, and perform other
 operations on the individual X windows.
 
+.SH OPTIONS FOR SPECIFYING X SCREENS
+An X display may be composed of multiple screens.
+The default behaviour is to create a single screen 0 that is roughly the
+size of useful area of the primary monitor (allowing for any window
+decorations and the task-bar).
 
-.SH LOG
-As it runs \fIXWin\fP writes messages indicating the most relevant events
-to  the console
-from which it was called and to a log file that by default is located at \fI
-__logdir__/XWin.0.log\fP.  This file is mainly for debugging purposes.
+Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
+default to all screens by placing those screen specific parameters
+before any \fB\-screen\fP parameter.  Screen specific parameters placed after
+the first \fB\-screen\fP parameter will apply only to the immediately
+preceeding \fB\-screen\fP parameter.
+.TP 8
+.B \-[no]multimonitors or \-[no]multiplemonitors
+Create a screen 0 that covers all monitors [the primary monitor] on a system with
+multiple monitors.
+This option is currently enabled by default in \fB\-multiwindow\fP mode.
+.TP 8
+.B "\-screen \fIscreen_number\fP [\fIW\fP \fIH\fP [\fIX\fP \fIY\fP] | [[\fIW\fPx\fIH\fP[+\fIX\fP+\fIY\fP]][@\fIM\fP]] ] "
+Create screen number
+.I screen_number
+and optionally specify it's
+.I height,
+.I width
+and
+.I initial position.
+Additionally a
+.I
+monitor number
+(which count from 1) can be specified to place the screen on,
+at which point, all coordinates become relative to that monitor.
+Screen numbers must be contiguous starting from zero and cannot be duplicated.
 
+Examples:
 
-.SH PREFERENCES FILE
-On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if
-the previous file does not exist, \fI
-__sysconfdir__/X11/system.XWinrc\fP.  \fI.XWinrc\fP allows setting
-preferences for the following:
-.br
-1- To include items into the menu associated with the \fIXWin\fP icon
-which is in the \fIWindows\fP system tray.  This functions in all
-modes that have a tray icon.
-.br
-2- To include items in the menu which is associated with the Windows
-window that \fIXWin -multiwindow\fP produces for each top-level X
-window.  That can be done both for the generic case and for particular
-programs.
-.br
-3- To change the icon that is associated to the Windows window that
-\fIXWin -multiwindow\fP produces for each top-level X-window.  Again,
-that can be done both for the generic case and for particular
-programs.
-.PP
-The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
+.I "  -screen 0 @1 ; on 1st monitor using its full resolution (the default)"
 
+.I "  -screen 0 800x600+100+100 at 2 ; on 2nd monitor offset 100,100 size 800x600"
 
-.SH OPTIONS
-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:
+.I "  -screen 0 1024x768 at 3        ; on 3rd monitor size 1024x768"
+
+.SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
+These parameters only apply to windowed mode screens i.e. not
+in \fB-multwindow\fP or \fB-rootless\fP mode
+.TP 8
+.B "\-fullscreen"
+The X server window takes the full screen, covering completely the
+\fIWindows\fP desktop.
+.TP 8
+.B \-nodecoration
+Do not give the Cygwin/X window a \fIWindows\fP window border, title bar,
+etc.
+This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+.TP 8
+.B \-scrollbars
+In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
+Moreover, if the window has decorations, one can now resize it.
+This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+
+
+.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
 .TP 8
 .B \-[no]clipboard
 Enables [disables] the integration between the Cygwin/X clipboard and
-Windows clipboard.  The default is enabled.
+\fIWindows\fP clipboard.  The default is enabled.
+.TP 8
+.B "\-emulate3buttons [\fItimeout\fP]"
+Emulate a three button mouse; pressing both buttons within
+.I timeout
+milliseconds causes an emulated middle button press.  The default
+.I timeout
+is 50 milliseconds.  Note that most mice with scroll wheel have middle
+button functionality, usually you will need this option only if you have
+a two button mouse without scroll wheel.
+.TP 8
+.B \-[no]keyhook
+Enable [disable] a low-level keyboard hook for catching
+special keypresses like Menu and Alt+Tab and passing them to the X
+Server instead of letting \fIWindows\fP handle them.
+.TP 8
+.B \-lesspointer
+Normally the \fIWindows\fP mouse cursor is hidden when the mouse is
+over an active Cygwin/X window.  This option causes the mouse cursor
+also to be hidden when it is over an inactive Cygwin/X window.  This
+prevents the \fIWindows\fP mouse cursor from being drawn on top of the X
+cursor.
+This parameter has no effect unless \fB-swcursor\fP is also specified.
+.TP 8
+.B \-swcursor
+Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead.
+.TP 8
+.B \-[no]trayicon
+Do not create a tray icon.  Default is to create one
+icon per screen.  You can globally disable tray icons with
+\fB\-notrayicon\fP, then enable it for specific screens with
+\fB\-trayicon\fP for those screens.
+.TP 8
+.B \-nounicodeclipboard
+Do not use Unicode clipboard even if on a NT-based platform.
+.TP 8
+.B \-[no]unixkill
+Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a
+signal to exit the X Server.  The \fICtrl-Alt-Backspace\fP key combination
+is disabled by default.
+.TP 8
+.B \-[no]winkill
+Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
+X Server.
+The \fIAlt-F4\fP key combination is enabled by default.
+
+.SH DRAWING ENGINE OPTIONS
 .TP 8
 .B "\-clipupdates \fInum_boxes\fP"
-Specify an optional threshold, above which the boxes in a shadow
+Specify an optional threshold, above which the regions in a shadow
 update operation will be collected into a GDI clipping region.  The
 clipping region is then used to do a single bit block transfer that is
 constrained to the updated area by the clipping region.  There is some
@@ -94,36 +182,24 @@ the clipping region, thus there may not be much benefit for a small
 number of boxes (less than 10).  It is even possible that this
 functionality does not provide a benefit at any number of boxes; we
 can only determine the usefulness of this feature through testing.
+This option probably has limited effect on current \fIWindows\fP versions
+as they already perform GDI batching.
 This parameter works in conjunction with engines 1, 2, and 4 (Shadow
 GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking,
 respectively).
 .TP 8
-.B "\-emulate3buttons \fItimeout\fP"
-Emulate a three button mouse; pressing both buttons within
-.I timeout
-milliseconds causes an emulated middle button press.  The default
-.I timeout
-is 50 milliseconds.  Note that most mice with scroll wheel have middle
-button functionality, usually you will need this option only if you have
-a two button mouse without scroll wheel.
-.TP 8
-.B \-emulatepseudo
-Create a depth 8 PseudoColor visual when running in depths 15, 16, 24,
-or 32, collectively known as TrueColor depths.
- At this date (April 2004) this option is not still operative.
-.TP 8
 .B "\-engine \fIengine_type_id\fP"
 This option, which is intended for Cygwin/X developers,
-overrides the server's automatically supported engine type.  This
+overrides the server's automatically selected engine type.  This
 parameter will be ignored if the specified engine type is not
 supported on the current system.  The supported engine type ids are 1
-- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw4.
-Additionally, there is a barely functional experimental engine type id
-16 - Native GDI.
-.TP 8
-.B "\-fullscreen [-depth \fIdepth\fP] [-refresh \fIrate_in_Hz\fP]"
-Run the server in fullscreen mode, as opposed to the default windowed
-mode.
+- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking.
+Additionally, there are engines with type ids
+8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional).
+Default behavior is to determine the engine with optimum performance that
+supports the specified depth and window configuration.
+
+.SH FULLSCREEN OPTIONS
 .TP 8
 .B "\-depth \fIdepth\fP"
 Specify the color depth, in bits per pixel, to use when running in
@@ -134,104 +210,37 @@ fullscreen with a DirectDraw engine.  This parameter is ignored if
 Specify an optional refresh rate to use when running in
 fullscreen with a DirectDraw engine.  This parameter is ignored if
 \fB\-fullscreen\fP is not specified.
+
+.SH MISCELLANEOUS OPTIONS
+See also the normal server options described in the \fIXserver(1)\fP
+manual page
+
 .TP 8
 .B \-help
-Write a help text to the console and to the log file.
+Write a help text listing supported command line options and their description to the console.
 .TP 8
 .B \-ignoreinput
 Ignore keyboard and mouse input.  This is usually only used for testing
 and debugging purposes.
 .TP 8
-.B \-[no]keyhook
-Enable [disable] a low-level keyboard hook for catching
-special key combinations like Alt+Tab and passing them to the X
-Server instead of letting \fIWindows\fP handle them.
-.TP 8
-.B \-lesspointer
-Hide the Windows mouse cursor when the mouse is over any Cygwin/X
-window (regardless of whether that window is active or inactive).  This
-prevents the Windows mouse cursor from being placed overtop of the X
-cursor.
-.TP 8
-.B "\-logfile \fIFile_Name\fP"
-Change the log file from the default located at \fI
-__logdir__/XWin.0.log\fP to the one indicated by \fIFile_Name\fP.
+.B "\-logfile \fIfilename\fP"
+Change the server log file from the default of \fI
+__logdir__/XWin.n.log\fP,
+where \fIn\fP is the display number of the XWin server, to \fIfilename\fP.
 .TP 8
 .B "\-logverbose \fIlevel\fP"
 Control the degree of verbosity of the log messages with the integer
 parameter \fIlevel\fP.  For \fIlevel\fP=0 only fatal errors are
-reported, for \fIlevel\fP=1 (default) simple information about
-configuration is also given, for \fIlevel\fP=2 a detailed log
+reported, for \fIlevel\fP=1 simple information about
+configuration is also given, for \fIlevel\fP=2 (default)
+additional runtime information is recorded
+and for \fIlevel\fP=3 detailed log
 information (including trace and debug output) is produced.  Bigger
-values will yield a still more detailed debug output.  At this date
-(April 2004) the option is still not fully operative; the default
-value is 2 and the output is insensitive to the level value.
-.TP 8
-.B \-multimonitors
-Create a root window that covers all monitors on a system with
-multiple monitors.
-.TP 8
-.B \-multiwindow
-Start the integrated \fIWindowsi\fP-based window manager, which launches each
-top-level X window in its own \fIWindows\fP window.  Not to be used together
-with \fB\-rootless\fP nor \fB\-fullscreen\fP.
-.TP 8
-.B \-nodecoration
-Do not give the Cygwin/X window a Windows window border, title bar,
-etc.  This parameter only applies to windowed mode screens, i.e., this
-parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
-.TP 8
-.B \-nounicodeclipboard
-Do not use Unicode clipboard even if NT-based platform.
-.TP 8
-.B \-rootless
-Run the server in rootless mode.  Not to be used with \fB\-multiwindow\fP
-nor with \fB\-fullscreen\fP.
-.TP 8
-.B "\-screen \fIscreen_number\fP \fIwidth\fP \fIheight\fP"
-This parameter may be used to specify the
-.I screen_number,
-.I height,
-and
-.I width
-of one or several Cygwin/X screens; each Cygwin/X screen will be
-opened in its own window.  When using multiple screens, be sure not to
-duplicate any screen numbers.
-.I XWin
-default behavior is to create a single screen that is roughly
-the size of the current Windows display area.
-Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
-default to all screens by placing those screen specific parameters
-before any \fB\-screen\fP parameter.  Screen specific parameters placed after
-the first \fB\-screen\fP parameter will apply only to the immediately
-preceeding \fB\-screen\fP parameter.
-.TP 8
-.B \-scrollbars
-In windowed mode, allow screens bigger than the Windows desktop.
-Moreover, if the window has decorations, one can now resize it.
-.TP 8
-.B \-[no]trayicon
-Do not create a tray icon.  Default is to create one
-icon per screen.  You can globally disable tray icons with
-\fB\-notrayicon\fP, then enable it for specific screens with
-\fB\-trayicon\fP for those screens.
-.TP 8
-.B \-[no]unixkill
-Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a
-signal to exit the X Server.  The \fICtrl-Alt-Backspace\fP key combination
-is disabled by default.
-.TP 8
-.B \-[no]winkill
-Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
-X Server.
-The \fIAlt-F4\fP key combination is enabled by default.
-.TP 8
-.B \-swcursor
-Disable the usage of the windows cursor and use the X11 software cursor instead.
+values will yield a still more detailed debug output.
 .TP 8
 .B \-silent-dup-error
-If another instance of XWin is found running, exit silently and don't display
-the error message.
+If another instance of \fIXWin\fP with the same display number is found running,
+exit silently and don't display any error message.
 .TP 8
 .B "\-xkblayout \fIlayout\fP"
 .TP 8
@@ -251,10 +260,60 @@ in order to load a German layout for a pc105 keyboard one uses
 the options:
 .br
 .I " \-xkblayout de \-xkbmodel pc105"
+
+Alternatively one may use the \fIsetxkbmap\fP program after \fIXWin\fP is
+running.
+
+The default is to select a layout matching your current layout as
+reported by \fIWindows\fP if known, or the default X server layout
+if no matching keyboard layout was found.
+
+.SH UNDOCUMENTED OPTIONS
+These options are undocumented.  Do not use them.
+
+.TP 8
+.B \-emulatepseudo
+Create a depth 8 PseudoColor visual when running in depths 15, 16, 24,
+or 32, collectively known as TrueColor depths.
+Color map manipulation is not supported, so the PseudoColor visual will
+not have the correct colors.
+This option is intended to allow applications which only work with a depth 8
+visual to operate in TrueColor modes.
+.TP 8
+.B \-internalwm
+Run the internal window manager.
+
+.SH LOG FILE
+As it runs \fIXWin\fP writes messages indicating the most relevant events
+to  the console
+from which it was called and to a log file that by default is located at \fI
+__logdir__/XWin.0.log\fP.  This file is mainly for debugging purposes.
+
+
+.SH PREFERENCES FILE
+On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if
+the previous file does not exist, \fI
+__sysconfdir__/X11/system.XWinrc\fP.  \fI.XWinrc\fP allows setting
+preferences for the following:
+.br
+* To include items into the menu associated with the \fIXWin\fP icon
+which is in the \fIWindows\fP system tray.  This functions in all
+modes that have a tray icon.
+.br
+* To include items in the system menu which is associated with the \fIWindows\fP
+window that \fIXWin -multiwindow\fP produces for each top-level X
+window, in both the generic case and for particular programs.
+.br
+* To change the icon that is associated to the \fIWindows\fP window that
+\fIXWin -multiwindow\fP produces for each top-level X-window.
+.br
+* To change the style that is associated to the \fIWindows\fP window that
+\fXWin I-multiwindow\fP produces for each top-level X window.
 .PP
-Alternatively one may use the \fIsetxkbmap\fP program after XWin is
-running or even the \fIxmodmap\fP program for loading the old-style
-keyboard maps.
+The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
+
+.SH EXAMPLES
+Need some examples
 
 
 .SH "SEE ALSO"
@@ -268,10 +327,9 @@ ones are:
 .br
 - The display mode can not be changed once the X server has started.
 .br
-- The XWin software is developing rapidly; it is therefore likely that
+- The \fIXWin\fP software is continuously developing; it is therefore possible that
 this man page is not up to date.  It is always prudent to
-look also at the output of \fIXWin -help\fP and to the Cygwin/X User Guide
-at /usr/share/doc/cygwin-x-doc-x.x.x/ug/cygwin-x-ug.xxx in order to
+look also at the output of \fIXWin -help\fP in order to
 check the options that are operative.
 
 
@@ -282,6 +340,7 @@ Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G
 C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor,
 John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf
 Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A
-Humblet, Harold L Hunt II, Dakshinamurthy Karra, Kensuke Matsuzaki,
-Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Suhaib
-Siddiqi, Jack Tanner, and Nicholas Wourms.
+Humblet, Harold L Hunt II, Dakshinamurthy Karra, Joe Krahn,
+Paul Loewenstein, Kensuke Matsuzaki,
+Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Yaakov Selkowitz,
+Suhaib Siddiqi, Jack Tanner, Jon Turney and Nicholas Wourms.
commit 6f1836bfbd80e88d4c57a32757d0a5b398504c35
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Nov 2 17:37:14 2009 +0000

    Cygwin/X: Update DDX specific -help text
    
    Alphabetize options
    Review option descriptions, clarify and bring up to date
    Add missing option descriptions
    
    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 91f5ec0..acb7d4a 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -746,6 +746,29 @@ OsVendorInit (void)
 static void
 winUseMsg (void)
 {
+  ErrorF("\n");
+  ErrorF("\n");
+  ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
+  ErrorF("\n");
+
+#ifdef XWIN_CLIPBOARD
+  ErrorF ("-[no]clipboard\n"
+	  "\tEnable [disable] the clipboard integration. Default is enabled.\n");
+#endif
+
+  ErrorF ("-clipupdates num_boxes\n"
+	  "\tUse a clipping region to constrain shadow update blits to\n"
+	  "\tthe updated region when num_boxes, or more, are in the\n"
+	  "\tupdated region.\n");
+
+#ifdef XWIN_XF86CONFIG
+  ErrorF ("-config\n"
+          "\tSpecify a configuration file.\n");
+
+  ErrorF ("-configdir\n"
+          "\tSpecify a configuration directory.\n");
+#endif
+
   ErrorF ("-depth bits_per_pixel\n"
 	  "\tSpecify an optional bitdepth to use in fullscreen mode\n"
 	  "\twith a DirectDraw engine.\n");
@@ -754,6 +777,15 @@ winUseMsg (void)
 	  "\tEmulate 3 button mouse with an optional timeout in\n"
 	  "\tmilliseconds.\n");
 
+#ifdef XWIN_EMULATEPSEUDO
+  ErrorF ("-emulatepseudo\n"
+	  "\tCreate a depth 8 PseudoColor visual when running in\n"
+	  "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
+	  "\tdepths.  The PseudoColor visual does not have correct colors,\n"
+	  "\tand it may crash, but it at least allows you to run your\n"
+	  "\tapplication in TrueColor modes.\n");
+#endif
+
   ErrorF ("-engine engine_type_id\n"
 	  "\tOverride the server's automatically selected engine type:\n"
 	  "\t\t1 - Shadow GDI\n"
@@ -766,135 +798,121 @@ winUseMsg (void)
 
   ErrorF ("-fullscreen\n"
 	  "\tRun the server in fullscreen mode.\n");
-  
-  ErrorF ("-refresh rate_in_Hz\n"
-	  "\tSpecify an optional refresh rate to use in fullscreen mode\n"
-	  "\twith a DirectDraw engine.\n");
 
-  ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
-	  "\tEnable screen scr_num and optionally specify a width and\n"
-	  "\theight and initial position for that screen. Additionally\n"
-	  "\ta monitor number can be specified to start the server on,\n"
-	  "\tat which point, all coordinates become relative to that\n"
-      "\tmonitor (Not for Windows NT4 and 95). Examples:\n"
-      "\t -screen 0 800x600+100+100 at 2 ; 2nd monitor offset 100,100 size 800x600\n"
-      "\t -screen 0 1024x768 at 3        ; 3rd monitor size 1024x768\n"
-      "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
-
-  ErrorF ("-lesspointer\n"
-	  "\tHide the windows mouse pointer when it is over an inactive\n"
-          "\t" PROJECT_NAME " window.  This prevents ghost cursors appearing where\n"
-	  "\tthe Windows cursor is drawn overtop of the X cursor\n");
-
-  ErrorF ("-nodecoration\n"
-          "\tDo not draw a window border, title bar, etc.  Windowed\n"
-	  "\tmode only.\n");
+  ErrorF ("-ignoreinput\n"
+	  "\tIgnore keyboard and mouse input.\n");
 
 #ifdef XWIN_MULTIWINDOWEXTWM
-  ErrorF ("-mwextwm\n"
-	  "\tRun the server in multi-window external window manager mode.\n");
-
   ErrorF ("-internalwm\n"
 	  "\tRun the internal window manager.\n");
 #endif
 
-  ErrorF ("-rootless\n"
-	  "\tRun the server in rootless mode.\n");
+#ifdef XWIN_XF86CONFIG
+  ErrorF ("-keyboard\n"
+	  "\tSpecify a keyboard device from the configuration file.\n");
+#endif
+
+  ErrorF ("-[no]keyhook\n"
+	  "\tGrab special Windows keypresses like Alt-Tab or the Menu "
+          "key.\n");
+
+  ErrorF ("-lesspointer\n"
+	  "\tHide the windows mouse pointer when it is over any\n"
+          "\t" EXECUTABLE_NAME " window.  This prevents ghost cursors appearing when\n"
+	  "\tthe Windows cursor is drawn on top of the X cursor\n");
+
+  ErrorF ("-logfile filename\n"
+	  "\tWrite log messages to <filename>.\n");
+
+  ErrorF ("-logverbose verbosity\n"
+	  "\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
+	  "\trespect the settings yet]\n"
+	  "\t\t0 - only print fatal error.\n"
+	  "\t\t1 - print additional configuration information.\n"
+	  "\t\t2 - print additional runtime information [default].\n"
+	  "\t\t3 - print debugging and tracing information.\n");
+
+  ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n"
+	  "\tUse the entire virtual screen if multiple\n"
+	  "\tmonitors are present.\n");
 
 #ifdef XWIN_MULTIWINDOW
   ErrorF ("-multiwindow\n"
 	  "\tRun the server in multi-window mode.\n");
 #endif
 
-  ErrorF ("-multiplemonitors\n"
-	  "\tEXPERIMENTAL: Use the entire virtual screen if multiple\n"
-	  "\tmonitors are present.\n");
+#ifdef XWIN_MULTIWINDOWEXTWM
+  ErrorF ("-mwextwm\n"
+	  "\tRun the server in multi-window external window manager mode.\n");
+#endif
 
-#ifdef XWIN_CLIPBOARD
-  ErrorF ("-[no]clipboard\n"
-	  "\tEnable [disable] the clipboard integration. Default is enabled.\n");
+  ErrorF ("-nodecoration\n"
+          "\tDo not draw a window border, title bar, etc.  Windowed\n"
+	  "\tmode only.\n");
 
+#ifdef XWIN_CLIPBOARD
   ErrorF ("-nounicodeclipboard\n"
-	  "\tDo not use Unicode clipboard even if NT-based platform.\n");
+	  "\tDo not use Unicode clipboard even if on a NT-based platform.\n");
 #endif
 
+  ErrorF ("-refresh rate_in_Hz\n"
+	  "\tSpecify an optional refresh rate to use in fullscreen mode\n"
+	  "\twith a DirectDraw engine.\n");
+
+  ErrorF ("-rootless\n"
+	  "\tRun the server in rootless mode.\n");
+
+  ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
+	  "\tEnable screen scr_num and optionally specify a width and\n"
+	  "\theight and initial position for that screen. Additionally\n"
+	  "\ta monitor number can be specified to start the server on,\n"
+	  "\tat which point, all coordinates become relative to that\n"
+      "\tmonitor (Not for Windows NT4 and 95). Examples:\n"
+      "\t -screen 0 800x600+100+100 at 2 ; 2nd monitor offset 100,100 size 800x600\n"
+      "\t -screen 0 1024x768 at 3        ; 3rd monitor size 1024x768\n"
+      "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
+
   ErrorF ("-scrollbars\n"
 	  "\tIn windowed mode, allow screens bigger than the Windows desktop.\n"
 	  "\tMoreover, if the window has decorations, one can now resize\n"
 	  "\tit.\n");
 
+  ErrorF ("-silent-dup-error\n"
+	  "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
+     "\texit silently and don’t display any error message.\n");
+
+  ErrorF ("-swcursor\n"
+	  "\tDisable the usage of the Windows cursor and use the X11 software\n"
+	  "\tcursor instead.\n");
+
   ErrorF ("-[no]trayicon\n"
           "\tDo not create a tray icon.  Default is to create one\n"
 	  "\ticon per screen.  You can globally disable tray icons with\n"
 	  "\t-notrayicon, then enable it for specific screens with\n"
 	  "\t-trayicon for those screens.\n");
 
-  ErrorF ("-clipupdates num_boxes\n"
-	  "\tUse a clipping region to constrain shadow update blits to\n"
-	  "\tthe updated region when num_boxes, or more, are in the\n"
-	  "\tupdated region.  Currently supported only by `-engine 1'.\n");
-
-#ifdef XWIN_EMULATEPSEUDO
-  ErrorF ("-emulatepseudo\n"
-	  "\tCreate a depth 8 PseudoColor visual when running in\n"
-	  "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
-	  "\tdepths.  The PseudoColor visual does not have correct colors,\n"
-	  "\tand it may crash, but it at least allows you to run your\n"
-	  "\tapplication in TrueColor modes.\n");
-#endif
-
   ErrorF ("-[no]unixkill\n"
           "\tCtrl+Alt+Backspace exits the X Server.\n");
 
   ErrorF ("-[no]winkill\n"
           "\tAlt+F4 exits the X Server.\n");
 
-#ifdef XWIN_XF86CONFIG
-  ErrorF ("-config\n"
-          "\tSpecify a configuration file.\n");
-
-  ErrorF ("-configdir\n"
-          "\tSpecify a configuration directory.\n");
-
-  ErrorF ("-keyboard\n"
-	  "\tSpecify a keyboard device from the configuration file.\n");
-#endif
-
-  ErrorF ("-xkbrules XKBRules\n"
-	  "\tEquivalent to XKBRules in XF86Config files.\n");
-
-  ErrorF ("-xkbmodel XKBModel\n"
-	  "\tEquivalent to XKBModel in XF86Config files.\n");
-
   ErrorF ("-xkblayout XKBLayout\n"
 	  "\tEquivalent to XKBLayout in XF86Config files.\n"
 	  "\tFor example: -xkblayout de\n");
 
-  ErrorF ("-xkbvariant XKBVariant\n"
-	  "\tEquivalent to XKBVariant in XF86Config files.\n"
-	  "\tFor example: -xkbvariant nodeadkeys\n");
+  ErrorF ("-xkbmodel XKBModel\n"
+	  "\tEquivalent to XKBModel in XF86Config files.\n");
 
   ErrorF ("-xkboptions XKBOptions\n"
 	  "\tEquivalent to XKBOptions in XF86Config files.\n");
 
-  ErrorF ("-logfile filename\n"
-	  "\tWrite logmessages to <filename> instead of /tmp/Xwin.log.\n");
-
-  ErrorF ("-logverbose verbosity\n"
-	  "\tSet the verbosity of logmessages. [NOTE: Only a few messages\n"
-	  "\trespect the settings yet]\n"
-	  "\t\t0 - only print fatal error.\n"
-	  "\t\t1 - print additional configuration information.\n"
-	  "\t\t2 - print additional runtime information [default].\n"
-	  "\t\t3 - print debugging and tracing information.\n");
-
-  ErrorF ("-[no]keyhook\n"
-	  "\tGrab special windows key combinations like Alt-Tab or the Menu "
-          "key.\n These keys are discarded by default.\n");
+  ErrorF ("-xkbrules XKBRules\n"
+	  "\tEquivalent to XKBRules in XF86Config files.\n");
 
-  ErrorF ("-swcursor\n"
-	  "\tDisable the usage of the windows cursor and use the X11 software "
-	  "cursor instead\n");
+  ErrorF ("-xkbvariant XKBVariant\n"
+	  "\tEquivalent to XKBVariant in XF86Config files.\n"
+	  "\tFor example: -xkbvariant nodeadkeys\n");
 }
 
 /* See Porting Layer Definition - p. 57 */
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index 86c0943..cf2f93f 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -43,6 +43,7 @@
 #ifndef PROJECT_NAME
 #  define PROJECT_NAME		"Cygwin/X"
 #endif
+#define EXECUTABLE_NAME         "XWin"
 #define WINDOW_CLASS		"cygwin/x"
 #define WINDOW_TITLE		PROJECT_NAME ":%s.%d"
 #define WINDOW_TITLE_XDMCP	"%s:%s.%d"
commit 22982b9e95a2339d5ba60d66263e42a0331ee41f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 29 18:50:23 2009 +0000

    Cygwin/X: XSupportsLocale() failure is non-critical
    
    Treat XSupportsLocale() returning false as non-critical to internal client
    theads startup, and issue a warning, not an 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/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index e5b2dc1..a380903 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -119,8 +119,7 @@ winClipboardProc (void *pvNotUsed)
   /* See if X supports the current locale */
   if (XSupportsLocale () == False)
     {
-      ErrorF ("winClipboardProc - Locale not supported by X.  Exiting.\n");
-      pthread_exit (NULL);
+      ErrorF ("winClipboardProc - Warning: Locale not supported by X.\n");
     }
 
   /* Set jump point for Error exits */
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index eba5542..e39cbc1 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -893,9 +893,7 @@ winMultiWindowXMsgProc (void *pArg)
   /* See if X supports the current locale */
   if (XSupportsLocale () == False)
     {
-      ErrorF ("winMultiWindowXMsgProc - Locale not supported by X.  "
-	      "Exiting.\n");
-      pthread_exit (NULL);
+      ErrorF ("winMultiWindowXMsgProc - Warning: locale not supported by X\n");
     }
 
   /* Release the server started mutex */
@@ -1278,8 +1276,7 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
   /* See if X supports the current locale */
   if (XSupportsLocale () == False)
     {
-      ErrorF ("winInitMultiWindowWM - Locale not supported by X.  Exiting.\n");
-      pthread_exit (NULL);
+      ErrorF ("winInitMultiWindowWM - Warning: Locale not supported by X.\n");
     }
 
   /* Release the server started mutex */
commit f60b7712b3451649f138b158ee282be89a66b9ef
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Feb 1 17:13:00 2010 +0000

    Cygwin/X: Report BUILDERSTRING with version information
    
    Report BUILDERSTRING with version information
    
    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/winerror.c b/hw/xwin/winerror.c
index 72ee2cf..9ed27c3 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -117,6 +117,7 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
 	"Vendor: %s\n" \
 	"Release: %d.%d.%d.%d (%d)\n" \
 	"Contact: %s\n" \
+	"%s\n\n" \
 	"XWin was started with the following command-line:\n\n" \
 	"%s\n"
 
@@ -124,6 +125,7 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
 	   pszErrorF, VENDOR_STRING,
 		       XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT,
 		       VENDOR_CONTACT,
+		       BUILDERSTRING,
 	   g_pszCommandLine);
   if (!pszMsgBox)
     goto winMessageBoxF_Cleanup;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index fd7719c..159e533 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1556,6 +1556,7 @@ winLogVersionInfo (void)
   ErrorF ("Welcome to the XWin X Server\n");
   ErrorF ("Vendor: %s\n", VENDOR_STRING);
   ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT);
+  ErrorF ("%s\n\n", BUILDERSTRING);
   ErrorF ("Contact: %s\n", VENDOR_CONTACT);
 }
 
commit ed2c2a68e1e6b409c198a52d99d300eb6d517e89
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Feb 1 17:12:57 2010 +0000

    Define FD_SETSIZE on Cygwin regardless of XWin DDX
    
    All DDXs segfault on Cygwin unless -DFD_SETSIZE=256 is set, so make sure
    we do so whether or not we are building XWin.
    
    FD_SETSIZE must be at least XFD_SETSIZE for uses of select() to be correct.
    The Cygwin default is only 64, so it must be increased to 256
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    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 ef441da..bab6aee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,6 +427,9 @@ case $host_os in
   darwin*)
 	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
 	;;
+  cygwin*)
+	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
+	;;
 esac
 
 dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
@@ -1840,8 +1843,6 @@ if test "x$XWIN" = xyes; then
 			       AC_DEFINE(ROOTLESS,1,[Build Rootless code])
 			       CFLAGS="$CFLAGS -DROOTLESS_WORKAROUND"
 			fi
-
-			CFLAGS="$CFLAGS -DFD_SETSIZE=256"
 			;;
 		mingw*)
 			XWIN_SERVER_NAME=Xming
commit 2f2f3da080629d410dd99e281c382b54f0dbbf5d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Jun 19 21:14:47 2009 +0100

    Cygwin/X: Copy the state of the Windows keyboard device to the Virtual Core Keyboard at startup.
    
    Otherwise, this happens lazily after the first keypress, which can lead
    to applications which are started from a shell window and inspect the
    keyboard state before a character is typed getting the wrong idea about
    the desired keymap (e.g. xemacs shows this behaviour)
    
    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 317f14d..a423b49 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -273,6 +273,10 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
       
     case DEVICE_ON: 
       pDevice->on = TRUE;
+
+      // immediately copy the state of this keyboard device to the VCK
+      // (which otherwise happens lazily after the first keypress)
+      CopyKeyClass(pDeviceInt, inputInfo.keyboard);
       break;
 
     case DEVICE_CLOSE:
commit 7a440e5b7a416e582b6c3cc4c33822854ce73aed
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Oct 4 15:55:40 2009 +0100

    Cygwin/X: Tidy up system.Xwinrc
    
    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/system.XWinrc b/hw/xwin/system.XWinrc
index 37ac008..f0771c6 100644
--- a/hw/xwin/system.XWinrc
+++ b/hw/xwin/system.XWinrc
@@ -18,6 +18,9 @@
 #                               ^^ This command will have any "%display%"
 #                                  string replaced with the proper display
 #                                  variable (i.e. 127.0.0.1:<display>.0)
+#                                  (This should only rarely be needed as
+#                                  the DISPLAY environment variable is also
+#                                  set correctly)
 #  or	<Menu Text>	MENU	<name-of-some-prior-defined-menu>
 #  or	<Menu Text>	ALWAYSONTOP
 #                         ^^ Sets the window to display above all others
@@ -80,7 +83,7 @@
 // Make some menus...
 menu apps {
 	xterm	exec	"xterm"
-	"Emacs"		exec	"emacs"
+	"Emacs"	exec	"emacs"
 	notepad	exec	notepad
 	xload	exec	"xload -display %display%"  # Comment
 }
commit 11252ed82e1f361b99e86521ac9314f868bd1a3a
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Feb 1 17:11:54 2010 +0000

    Cygwin/X: Look for system.Xwinrc in SYSCONFDIR/X11
    
    Look for system.Xwinrc in SYSCONFDIR/X11 (usually /etc/X11)
    Rename sample system.Xwinrc file not to have a X11R6 path in it's name
    Add makefile install rule for system.XWinrc
    
    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 2546e83..ef441da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1825,6 +1825,7 @@ AC_MSG_RESULT([$XWIN])
 
 if test "x$XWIN" = xyes; then
 	PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
+	AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
 	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
 	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
 	AC_CHECK_TOOL(WINDRES, windres)
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 3324157..8b18972 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -190,12 +190,14 @@ XWinrc.$(FILE_MAN_SUFFIX): XWinrc.man
 
 EXTRAMANDEFS = -D__logdir__=$(logdir) -D__sysconfdir__=$(sysconfdir) -D__datadir__=$(datadir)
 
+xwinconfigdir = $(sysconfdir)/X11
+xwinconfig_DATA = system.XWinrc
+
 include $(top_srcdir)/cpprules.in
 
 EXTRA_DIST = \
 	$(GLX_EXTRAS) \
 	$(MAN_SRCS) \
-	_usr_X11R6_lib_X11_system.XWinrc \
 	X.ico \
 	XWin.rc \
 	xlaunch/config.cc \
diff --git a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
deleted file mode 100644
index 1de6e2a..0000000
--- a/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
+++ /dev/null
@@ -1,125 +0,0 @@
-# XWin Server Resource File - EXAMPLE
-# Earle F. Philhower, III
-
-# Place in ~/.XWinrc or in /usr/X11R6/lib/X11/system.XWinrc
-
-# Keywords are case insensitive, comments legal pretty much anywhere
-# you can have an end-of-line
-
-# Comments begin with "#" or "//" and go to the end-of-line
-
-# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc)
-
-# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons)
-
-# Menus are defined as...
-# MENU <name> {
-#	<Menu Text>	EXEC	<command>
-#                               ^^ This command will have any "%display%"
-#                                  string replaced with the proper display
-#                                  variable (i.e. 127.0.0.1:<display>.0)
-#  or	<Menu Text>	MENU	<name-of-some-prior-defined-menu>
-#  or	<Menu Text>	ALWAYSONTOP
-#                         ^^ Sets the window to display above all others
-#  or   <Menu Text>	RELOAD
-#                         ^^ Causes ~/.XWinrc or the system.XWinrc file
-#                            to be reloaded and icons and menus regenerated
-#  or	SEPARATOR
-#       ...
-# }
-
-# Set the taskmar menu with
-# ROOTMENU <name-of-some-prior-defined-menu>
-
-# If you want a menu to be applied to all popup window's system menu
-# DEFAULTSYSMENU <name-of-some-prior-defined-menu> <atstart|atend>
-
-# To choose a specific menu for a specific WM_CLASS or WM_NAME use ...
-# SYSMENU {
-#	<class-or-name-of-window> <name-of-prior-defined-menu> <atstart|atend>
-#	...
-# }
-
-# When specifying an ICONFILE in the following commands several different
-# formats are allowed:
-# 1. Name of a regular Windows .ico format file
-#    (ex:  "cygwin.ico", "apple.ico")
-# 2. Name and index into a Windows .DLL
-#    (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon
-#         "c:\windows\system32\shell32.dll,5" gives the floppy drive icon)
-# 3. Index into XWin.EXE internal ICON resource
-#    (ex: ",101" is the 1st icon inside XWin.exe)
-
-# To define where ICO files live (** Windows path**)
-# ICONDIRECTORY	<windows-path i.e. c:\cygwin\usr\icons>
-# NOTE: If you specify a fully qualified path to an ICON below
-#             (i.e. "c:\xxx" or "d:\xxxx")
-#       this ICONDIRECTORY will not be prepended
-
-# To change the taskbar icon use...
-# TRAYICON       <name-of-windows-ico-file-in-icondirectory>
-
-# To define a replacement for the standard X icon for apps w/o specified icons
-# DEFAULTICON	<name-of-windows-ico-file-in-icondirectory>
-
-# To define substitute icons on a per-window basis use...
-# ICONS {
-#	<class-or-name-of-window> <icon-file-name.ico>
-#	...
-# }
-# In the case where multiple matches occur, the first listed in the ICONS
-# section will be chosen.
-
-# To disable exit confirmation dialog add the line containing SilentExit
-
-# DEBUG <string> prints out the string to the XWin.log file
-
-// Below are just some silly menus to demonstrate writing your
-// own configuration file.
-
-// Make some menus...
-menu apps {
-	xterm	exec	"xterm"
-	"Emacs"		exec	"emacs"
-	notepad	exec	notepad
-	xload	exec	"xload -display %display%"  # Comment
-}
-
-menu root {
-// Comments fit here, too...
-	"Reload .XWinrc"	RELOAD
-	"Applications"	menu	apps
-	SEParATOR
-}
-
-menu aot {
-	Separator
-	"Always on Top"	alwaysontop
-}
-
-menu xtermspecial {
-	"Emacs"		exec	"emacs"
-	"Always on Top"	alwaysontop
-	SepArAtor
-}
-
-RootMenu root
-
-DefaultSysMenu aot atend
-
-SysMenu {
-	"xterm"	xtermspecial atstart
-}
-
-# IconDirectory	"c:\winnt\"
-
-# DefaultIcon	"reinstall.ico"
-
-# Icons {
-# 	"xterm"	"uninstall.ico"
-# }
-
-SilentExit
-
-DEBUG "Done parsing the configuration file..."
-
diff --git a/hw/xwin/system.XWinrc b/hw/xwin/system.XWinrc
new file mode 100644
index 0000000..37ac008
--- /dev/null
+++ b/hw/xwin/system.XWinrc
@@ -0,0 +1,125 @@
+# XWin Server Resource File - EXAMPLE
+# Earle F. Philhower, III
+
+# Place in ~/.XWinrc or in /etc/X11/system.XWinrc
+
+# Keywords are case insensitive, comments legal pretty much anywhere
+# you can have an end-of-line
+
+# Comments begin with "#" or "//" and go to the end-of-line
+
+# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc)
+
+# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons)
+
+# Menus are defined as...
+# MENU <name> {
+#	<Menu Text>	EXEC	<command>
+#                               ^^ This command will have any "%display%"
+#                                  string replaced with the proper display
+#                                  variable (i.e. 127.0.0.1:<display>.0)
+#  or	<Menu Text>	MENU	<name-of-some-prior-defined-menu>
+#  or	<Menu Text>	ALWAYSONTOP
+#                         ^^ Sets the window to display above all others
+#  or   <Menu Text>	RELOAD
+#                         ^^ Causes ~/.XWinrc or the system.XWinrc file
+#                            to be reloaded and icons and menus regenerated
+#  or	SEPARATOR
+#       ...
+# }
+
+# Set the taskmar menu with
+# ROOTMENU <name-of-some-prior-defined-menu>
+
+# If you want a menu to be applied to all popup window's system menu
+# DEFAULTSYSMENU <name-of-some-prior-defined-menu> <atstart|atend>
+
+# To choose a specific menu for a specific WM_CLASS or WM_NAME use ...
+# SYSMENU {
+#	<class-or-name-of-window> <name-of-prior-defined-menu> <atstart|atend>
+#	...
+# }
+
+# When specifying an ICONFILE in the following commands several different
+# formats are allowed:
+# 1. Name of a regular Windows .ico format file
+#    (ex:  "cygwin.ico", "apple.ico")
+# 2. Name and index into a Windows .DLL
+#    (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon
+#         "c:\windows\system32\shell32.dll,5" gives the floppy drive icon)
+# 3. Index into XWin.EXE internal ICON resource
+#    (ex: ",101" is the 1st icon inside XWin.exe)
+
+# To define where ICO files live (** Windows path**)
+# ICONDIRECTORY	<windows-path i.e. c:\cygwin\usr\icons>
+# NOTE: If you specify a fully qualified path to an ICON below
+#             (i.e. "c:\xxx" or "d:\xxxx")
+#       this ICONDIRECTORY will not be prepended
+
+# To change the taskbar icon use...
+# TRAYICON       <name-of-windows-ico-file-in-icondirectory>
+
+# To define a replacement for the standard X icon for apps w/o specified icons
+# DEFAULTICON	<name-of-windows-ico-file-in-icondirectory>
+
+# To define substitute icons on a per-window basis use...
+# ICONS {
+#	<class-or-name-of-window> <icon-file-name.ico>
+#	...
+# }
+# In the case where multiple matches occur, the first listed in the ICONS
+# section will be chosen.
+
+# To disable exit confirmation dialog add the line containing SilentExit
+
+# DEBUG <string> prints out the string to the XWin.log file
+
+// Below are just some silly menus to demonstrate writing your
+// own configuration file.
+
+// Make some menus...
+menu apps {
+	xterm	exec	"xterm"
+	"Emacs"		exec	"emacs"
+	notepad	exec	notepad
+	xload	exec	"xload -display %display%"  # Comment
+}
+
+menu root {
+// Comments fit here, too...
+	"Reload .XWinrc"	RELOAD
+	"Applications"	menu	apps
+	SEParATOR
+}
+
+menu aot {
+	Separator
+	"Always on Top"	alwaysontop
+}
+
+menu xtermspecial {
+	"Emacs"		exec	"emacs"
+	"Always on Top"	alwaysontop
+	SepArAtor
+}
+
+RootMenu root
+
+DefaultSysMenu aot atend
+
+SysMenu {
+	"xterm"	xtermspecial atstart
+}
+
+# IconDirectory	"c:\winnt\"
+
+# DefaultIcon	"reinstall.ico"
+
+# Icons {
+# 	"xterm"	"uninstall.ico"
+# }
+
+SilentExit
+
+DEBUG "Done parsing the configuration file..."
+
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index d5bceb9..93901ca 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -723,7 +723,7 @@ winIconIsOverride(unsigned hiconIn)
 
 
 /*
- * Try and open ~/.XWinrc and /usr/X11R6/lib/X11/system.XWinrc
+ * Try and open ~/.XWinrc and system.XWinrc
  * Load it into prefs structure for use by other functions
  */
 void
@@ -763,7 +763,7 @@ LoadPreferences (void)
 #ifdef RELOCATE_PROJECTROOT
       snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
 #else
-      strncpy(buffer, PROJECTROOT"/lib/X11/system.XWinrc", sizeof(buffer));
+      strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer));
 #endif
       buffer[sizeof(buffer)-1] = 0;
       prefFile = fopen (buffer, "r");
diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 932f2e8..21ceb29 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -28,3 +28,7 @@
 
 /* Vendor web address for support */
 #undef __VENDORDWEBSUPPORT__
+
+/* Location of system.XWinrc */
+#undef SYSCONFDIR
+
commit 34269a90ea2087f883f5dc8805894fc4998e4b81
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Feb 2 16:21:44 2010 +0000

    Cygwin/X: Update resources file and About dialog
    
    Use the configured vendor web address in the About dialog
    
    Update resources file: rework About dialog, use 'MS Shell Dlg 2'
    logical font for all dialogs, add ellipsis to exit option in tray
    menu as it (may) trigger another dialog.
    
    Get short vendor name from xwin-config.h, like other configuration
    data presented in the About dialog box, rather than creating the
    PROJECT_NAME define
    
    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 ec9442b..2546e83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1826,6 +1826,7 @@ AC_MSG_RESULT([$XWIN])
 if test "x$XWIN" = xyes; then
 	PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
 	AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
+	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
 	AC_CHECK_TOOL(WINDRES, windres)
 	case $host_os in
 		cygwin*)
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index a76b569..3324157 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -151,7 +151,7 @@ XWin_DEPENDENCIES = $(XWIN_LIBS)
 XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
 
 .rc.o:
-	$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -DPROJECT_NAME=\"$(VENDOR_NAME_SHORT)\"
+	$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include
 
 XWin_LDFLAGS = -mwindows -static
 
diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc
index a4125b8..539bd0e 100644
--- a/hw/xwin/XWin.rc
+++ b/hw/xwin/XWin.rc
@@ -1,5 +1,6 @@
 /*
  *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) 2008 Yaakov Selkowitz All Rights Reserved
  *
  *Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -20,39 +21,37 @@
  *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
- *Except as contained in this notice, the name of Harold L Hunt II
+ *Except as contained in this notice, the names of the authors
  *shall not be used in advertising or otherwise to promote the sale, use
  *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *from the authors.
  *
- * Authors:	Harold L Hunt II
+ * Authors:	Harold L Hunt II, Yaakov Selkowitz
  */
 
-#include "windows.h"
+#include <windows.h>
 #include "winresource.h"
+#include "xwin-config.h"
+#include "version-config.h"
 
 /*
  * Dialogs
  */
 
 /* About */
-ABOUT_BOX DIALOGEX 32, 32, 240, 105
+ABOUT_BOX DIALOGEX 32, 32, 260, 105
 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP  | DS_CENTERMOUSE
-CAPTION "About " PROJECT_NAME
-FONT 8, "MS Sans Serif"
+CAPTION "About " XVENDORNAMESHORT
+FONT 8, "MS Shell Dlg 2"
 BEGIN
-  CONTROL               PROJECT_NAME " Website", ID_ABOUT_WEBSITE, "Button",
-                        BS_OWNERDRAW | WS_TABSTOP, 30, 45, 75, 15
-  CONTROL               "Change Log", ID_ABOUT_CHANGELOG, "Button",
-                        BS_OWNERDRAW | WS_TABSTOP, 135, 45, 75, 15
-  CONTROL               "User's Guide", ID_ABOUT_UG, "Button",
-                        BS_OWNERDRAW | WS_TABSTOP, 30, 65, 75, 15
-  CONTROL               "FAQ", ID_ABOUT_FAQ, "Button",
-                        BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15
-
-  DEFPUSHBUTTON		"&OK", IDOK, 95, 85, 50, 15
-
-  CTEXT			PROJECT_NAME " X Server.  Use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35
+  CONTROL				IDI_XWIN, IDC_STATIC, "Static", SS_ICON, 8, 8, 32, 32
+  LTEXT			XVENDORNAMESHORT " X Server ", IDC_STATIC, 36, 8, 220, 8
+  LTEXT			VENDOR_MAN_VERSION, IDC_STATIC, 36, 18, 220, 8
+  LTEXT			BUILDERSTRING, IDC_STATIC, 36, 28, 220, 8
+  LTEXT			"This software is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 48, 220, 20
+  CONTROL               __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button",
+                        BS_OWNERDRAW | WS_TABSTOP, 36, 68, 68, 8
+  DEFPUSHBUTTON		"&OK", IDOK, 105, 85, 50, 15
 END
 
 
@@ -60,13 +59,13 @@ END
 
 DEPTH_CHANGE_BOX DIALOGEX 32, 32, 180, 100
 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE
-FONT 8, "MS Sans Serif"
-CAPTION PROJECT_NAME
+FONT 8, "MS Shell Dlg 2"
+CAPTION XVENDORNAMESHORT
 BEGIN
   DEFPUSHBUTTON		"Dismiss", IDOK, 66, 80, 50, 14
-  CTEXT			PROJECT_NAME, IDC_STATIC, 40, 12, 100, 8
+  CTEXT			XVENDORNAMESHORT, IDC_STATIC, 40, 12, 100, 8
   CTEXT			"Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8
-  CTEXT			"Restore previous resolution to use " PROJECT_NAME ".", IDC_STATIC, 7, 52, 166, 8
+  CTEXT			"Restore previous resolution to use " XVENDORNAMESHORT ".", IDC_STATIC, 7, 52, 166, 8
 END
 
 
@@ -74,8 +73,8 @@ END
 
 EXIT_DIALOG DIALOGEX 32, 32, 180, 78
 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE
-FONT 8, "MS Sans Serif"
-CAPTION "Exit " PROJECT_NAME "?"
+FONT 8, "MS Shell Dlg 2"
+CAPTION "Exit " XVENDORNAMESHORT "?"
 BEGIN
   PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14
   DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14
@@ -96,7 +95,7 @@ BEGIN
 		MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
 		MENUITEM "&About...", ID_APP_ABOUT
 		MENUITEM SEPARATOR
-		MENUITEM "E&xit", ID_APP_EXIT
+		MENUITEM "E&xit...", ID_APP_EXIT
 	END
 END
 
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 0b590cf..a815353 100755
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -705,7 +705,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message,
 
 	case ID_ABOUT_WEBSITE:
 	  {
-	    const char *	pszPath = "http://x.cygwin.com/";
+	    const char *	pszPath = __VENDORDWEBSUPPORT__;
 	    int			iReturn;
 	    
 	    iReturn = ShellExecute (NULL,
diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index c8de110..932f2e8 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -12,7 +12,7 @@
 /* Cygwin has /dev/windows for signaling new win32 messages */
 #undef HAS_DEVWINDOWS
 
-/* Switch on debug messages */ 
+/* Switch on debug messages */
 #undef CYGDEBUG
 #undef CYGWINDOWING_DEBUG
 #undef CYGMULTIWINDOW_DEBUG
@@ -22,3 +22,9 @@
 
 /* Do we require our own snprintf? */
 #undef NEED_SNPRINTF
+
+/* Short vendor name */
+#undef XVENDORNAMESHORT
+
+/* Vendor web address for support */
+#undef __VENDORDWEBSUPPORT__
commit 881812438b430d2856d0494707e028e5f30d6e9a
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Tue Feb 2 16:22:39 2010 +0000

    Xming: Use 8 point font for URL in About dialog
    
    Use an 8 point font for URL in About dialog, to match the rest
    of the text in that dialog
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index 582b865..0b590cf 100755
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -116,8 +116,8 @@ winDrawURLWindow (LPARAM lParam)
     crText = RGB(0,0,128+64);
   SetTextColor (draw->hDC, crText);
   
-  /* Create underlined font 14 high, standard dialog font */
-  font = CreateFont (-14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE,
+  /* Create font 8 high, standard dialog font */
+  font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
 		     0, 0, 0, 0, 0, "MS Sans Serif");
   if (!font)
     {
commit c02638fd68440513b6046315547c554a910bd7e2
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Tue Feb 2 16:08:45 2010 +0000

    Xming: Add a manifest file
    
    Use manifests to enable XP style controls
    (only effective for XP and later and when themes are enabled).
    The addition of manifests shouldn't cause compatibility problems with older Windows versions.
    
    Manifest must have execute permissions, otherwise attempts to
    execute XWin.exe in the same directory will fail...
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/XWin.exe.manifest b/hw/xwin/XWin.exe.manifest
new file mode 100755
index 0000000..221150d
--- /dev/null
+++ b/hw/xwin/XWin.exe.manifest
@@ -0,0 +1,16 @@
+<?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>
+	<dependency>
+	   <dependentAssembly>
+	     <assemblyIdentity
+	       type="win32"
+	       name="Microsoft.Windows.Common-Controls"
+	       version="6.0.0.0"
+	       processorArchitecture="X86"
+	       publicKeyToken="6595b64144ccf1df"
+	       language="*"
+	     />
+	   </dependentAssembly>
+	</dependency>
+</assembly>
diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc
index df2664d..a4125b8 100644
--- a/hw/xwin/XWin.rc
+++ b/hw/xwin/XWin.rc
@@ -106,3 +106,4 @@ END
  */
 
 IDI_XWIN		ICON	"X.ico"
+CREATEPROCESS_MANIFEST_RESOURCE_ID	RT_MANIFEST	"XWin.exe.manifest"
commit fd8a32baba77aba8d124658a19f4f6eda79e49c6
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Jun 19 21:14:39 2009 +0100

    Cygwin/X: Window placement refinement for multiwindow mode
    
    Window placement refinement for multiwindow mode, ensure a window actually
    ends up somewhere visible if it tries to create itself offscreen (which
    can happen for e.g. if it has a stored position from a different sized
    display)
    
    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 8b91296..87ffc6d 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -515,6 +515,13 @@ winCreateWindowsWindow (WindowPtr pWin)
   iWidth = pWin->drawable.width;
   iHeight = pWin->drawable.height;
 
+  /* ensure window actually ends up somewhere visible */
+  if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
+    iX = CW_USEDEFAULT;
+
+  if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
+    iY = CW_USEDEFAULT;
+
   if (winMultiWindowGetTransientFor (pWin, &pDaddy))
     {
       if (pDaddy)
commit 7eb840fd42bc62d88fb4fcf6600546c9ff6e56be
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Feb 2 15:42:12 2010 +0000

    Cygwin/X: Respect the system's ownership of the clipping region
    
    Respect the system's ownership of the clipping region used for shaped windows
    
    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/winmultiwindowshape.c b/hw/xwin/winmultiwindowshape.c
index 4400702..3532357 100644
--- a/hw/xwin/winmultiwindowshape.c
+++ b/hw/xwin/winmultiwindowshape.c
@@ -71,6 +71,9 @@ winUpdateRgnMultiWindow (WindowPtr pWin)
 {
   SetWindowRgn (winGetWindowPriv(pWin)->hWnd,
 		winGetWindowPriv(pWin)->hRgn, TRUE);
+
+  /* The system now owns the region specified by the region handle and will delete it when it is no longer needed. */
+  winGetWindowPriv(pWin)->hRgn = NULL;
 }
 
 
commit bad41bdfd4a12f0c92fd221bffd9f3c5e40d0fe1
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Mon Feb 1 17:11:22 2010 +0000

    Xming: Always update the Windows title Unicode (wide-character) in -multiwindow mode.
    
    Apply the Windows title wide-character in -multiwindow mode. Windows should now
    display correct client X Window titles for locales with wide characters.
    
    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/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 880ca6a..eba5542 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -153,7 +153,7 @@ static Bool
 InitQueue (WMMsgQueuePtr pQueue);
 
 static void
-GetWindowName (Display * pDpy, Window iWin, char **ppName);
+GetWindowName (Display * pDpy, Window iWin, wchar_t **ppName);
 
 static int
 SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
@@ -416,10 +416,12 @@ InitQueue (WMMsgQueuePtr pQueue)
  */
 
 static void
-GetWindowName (Display *pDisplay, Window iWin, char **ppName)
+GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
 {
   int			nResult, nNum;
   char			**ppList;
+  char			*pszReturnData;
+  int			iLen, i;
   XTextProperty		xtpName;
   
 #if CYGMULTIWINDOW_DEBUG
@@ -438,38 +440,26 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
 #endif
       return;
     }
-  
-  /* */
-  if (xtpName.encoding == XA_STRING)
-    {
-      /* */
-      if (xtpName.value)
-	{
-	  int size = xtpName.nitems * (xtpName.format >> 3);
-	  *ppName = malloc(size + 1);
-	  strncpy(*ppName, xtpName.value, size);
-	  (*ppName)[size] = 0;
-	  XFree (xtpName.value);
-	}
-
-#if CYGMULTIWINDOW_DEBUG
-      ErrorF ("GetWindowName - XA_STRING %s\n", *ppName);
-#endif
-    }
-  else
-    {
-      if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
-	{
-	  *ppName = strdup (*ppList);
-	  XFreeStringList (ppList);
-	}
-      XFree (xtpName.value);
 
-#if CYGMULTIWINDOW_DEBUG
-      ErrorF ("GetWindowName - %s %s\n",
-	      XGetAtomName (pDisplay, xtpName.encoding), *ppName);
-#endif
-    }
+   if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
+   {
+ 	iLen = 0;
+ 	for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]);
+ 	pszReturnData = (char *) malloc (iLen + 1);
+ 	pszReturnData[0] = '\0';
+ 	for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
+ 	if (ppList) XFreeStringList (ppList);
+   }
+   else
+   {
+ 	pszReturnData = (char *) malloc (1);
+ 	pszReturnData[0] = '\0';
+   }
+   iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0);
+   *ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
+   MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
+   XFree (xtpName.value);
+   free (pszReturnData);
 
 #if CYGMULTIWINDOW_DEBUG
   ErrorF ("GetWindowName - Returning\n");
@@ -506,7 +496,7 @@ SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
 static void
 UpdateName (WMInfoPtr pWMInfo, Window iWindow)
 {
-  char			*pszName;
+  wchar_t		*pszName;
   Atom			atmType;
   int			fmtRet;
   unsigned long		items, remain;
@@ -550,7 +540,7 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
 			    &attr);
       if (!attr.override_redirect)
 	{
-	  SetWindowText (hWnd, pszName);
+	  SetWindowTextW (hWnd, pszName);
 	  winUpdateIcon (iWindow);
 	}
 


More information about the Xquartz-changes mailing list