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

Jeremy Huddleston jeremyhu at freedesktop.org
Sat Nov 17 08:50:29 PST 2012


 Xext/panoramiX.c                           |    2 
 Xext/shm.c                                 |   10 -
 Xext/xace.c                                |   12 -
 Xext/xf86bigfont.c                         |   16 --
 Xext/xres.c                                |    2 
 Xext/xtest.c                               |    2 
 Xi/chgdctl.c                               |    8 -
 Xi/exevents.c                              |   21 ++-
 Xi/xiproperty.c                            |    3 
 Xi/xiselectev.c                            |    9 +
 autogen.sh                                 |    4 
 configure.ac                               |   27 +++-
 dix/devices.c                              |   12 +
 dix/dispatch.c                             |   19 +--
 dix/dixfonts.c                             |    9 +
 dix/events.c                               |   49 ++++---
 dix/getevents.c                            |    9 -
 dix/grabs.c                                |    2 
 dix/touch.c                                |   32 ++++-
 dix/window.c                               |  129 +++++++-------------
 doc/c-extensions                           |   19 ++-
 exa/exa_priv.h                             |    2 
 exa/exa_unaccel.c                          |   16 +-
 fb/fb.h                                    |    4 
 fb/fbblt.c                                 |   12 -
 fb/fbbltone.c                              |    8 -
 fb/fbpict.c                                |  153 ++++++++++++++++++++++++
 fb/fbscreen.c                              |    1 
 hw/dmx/doc/dmx.xml                         |   12 -
 hw/kdrive/ephyr/ephyrdriext.c              |    4 
 hw/kdrive/ephyr/ephyrglxext.c              |  179 +++++++++++++++++++++++++----
 hw/kdrive/ephyr/ephyrhostglx.c             |  121 +++++++++++++++----
 hw/kdrive/ephyr/ephyrhostglx.h             |    9 -
 hw/kdrive/src/kdrive.h                     |    1 
 hw/kdrive/src/kinput.c                     |    2 
 hw/vfb/InitInput.c                         |    1 
 hw/vfb/InitOutput.c                        |    1 
 hw/xfree86/common/Makefile.am              |    3 
 hw/xfree86/common/xf86.h                   |    4 
 hw/xfree86/common/xf86DGA.c                |    2 
 hw/xfree86/common/xf86Events.c             |    2 
 hw/xfree86/common/xf86Helper.c             |    6 
 hw/xfree86/common/xf86Module.h             |    2 
 hw/xfree86/common/xf86Opt.h                |    2 
 hw/xfree86/common/xf86Option.c             |    2 
 hw/xfree86/common/xf86str.h                |    2 
 hw/xfree86/common/xf86vmode.c              |    6 
 hw/xfree86/doc/ddxDesign.xml               |   20 ---
 hw/xfree86/dri/xf86dri.c                   |    4 
 hw/xfree86/dri2/dri2ext.c                  |    2 
 hw/xfree86/int10/generic.c                 |    3 
 hw/xfree86/os-support/bus/nobus.c          |    2 
 hw/xfree86/os-support/shared/agp_noop.c    |    2 
 hw/xfree86/os-support/shared/ioperm_noop.c |    4 
 hw/xfree86/os-support/stub/stub_init.c     |    6 
 hw/xfree86/sdksyms.sh                      |    2 
 hw/xnest/Screen.c                          |    1 
 hw/xnest/Visual.c                          |    1 
 hw/xquartz/applewm.c                       |    4 
 hw/xquartz/darwin.c                        |    1 
 hw/xquartz/xpr/appledri.c                  |    6 
 hw/xwin/InitOutput.c                       |   28 +---
 hw/xwin/Makefile.am                        |    6 
 hw/xwin/glx/Makefile.am                    |    3 
 hw/xwin/glx/gen_gl_wrappers.py             |   10 -
 hw/xwin/glx/glwrap.c                       |    2 
 hw/xwin/glx/indirect.c                     |   12 -
 hw/xwin/win.h                              |   19 ---
 hw/xwin/winallpriv.c                       |    2 
 hw/xwin/winclipboard.h                     |    3 
 hw/xwin/winclipboardtextconv.c             |   10 -
 hw/xwin/winclipboardthread.c               |    5 
 hw/xwin/winclipboardwrappers.c             |    9 -
 hw/xwin/wincursor.c                        |    3 
 hw/xwin/winerror.c                         |    4 
 hw/xwin/wingc.c                            |    5 
 hw/xwin/winlayouts.h                       |   10 -
 hw/xwin/winmonitors.c                      |    8 -
 hw/xwin/winms.h                            |    4 
 hw/xwin/winmsg.c                           |    4 
 hw/xwin/winmsg.h                           |   30 +++-
 hw/xwin/winmultiwindowwm.c                 |   10 -
 hw/xwin/winprefs.c                         |   23 +--
 hw/xwin/winprefslex.l                      |    7 -
 hw/xwin/winprefsyacc.y                     |   10 -
 hw/xwin/winprocarg.c                       |    4 
 hw/xwin/winregistry.c                      |   65 ----------
 hw/xwin/winscrinit.c                       |    6 
 hw/xwin/winshaddd.c                        |   18 --
 hw/xwin/winshadddnl.c                      |   64 ----------
 hw/xwin/winvalargs.c                       |    2 
 hw/xwin/winwindow.c                        |    6 
 hw/xwin/winwindow.h                        |    9 -
 hw/xwin/winwindowswm.c                     |    9 -
 include/Makefile.am                        |    2 
 include/dix-config.h.in                    |    3 
 include/dix.h                              |   12 -
 include/dixfont.h                          |   39 ------
 include/dixfontstubs.h                     |   45 +++++++
 include/dixstruct.h                        |   37 ++---
 include/input.h                            |    1 
 include/os.h                               |    7 -
 include/window.h                           |    3 
 include/windowstr.h                        |    4 
 include/xserver-properties.h               |    3 
 man/Xserver.man                            |    2 
 mi/Makefile.am                             |    3 
 mi/mibitblt.c                              |    6 
 mi/mibstore.c                              |   43 ------
 mi/mibstore.h                              |   23 ---
 mi/mipointer.c                             |    5 
 mi/mispans.c                               |    4 
 miext/damage/damage.c                      |   30 ++++
 os/access.c                                |   10 -
 os/connection.c                            |   16 +-
 os/io.c                                    |   22 +++
 os/osdep.h                                 |   19 ---
 os/osinit.c                                |    2 
 os/utils.c                                 |   20 +++
 os/xsha1.c                                 |   30 ++++
 randr/randrstr.h                           |    8 +
 render/picturestr.h                        |    8 -
 xfixes/cursor.c                            |  145 +++++++++++++++++------
 xkb/ddxList.c                              |    2 
 xkb/maprules.c                             |    1 
 xkb/xkb.c                                  |   27 ++--
 xkb/xkbAccessX.c                           |    2 
 xkb/xkbPrKeyEv.c                           |    4 
 xkb/xkbtext.c                              |    1 
 xkb/xkmread.c                              |    2 
 xorg-server.m4                             |    6 
 131 files changed, 1158 insertions(+), 860 deletions(-)

New commits:
commit 011f8458805e443ac9130865d2840a929a00cabf
Merge: 54ba26c b4e44b2
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Nov 5 17:16:07 2012 -0800

    Merge remote-tracking branch 'whot/for-keith'

commit b4e44b285ed0eee1d06514215a4b01d54f40094b
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Oct 31 19:29:45 2012 +0100

    Xi: Set modifier mask on touch events
    
    Button mask should be out-of-band with the emulated
    pointer events as touch devices don't truly have
    "buttons". Even though, it's handy to have the modifier
    mask from the paired keyboard on touch events.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 5cf873c..106da3a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1559,6 +1559,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     uint32_t touchid;
     int type = ev->any.type;
     int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);
+    DeviceIntPtr kbd;
 
     if (!t)
         return;
@@ -1618,6 +1619,10 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
+    kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
+    event_set_state(NULL, kbd, &ev->device_event);
+    ev->device_event.corestate = event_get_corestate(NULL, kbd);
+
     /* Make sure we have a valid window trace for event delivery; must be
      * called after event type mutation. Touch end events are always processed
      * in order to end touch records. */
commit 863f32c930d71073ee5f78452b78bd459d024867
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Oct 31 19:32:57 2012 +0100

    Xi: Update the device after delivering the emulated pointer event(#56558)
    
    Ensure emulated pointer events contain the state that applies before the
    event was processed, so the device state must be updated after delivering
    such emulated events.
    
    Co-authored-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4cbeb37..5cf873c 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1568,9 +1568,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     else
         touchid = ev->device_event.touchid;
 
-    if (emulate_pointer)
-        UpdateDeviceState(dev, &ev->device_event);
-
     if (type == ET_TouchBegin) {
         ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
                              emulate_pointer);
@@ -1617,6 +1614,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
      * events which _only_ emulate motion just work normally */
     if (emulate_pointer && ev->any.type != ET_TouchUpdate)
         DeliverEmulatedMotionEvent(dev, ti, ev);
+
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
@@ -1641,6 +1639,9 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
         if (ev->any.type == ET_TouchEnd)
             TouchEndTouch(dev, ti);
     }
+
+    if (emulate_pointer)
+        UpdateDeviceState(dev, &ev->device_event);
 }
 
 /**
commit 9a536820f6174befb22431bab375ef1af0a1ec29
Author: Jasper St. Pierre <jstpierre at mecheye.net>
Date:   Sat Nov 3 20:23:46 2012 -0400

    cursor: Fix up implementation for per-device barriers
    
    Support multiple mast devices being specified as a parameter to the
    barrier. This should implement all parts of the XFixes specification,
    minus the existing non-specification detail where specifying no devices
    is the same as specifying XIAllDevices.
    
    Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.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/xfixes/cursor.c b/xfixes/cursor.c
index 45b07c3..7c223dd 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -56,6 +56,7 @@
 #include "windowstr.h"
 #include "xace.h"
 #include "list.h"
+#include "exglobals.h"
 
 static RESTYPE CursorClientType;
 static RESTYPE CursorHideCountType;
@@ -118,6 +119,8 @@ struct PointerBarrierClient {
     ScreenPtr screen;
     struct PointerBarrier barrier;
     struct xorg_list entry;
+    int num_devices;
+    int *device_ids; /* num_devices */
 };
 
 /*
@@ -1132,6 +1135,31 @@ barrier_is_blocking(const struct PointerBarrier * barrier,
     return rc;
 }
 
+static BOOL
+barrier_blocks_device(struct PointerBarrierClient *client,
+                      DeviceIntPtr dev)
+{
+    int i;
+    int master_id;
+
+    /* Clients with no devices are treated as
+     * if they specified XIAllDevices. */
+    if (client->num_devices == 0)
+        return TRUE;
+
+    master_id = GetMaster(dev, POINTER_OR_FLOAT)->id;
+
+    for (i = 0; i < client->num_devices; i++) {
+        int device_id = client->device_ids[i];
+        if (device_id == XIAllDevices ||
+            device_id == XIAllMasterDevices ||
+            device_id == master_id)
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 /**
  * Find the nearest barrier that is blocking movement from x1/y1 to x2/y2.
  *
@@ -1143,7 +1171,8 @@ barrier_is_blocking(const struct PointerBarrier * barrier,
  * @return The barrier nearest to the movement origin that blocks this movement.
  */
 static struct PointerBarrier *
-barrier_find_nearest(CursorScreenPtr cs, int dir,
+barrier_find_nearest(CursorScreenPtr cs, DeviceIntPtr dev,
+                     int dir,
                      int x1, int y1, int x2, int y2)
 {
     struct PointerBarrierClient *c;
@@ -1157,6 +1186,9 @@ barrier_find_nearest(CursorScreenPtr cs, int dir,
         if (!barrier_is_blocking_direction(b, dir))
             continue;
 
+        if (!barrier_blocks_device(c, dev))
+            continue;
+
         if (barrier_is_blocking(b, x1, y1, x2, y2, &distance)) {
             if (min_distance > distance) {
                 min_distance = distance;
@@ -1221,7 +1253,7 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
 
 #define MAX_BARRIERS 2
         for (i = 0; i < MAX_BARRIERS; i++) {
-            nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+            nearest = barrier_find_nearest(cs, dev, dir, ox, oy, *x, *y);
             if (!nearest)
                 break;
 
@@ -1251,7 +1283,14 @@ CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
                            PointerBarrierClientPtr *client_out)
 {
     CursorScreenPtr cs = GetCursorScreen(screen);
-    struct PointerBarrierClient *ret = malloc(sizeof(*ret));
+    int err;
+    int size;
+    int i;
+    CARD16 *in_devices;
+    struct PointerBarrierClient *ret;
+
+    size = sizeof(*ret) + sizeof(int) * stuff->num_devices;
+    ret = malloc(size);
 
     *client_out = NULL;
 
@@ -1260,6 +1299,28 @@ CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
     }
 
     ret->screen = screen;
+    ret->num_devices = stuff->num_devices;
+
+    in_devices = (CARD16 *) &stuff[1];
+    for (i = 0; i < stuff->num_devices; i++) {
+        int device_id = in_devices[i];
+        DeviceIntPtr device;
+
+        if ((err = dixLookupDevice (&device, device_id,
+                                    client, DixReadAccess))) {
+            client->errorValue = device_id;
+            goto error;
+        }
+
+        if (!IsMaster (device)) {
+            client->errorValue = device_id;
+            err = BadDevice;
+            goto error;
+        }
+
+        ret->device_ids[i] = device_id;
+    }
+
     ret->barrier.x1 = min(stuff->x1, stuff->x2);
     ret->barrier.x2 = max(stuff->x1, stuff->x2);
     ret->barrier.y1 = min(stuff->y1, stuff->y2);
@@ -1273,6 +1334,10 @@ CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
 
     *client_out = ret;
     return Success;
+
+ error:
+    free(ret);
+    return err;
 }
 
 int
@@ -1294,10 +1359,6 @@ ProcXFixesCreatePointerBarrier(ClientPtr client)
         return err;
     }
 
-    /* This sure does need fixing. */
-    if (stuff->num_devices)
-        return BadImplementation;
-
     b.x1 = stuff->x1;
     b.x2 = stuff->x2;
     b.y1 = stuff->y1;
commit 944213bbc7099f1e0238f39973653d459efdc2c9
Author: Jasper St. Pierre <jstpierre at mecheye.net>
Date:   Sat Nov 3 20:23:45 2012 -0400

    cursor: Clean up barrier finding code a bit
    
    The current code manually unrolls the loop, by finding a barrier,
    clamping it, and then repeaing the code. Since we want to modify
    both passes of the loop to support device-specific barriers, make
    it into an actual loop.
    
    Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index f66bd68..45b07c3 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1204,6 +1204,7 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
         mode == Relative) {
         int ox, oy;
         int dir;
+        int i;
         struct PointerBarrier *nearest = NULL;
 
         /* where are we coming from */
@@ -1218,8 +1219,12 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
          */
         dir = barrier_get_direction(ox, oy, *x, *y);
 
-        nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
-        if (nearest) {
+#define MAX_BARRIERS 2
+        for (i = 0; i < MAX_BARRIERS; i++) {
+            nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
+            if (!nearest)
+                break;
+
             barrier_clamp_to_barrier(nearest, dir, x, y);
 
             if (barrier_is_vertical(nearest)) {
@@ -1230,11 +1235,6 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
                 dir &= ~(BarrierNegativeY | BarrierPositiveY);
                 oy = *y;
             }
-
-            nearest = barrier_find_nearest(cs, dir, ox, oy, *x, *y);
-            if (nearest) {
-                barrier_clamp_to_barrier(nearest, dir, x, y);
-            }
         }
     }
 
commit 1536bc2d213713af45541a15b5e49c552d8d0592
Author: Jasper St. Pierre <jstpierre at mecheye.net>
Date:   Sat Nov 3 20:23:44 2012 -0400

    cursor: Clean up pointer barrier creation code a tiny bit
    
    This will make it much simpler when we add more error paths to the code
    that constructs pointer barrier clients.
    
    Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 75b0374..f66bd68 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1245,28 +1245,34 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode,
     }
 }
 
-static struct PointerBarrierClient *
+static int
 CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
-                           xXFixesCreatePointerBarrierReq * stuff)
+                           xXFixesCreatePointerBarrierReq * stuff,
+                           PointerBarrierClientPtr *client_out)
 {
     CursorScreenPtr cs = GetCursorScreen(screen);
     struct PointerBarrierClient *ret = malloc(sizeof(*ret));
 
-    if (ret) {
-        ret->screen = screen;
-        ret->barrier.x1 = min(stuff->x1, stuff->x2);
-        ret->barrier.x2 = max(stuff->x1, stuff->x2);
-        ret->barrier.y1 = min(stuff->y1, stuff->y2);
-        ret->barrier.y2 = max(stuff->y1, stuff->y2);
-        ret->barrier.directions = stuff->directions & 0x0f;
-        if (barrier_is_horizontal(&ret->barrier))
-            ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
-        if (barrier_is_vertical(&ret->barrier))
-            ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
-        xorg_list_add(&ret->entry, &cs->barriers);
+    *client_out = NULL;
+
+    if (!ret) {
+        return BadAlloc;
     }
 
-    return ret;
+    ret->screen = screen;
+    ret->barrier.x1 = min(stuff->x1, stuff->x2);
+    ret->barrier.x2 = max(stuff->x1, stuff->x2);
+    ret->barrier.y1 = min(stuff->y1, stuff->y2);
+    ret->barrier.y2 = max(stuff->y1, stuff->y2);
+    ret->barrier.directions = stuff->directions & 0x0f;
+    if (barrier_is_horizontal(&ret->barrier))
+        ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
+    if (barrier_is_vertical(&ret->barrier))
+        ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
+    xorg_list_add(&ret->entry, &cs->barriers);
+
+    *client_out = ret;
+    return Success;
 }
 
 int
@@ -1304,9 +1310,9 @@ ProcXFixesCreatePointerBarrier(ClientPtr client)
     if (barrier_is_horizontal(&b) && barrier_is_vertical(&b))
         return BadValue;
 
-    if (!(barrier = CreatePointerBarrierClient(pWin->drawable.pScreen,
-                                               client, stuff)))
-        return BadAlloc;
+    if ((err = CreatePointerBarrierClient(pWin->drawable.pScreen,
+                                          client, stuff, &barrier)))
+        return err;
 
     if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier))
         return BadAlloc;
commit 04c885de715a7c989e48fc8cf2e61db2b401de2d
Author: Jasper St. Pierre <jstpierre at mecheye.net>
Date:   Sat Nov 3 20:23:43 2012 -0400

    cursor: CreatePointerBarrier has a variable request length
    
    Support this, and swap the devices in the SProc as well. Don't
    actually do anything with the devices just yet -- specifying any
    should still emit a BadImplementation.
    
    Based on a patch by Peter Hutterer <peter.hutterer at who-t.net>
    
    Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index c45da27..75b0374 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1279,7 +1279,7 @@ ProcXFixesCreatePointerBarrier(ClientPtr client)
 
     REQUEST(xXFixesCreatePointerBarrierReq);
 
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
     LEGAL_NEW_RESOURCE(stuff->barrier, client);
 
     err = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
@@ -1318,9 +1318,13 @@ int
 SProcXFixesCreatePointerBarrier(ClientPtr client)
 {
     REQUEST(xXFixesCreatePointerBarrierReq);
+    int i;
+    CARD16 *in_devices = (CARD16 *) &stuff[1];
 
     swaps(&stuff->length);
-    REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq);
+    swaps(&stuff->num_devices);
+    REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
+
     swapl(&stuff->barrier);
     swapl(&stuff->window);
     swaps(&stuff->x1);
@@ -1328,6 +1332,10 @@ SProcXFixesCreatePointerBarrier(ClientPtr client)
     swaps(&stuff->x2);
     swaps(&stuff->y2);
     swapl(&stuff->directions);
+    for (i = 0; i < stuff->num_devices; i++) {
+        swaps(in_devices + i);
+    }
+
     return ProcXFixesVector[stuff->xfixesReqType] (client);
 }
 
commit d74b63f95fc622afe83c53580f1b55346d55fa7a
Author: Jasper St. Pierre <jstpierre at mecheye.net>
Date:   Sat Nov 3 20:23:42 2012 -0400

    cursor: Fix a minor unused variable warning
    
    Signed-off-by: Jasper St. Pierre <jstpierre at mecheye.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/xfixes/cursor.c b/xfixes/cursor.c
index 4eee592..c45da27 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -196,7 +196,7 @@ CursorCloseScreen(ScreenPtr pScreen)
     Bool ret;
     _X_UNUSED CloseScreenProcPtr close_proc;
     _X_UNUSED DisplayCursorProcPtr display_proc;
-    ConstrainCursorHarderProcPtr constrain_proc;
+    _X_UNUSED ConstrainCursorHarderProcPtr constrain_proc;
 
     Unwrap(cs, pScreen, CloseScreen, close_proc);
     Unwrap(cs, pScreen, DisplayCursor, display_proc);
commit aad65415bff12c6860c19beac42e4165e598a40f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 11 13:02:27 2012 +1000

    dix: don't allow disabling XTest devices
    
    Disabling a XTest device followed by an XTest API call crashes the server.
    This could be fixed elsewhere but disabled devices must not send events
    anyway. The use-case for disabled XTest devices is somewhat limited, so
    simply disallow disabling the devices.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 7daf584..31d3a57 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -187,7 +187,10 @@ ProcXChangeDeviceControl(ClientPtr client)
     case DEVICE_ENABLE:
         e = (xDeviceEnableCtl *) &stuff[1];
 
-        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+        if (IsXTestDevice(dev, NULL))
+            status = !Success;
+        else
+            status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
 
         if (status == Success) {
             if (e->enable)
diff --git a/dix/devices.c b/dix/devices.c
index fd4916a..613323f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -145,9 +145,11 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
             return BadValue;
 
-        /* Don't allow disabling of VCP/VCK */
-        if ((dev == inputInfo.pointer ||dev ==
-             inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
+        /* Don't allow disabling of VCP/VCK or XTest devices */
+        if ((dev == inputInfo.pointer ||
+             dev == inputInfo.keyboard ||
+             IsXTestDevice(dev, NULL))
+            &&!(*(CARD8 *) prop->data))
             return BadAccess;
 
         if (!checkonly) {
commit 5b7384a3154a95a805b040e1910e276b52aada96
Author: Alexey Ten (Lynn) <alexeyten at gmail.com>
Date:   Tue Oct 23 12:32:31 2012 +0400

    Apply partial matches for option (#25873)
    
    Rules which match star (*) and option, like one below, should be applied
    
    layout[2] option    = symbols
    *         misc:typo = +typo(base)
    
    This is port of patch from #19563 (https://bugs.freedesktop.org/19563)
    because here we have own copy of maprules.c
    
    X.Org Bug 25873 <http://bugs.freedesktop.org/show_bug.cgi?id=25873>
    
    Signed-off-by: Alexey Ten (Lynn) <alexeyten 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/xkb/maprules.c b/xkb/maprules.c
index c6900ec..5462763 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -864,6 +864,7 @@ XkbRF_GetComponents(XkbRF_RulesPtr rules,
     XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Append);
     XkbRF_ApplyPartialMatches(rules, names);
     XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Option);
+    XkbRF_ApplyPartialMatches(rules, names);
 
     if (names->keycodes)
         names->keycodes = XkbRF_SubstituteVars(names->keycodes, &mdefs);
commit 54ba26cb1f9c59559cc3c449abeb31b2ce23bdba
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Oct 29 22:37:37 2012 -0500

    os: Add libnettle as a choice of SHA1 implementation
    
    libnettle is smaller than libgcrypt, currently being released more
    frequently, and has replaced the latter in gnutls-3.x (which is used
    by TigerVNC, so they can avoid pulling in two crypto libraries
    simultaneously).
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/configure.ac b/configure.ac
index 86153ec..38ac240 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1360,7 +1360,7 @@ CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
 
 # SHA1 hashing
 AC_ARG_WITH([sha1],
-            [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
+            [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
                             [choose SHA1 implementation])])
 AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
 if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
@@ -1423,6 +1423,18 @@ if test "x$with_sha1" = xlibsha1; then
 	          [Use libsha1 for SHA1])
 	SHA1_LIBS=-lsha1
 fi
+AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
+if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
+	with_sha1=libnettle
+fi
+if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
+	AC_MSG_ERROR([libnettle requested but not found])
+fi
+if test "x$with_sha1" = xlibnettle; then
+	AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
+	          [Use libnettle SHA1 functions])
+	SHA1_LIBS=-lnettle
+fi
 AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
 if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
 	with_sha1=libgcrypt
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 578f249..b270a32 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -157,6 +157,9 @@
 /* Define to use libgcrypt SHA1 functions */
 #undef HAVE_SHA1_IN_LIBGCRYPT
 
+/* Define to use libnettle SHA1 functions */
+#undef HAVE_SHA1_IN_LIBNETTLE
+
 /* Define to use libsha1 for SHA1 */
 #undef HAVE_SHA1_IN_LIBSHA1
 
diff --git a/os/xsha1.c b/os/xsha1.c
index fa66c7a..24c0aa2 100644
--- a/os/xsha1.c
+++ b/os/xsha1.c
@@ -116,6 +116,36 @@ x_sha1_final(void *ctx, unsigned char result[20])
     return 1;
 }
 
+#elif defined(HAVE_SHA1_IN_LIBNETTLE)   /* Use libnettle for SHA1 */
+
+#include <nettle/sha.h>
+
+void *
+x_sha1_init(void)
+{
+    struct sha1_ctx *ctx = malloc(sizeof(*ctx));
+
+    if (!ctx)
+        return NULL;
+    sha1_init(ctx);
+    return ctx;
+}
+
+int
+x_sha1_update(void *ctx, void *data, int size)
+{
+    sha1_update(ctx, size, data);
+    return 1;
+}
+
+int
+x_sha1_final(void *ctx, unsigned char result[20])
+{
+    sha1_digest(ctx, 20, result);
+    free(ctx);
+    return 1;
+}
+
 #elif defined(HAVE_SHA1_IN_LIBGCRYPT)   /* Use libgcrypt for SHA1 */
 
 #include <gcrypt.h>
commit 2ff56033de2b493a11d2bdf411b7057b1b3a22d7
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 02:11:59 2012 -0500

    Xi: fix fprint format warning
    
    exevents.c: In function 'ProcessTouchEvent':
    exevents.c:1601:20: warning: too many arguments for format
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4cbeb37..eb8a3de 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1598,7 +1598,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
         if (!ti) {
             DebugF("[Xi] %s: Failed to create new dix record for explicitly "
                    "grabbed touchpoint %d\n",
-                   dev->name, type, touchid);
+                   dev->name, touchid);
             return;
         }
 
commit d631dbe9b6a1faa4cd18ab7a4a0276db02b84b77
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Sat Oct 27 21:50:01 2012 -0500

    Xext: fix shadow warnings
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/shm.c b/Xext/shm.c
index 3fa04b9..5596090 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -135,11 +135,11 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
 
 #define VERIFY_SHMSEG(shmseg,shmdesc,client) \
 { \
-    int rc; \
-    rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
-                                 client, DixReadAccess); \
-    if (rc != Success) \
-	return rc; \
+    int tmprc; \
+    tmprc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
+                                    client, DixReadAccess); \
+    if (tmprc != Success) \
+	return tmprc; \
 }
 
 #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
diff --git a/Xext/xace.c b/Xext/xace.c
index b2e7dda..026d3c5 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -47,18 +47,18 @@ XaceHookDispatch(ClientPtr client, int major)
 
     if (major < 128) {
         /* Call the core dispatch hook */
-        XaceCoreDispatchRec rec = { client, Success /* default allow */  };
-        CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
-        return rec.status;
+        XaceCoreDispatchRec drec = { client, Success /* default allow */  };
+        CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &drec);
+        return drec.status;
     }
     else {
         /* Call the extension dispatch hook */
         ExtensionEntry *ext = GetExtensionEntry(major);
-        XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
+        XaceExtAccessRec erec = { client, ext, DixUseAccess, Success };
         if (ext)
-            CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
+            CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &erec);
         /* On error, pretend extension doesn't exist */
-        return (rec.status == Success) ? Success : BadRequest;
+        return (erec.status == Success) ? Success : BadRequest;
     }
 }
 
commit 20cf7918ed954a932a4cc404b3d0c4ca87a6ae16
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 21:08:52 2012 -0500

    Xext: fix redundant redeclaration warnings
    
    panoramiX.c:595:13: warning: redundant redeclaration of 'CreateConnectionBlock'
    ../include/dix.h:167:23: note: previous declaration of 'CreateConnectionBlock' was here
    xres.c:193:13: warning: redundant redeclaration of 'ResExtensionInit'
    ../include/extinit.h:109:13: note: previous declaration of 'ResExtensionInit'
    xtest.c:60:12: warning: redundant redeclaration of 'DeviceValuator'
    ../Xi/exglobals.h:61:12: note: previous declaration of 'DeviceValuator' was here
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 1c7197d..be475f7 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -592,8 +592,6 @@ PanoramiXExtensionInit(void)
 
 }
 
-extern Bool CreateConnectionBlock(void);
-
 Bool
 PanoramiXCreateConnectionBlock(void)
 {
diff --git a/Xext/xres.c b/Xext/xres.c
index 7d21ad7..445abca 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -190,8 +190,6 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
     ht_destroy(ctx->visitedResources);
 }
 
-extern void ResExtensionInit(void);
-
 static int
 ProcXResQueryVersion(ClientPtr client)
 {
diff --git a/Xext/xtest.c b/Xext/xtest.c
index c593372..2abdc7f 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -57,8 +57,6 @@
 
 #include "extinit.h"
 
-extern int DeviceValuator;
-
 /* XTest events are sent during request processing and may be interruped by
  * a SIGIO. We need a separate event list to avoid events overwriting each
  * other's memory */
commit 89447e1b50d2fb0e046102664045d1f9d4efc542
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Oct 15 01:33:05 2012 -0500

    Xext: fix unused variable warnings in xf86bigfont.c
    
    These were rendered unused by commit 2c7c520cfe0df30f4bc3adba59d9c62582823bf8.
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index faf81f7..46b3242 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -296,8 +296,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
 #endif
     };
     if (client->swapped) {
-        char tmp;
-
         swaps(&reply.sequenceNumber);
         swapl(&reply.length);
         swaps(&reply.majorVersion);
@@ -313,8 +311,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
 static void
 swapCharInfo(xCharInfo * pCI)
 {
-    char tmp;
-
     swaps(&pCI->leftSideBearing);
     swaps(&pCI->rightSideBearing);
     swaps(&pCI->characterWidth);
@@ -585,8 +581,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
         reply->shmid = shmid;
         reply->shmsegoffset = 0;
         if (client->swapped) {
-            char tmp;
-
             swaps(&reply->sequenceNumber);
             swapl(&reply->length);
             swapCharInfo(&reply->minBounds);
@@ -613,8 +607,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                 prFP->name = pFP->name;
                 prFP->value = pFP->value;
                 if (client->swapped) {
-                    char tmp;
-
                     swapl(&prFP->name);
                     swapl(&prFP->value);
                 }
@@ -636,8 +628,6 @@ ProcXF86BigfontQueryFont(ClientPtr client)
             for (j = 0; j < nCharInfos; j++, ps++) {
                 *ps = pIndex2UniqIndex[j];
                 if (client->swapped) {
-                    char tmp;
-
                     swaps(ps);
                 }
             }
@@ -673,7 +663,6 @@ static int
 SProcXF86BigfontQueryVersion(ClientPtr client)
 {
     REQUEST(xXF86BigfontQueryVersionReq);
-    char tmp;
 
     swaps(&stuff->length);
     return ProcXF86BigfontQueryVersion(client);
@@ -683,7 +672,6 @@ static int
 SProcXF86BigfontQueryFont(ClientPtr client)
 {
     REQUEST(xXF86BigfontQueryFontReq);
-    char tmp;
 
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
commit 344eea237fc07dedfd733d14f95ed0ad26bb5f81
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 02:04:34 2012 -0500

    xkb: fix shadow warnings
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 79f4637..729c5ae 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -131,8 +131,6 @@ XkbDDXListComponent(DeviceIntPtr dev,
     file = list->pattern[what];
     map = strrchr(file, '(');
     if (map != NULL) {
-        char *tmp;
-
         map++;
         tmp = strrchr(map, ')');
         if ((tmp == NULL) || (tmp[1] != '\0')) {
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 4440a98..efb178c 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -57,10 +57,10 @@ static RESTYPE RT_XKBCLIENT;
 
 #define	CHK_DEVICE(dev, id, client, access_mode, lf) {\
     int why;\
-    int rc = lf(&(dev), id, client, access_mode, &why);\
-    if (rc != Success) {\
+    int tmprc = lf(&(dev), id, client, access_mode, &why);\
+    if (tmprc != Success) {\
 	client->errorValue = _XkbErrCode2(why, id);\
-	return rc;\
+	return tmprc;\
     }\
 }
 
@@ -1026,22 +1026,22 @@ XkbWriteKeyTypes(XkbDescPtr xkb,
 
         buf = (char *) &wire[1];
         if (wire->nMapEntries > 0) {
-            xkbKTMapEntryWireDesc *wire;
+            xkbKTMapEntryWireDesc *ewire;
             XkbKTMapEntryPtr entry;
 
-            wire = (xkbKTMapEntryWireDesc *) buf;
+            ewire = (xkbKTMapEntryWireDesc *) buf;
             entry = type->map;
-            for (n = 0; n < type->map_count; n++, wire++, entry++) {
-                wire->active = entry->active;
-                wire->mask = entry->mods.mask;
-                wire->level = entry->level;
-                wire->realMods = entry->mods.real_mods;
-                wire->virtualMods = entry->mods.vmods;
+            for (n = 0; n < type->map_count; n++, ewire++, entry++) {
+                ewire->active = entry->active;
+                ewire->mask = entry->mods.mask;
+                ewire->level = entry->level;
+                ewire->realMods = entry->mods.real_mods;
+                ewire->virtualMods = entry->mods.vmods;
                 if (client->swapped) {
-                    swaps(&wire->virtualMods);
+                    swaps(&ewire->virtualMods);
                 }
             }
-            buf = (char *) wire;
+            buf = (char *) ewire;
             if (type->preserve != NULL) {
                 xkbModsWireDesc *pwire;
                 XkbModsPtr preserve;
@@ -2903,7 +2903,6 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
     }
 
     if (req->groups != 0) {
-        unsigned i, bit;
         xkbModsWireDesc *wire = (xkbModsWireDesc *) data;
 
         for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) {
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index 3241183..b24fd6c 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -104,13 +104,13 @@ XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd)
                     return;
                 }
                 if (rg->currentDown != 0) {
-                    int key = event->detail.key;
+                    int tmpkey = event->detail.key;
 
                     event->type = ET_KeyRelease;
                     event->detail.key = rg->currentDown;
                     XkbHandleActions(keybd, keybd, event);
                     event->type = ET_KeyPress;
-                    event->detail.key = key;
+                    event->detail.key = tmpkey;
                 }
                 rg->currentDown = key;
             }
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index f66a08f..fdf1d17 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -1266,7 +1266,6 @@ XkbBehaviorText(XkbDescPtr xkb, XkbBehavior * behavior, unsigned format)
         }
         else if (type == XkbKB_RadioGroup) {
             int g;
-            char *tmp;
 
             g = ((behavior->data) & (~XkbKB_RGAllowNone)) + 1;
             if (XkbKB_RGAllowNone & behavior->data) {
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index 45da965..258bb91 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -772,8 +772,6 @@ ReadXkmSymbols(FILE * file, XkbDescPtr xkb)
         memset((char *) typeName, 0, XkbNumKbdGroups * sizeof(Atom));
         memset((char *) type, 0, XkbNumKbdGroups * sizeof(XkbKeyTypePtr));
         if (wireMap.flags & XkmKeyHasTypes) {
-            register int g;
-
             for (g = 0; g < XkbNumKbdGroups; g++) {
                 if ((wireMap.flags & (1 << g)) &&
                     ((tmp = XkmGetCountedString(file, buf, 100)) > 0)) {
commit 7f1d74e8a906210eafc637df81ded62c3adff748
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 02:06:54 2012 -0500

    render: fix shadow warnings
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/render/picturestr.h b/render/picturestr.h
index dc00f41..5644f28 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -363,10 +363,10 @@ extern _X_EXPORT RESTYPE GlyphSetType;
 #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p)
 
 #define VERIFY_PICTURE(pPicture, pid, client, mode) {\
-    int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
-	                             PictureType, client, mode);\
-    if (rc != Success)\
-	return rc;\
+    int tmprc = dixLookupResourceByType((pointer)&(pPicture), pid,\
+	                                PictureType, client, mode);\
+    if (tmprc != Success)\
+	return tmprc;\
 }
 
 #define VERIFY_ALPHA(pPicture, pid, client, mode) {\
commit 8e86123998d26d26f0f60dcbb9836c38e5a4c3a5
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 01:19:12 2012 -0500

    randr: export more provider property symbols
    
    These were added as part of commit 66d92afeaeed9f4a19267d95a1f81b9bf27162a5
    but never declared or exported.  Fixes warnings:
    
    rrproviderproperty.c:255:1: warning: no previous prototype for 'RRPostProviderPendingProperties'
    rrproviderproperty.c:327:1: warning: no previous prototype for 'RRConfigureProviderProperty'
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/randr/randrstr.h b/randr/randrstr.h
index 212b0a9..a16302f 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -933,6 +933,14 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
                        pointer value, Bool sendevent, Bool pending);
 
 extern _X_EXPORT int
+ RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
+                             Bool pending, Bool range, Bool immutable,
+                             int num_values, INT32 *values);
+
+extern _X_EXPORT Bool
+ RRPostProviderPendingProperties(RRProviderPtr provider);
+
+extern _X_EXPORT int
  ProcRRGetProviderProperty(ClientPtr client);
 
 extern _X_EXPORT int
commit f02e27e4fcc34413b2051e5a01edc92172fa8612
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 02:16:17 2012 -0500

    mi: fix shadow warnings
    
    mibitblt.c: In function 'miGetImage':
    mibitblt.c:617:20: warning: declaration of 'pt' shadows a previous local
    mibitblt.c:609:17: warning: shadowed declaration is here
    mispans.c: In function 'miFillUniqueSpanGroup':
    mispans.c:456:33: warning: declaration of 'i' shadows a previous local
    mispans.c:382:9: warning: shadowed declaration is here
    mispans.c:488:17: warning: declaration of 'i' shadows a previous local
    mispans.c:382:9: warning: shadowed declaration is here
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index b9873c1..b0d14ae 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -614,7 +614,7 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
     if (format == ZPixmap) {
         if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) {
             ChangeGCVal gcv;
-            xPoint pt;
+            xPoint xpt;
 
             pGC = GetScratchGC(depth, pDraw->pScreen);
             if (!pGC)
@@ -629,9 +629,9 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
              * Clear the pixmap before doing anything else
              */
             ValidateGC((DrawablePtr) pPixmap, pGC);
-            pt.x = pt.y = 0;
+            xpt.x = xpt.y = 0;
             width = w;
-            (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &pt, &width,
+            (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width,
                                     TRUE);
 
             /* alu is already GXCopy */
diff --git a/mi/mispans.c b/mi/mispans.c
index 0f89880..11c8a43 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -453,8 +453,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
                             (int *) realloc(newspans->widths,
                                             ysizes[index] * sizeof(int));
                         if (!newpoints || !newwidths) {
-                            int i;
-
                             for (i = 0; i < ylength; i++) {
                                 free(yspans[i].points);
                                 free(yspans[i].widths);
@@ -485,8 +483,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
         points = malloc(count * sizeof(DDXPointRec));
         widths = malloc(count * sizeof(int));
         if (!points || !widths) {
-            int i;
-
             for (i = 0; i < ylength; i++) {
                 free(yspans[i].points);
                 free(yspans[i].widths);
commit 1fe30c00679bd36a6355b48b94b87564d528ff28
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 02:21:04 2012 -0500

    fb: fix shadow warnings
    
    fbblt.c: In function 'fbBlt':
    fbblt.c:76:16: warning: declaration of 'src' shadows a previous local
    fbblt.c:52:13: warning: shadowed declaration is here
    fbblt.c:77:16: warning: declaration of 'dst' shadows a previous local
    fbblt.c:52:19: warning: shadowed declaration is here
    fbbltone.c: In function 'fbBltPlane':
    fbbltone.c:742:13: warning: declaration of 'w' shadows a previous local
    fbbltone.c:725:9: warning: shadowed declaration is here
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/fb/fbblt.c b/fb/fbblt.c
index 17bd698..72a05f6 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -73,21 +73,21 @@ fbBlt(FbBits * srcLine,
     if (alu == GXcopy && pm == FB_ALLONES && !careful &&
         !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
         int i;
-        CARD8 *src = (CARD8 *) srcLine;
-        CARD8 *dst = (CARD8 *) dstLine;
+        CARD8 *tmpsrc = (CARD8 *) srcLine;
+        CARD8 *tmpdst = (CARD8 *) dstLine;
 
         srcStride *= sizeof(FbBits);
         dstStride *= sizeof(FbBits);
         width >>= 3;
-        src += (srcX >> 3);
-        dst += (dstX >> 3);
+        tmpsrc += (srcX >> 3);
+        tmpdst += (dstX >> 3);
 
         if (!upsidedown)
             for (i = 0; i < height; i++)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+                MEMCPY_WRAPPED(tmpdst + i * dstStride, tmpsrc + i * srcStride, width);
         else
             for (i = height - 1; i >= 0; i--)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+                MEMCPY_WRAPPED(tmpdst + i * dstStride, tmpsrc + i * srcStride, width);
 
         return;
     }
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index eb7cf94..bfcb5a2 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -739,12 +739,12 @@ fbBltPlane(FbBits * src,
 
     pm = fbReplicatePixel(planeMask, srcBpp);
     if (srcBpp == 24) {
-        int w = 24;
+        int tmpw = 24;
 
         rot0 = FbFirst24Rot(srcX);
-        if (srcX + w > FB_UNIT)
-            w = FB_UNIT - srcX;
-        srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, w);
+        if (srcX + tmpw > FB_UNIT)
+            tmpw = FB_UNIT - srcX;
+        srcMaskFirst = FbRot24(pm, rot0) & FbBitsMask(srcX, tmpw);
     }
     else {
         rot0 = 0;
commit e8d45f301845f70b76407577b92363934ca4f19e
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 20:54:56 2012 -0500

    dix: fix shadow warnings
    
    dispatch.c: In function 'ProcCopyArea':
    dispatch.c:1608:5: warning: declaration of 'rc' shadows a previous local
    dispatch.c:1604:9: warning: shadowed declaration is here
    dispatch.c: In function 'ProcCopyPlane':
    dispatch.c:1647:5: warning: declaration of 'rc' shadows a previous local
    dispatch.c:1643:9: warning: shadowed declaration is here
    events.c: In function 'GetClientsForDelivery':
    events.c:2030:68: warning: declaration of 'clients' shadows a global declaration
    ../include/dix.h:124:28: warning: shadowed declaration is here
    events.c: In function 'DeliverEventToWindowMask':
    events.c:2113:19: warning: declaration of 'clients' shadows a global declaration
    ../include/dix.h:124:28: warning: shadowed declaration is here
    events.c: In function 'EventSuppressForWindow':
    events.c:4420:12: warning: declaration of 'free' shadows a global declaration
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index ddb5b34..e790bfc 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2027,19 +2027,19 @@ DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
  */
 static Bool
 GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
-                      xEvent *events, Mask filter, InputClients ** clients)
+                      xEvent *events, Mask filter, InputClients ** iclients)
 {
     int rc = 0;
 
     if (core_get_type(events) != 0)
-        *clients = (InputClients *) wOtherClients(win);
+        *iclients = (InputClients *) wOtherClients(win);
     else if (xi2_get_type(events) != 0) {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
 
         /* Has any client selected for the event? */
         if (!WindowXI2MaskIsset(dev, win, events))
             goto out;
-        *clients = inputMasks->inputClients;
+        *iclients = inputMasks->inputClients;
     }
     else {
         OtherInputMasks *inputMasks = wOtherInputMasks(win);
@@ -2048,7 +2048,7 @@ GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
         if (!inputMasks || !(inputMasks->inputEvents[dev->id] & filter))
             goto out;
 
-        *clients = inputMasks->inputClients;
+        *iclients = inputMasks->inputClients;
     }
 
     rc = 1;
@@ -2110,12 +2110,12 @@ DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
                          int count, Mask filter, GrabPtr grab,
                          ClientPtr *client_return, Mask *mask_return)
 {
-    InputClients *clients;
+    InputClients *iclients;
 
-    if (!GetClientsForDelivery(dev, win, events, filter, &clients))
+    if (!GetClientsForDelivery(dev, win, events, filter, &iclients))
         return EVENT_SKIP;
 
-    return DeliverEventToInputClients(dev, clients, win, events, count, filter,
+    return DeliverEventToInputClients(dev, iclients, win, events, count, filter,
                                       grab, client_return, mask_return);
 
 }
@@ -4417,7 +4417,7 @@ int
 EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
                        Mask mask, Bool *checkOptional)
 {
-    int i, free;
+    int i, freed;
 
     if (mask & ~PropagateMask) {
         client->errorValue = mask;
@@ -4428,14 +4428,14 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
     if (!mask)
         i = 0;
     else {
-        for (i = DNPMCOUNT, free = 0; --i > 0;) {
+        for (i = DNPMCOUNT, freed = 0; --i > 0;) {
             if (!DontPropagateRefCnts[i])
-                free = i;
+                freed = i;
             else if (mask == DontPropagateMasks[i])
                 break;
         }
-        if (!i && free) {
-            i = free;
+        if (!i && freed) {
+            i = freed;
             DontPropagateMasks[i] = mask;
         }
     }
diff --git a/include/dix.h b/include/dix.h
index 74123b5..171e56e 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -88,12 +88,12 @@ SOFTWARE.
 
 #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
     {\
-	int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
-	if (rc != Success)\
-	    return rc;\
-	rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
-	if (rc != Success)\
-	    return rc;\
+	int tmprc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
+	if (tmprc != Success)\
+	    return tmprc;\
+	tmprc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
+	if (tmprc != Success)\
+	    return tmprc;\
 	if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
 	    return BadMatch;\
     }\
commit 1aa783754e21a263b0973516850656b13fd18f0d
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Tue Oct 16 14:06:30 2012 -0500

    dix: fix redundant redeclaration warnings in dixfont
    
    These functions are already declared in <X11/fonts/fontproto.h>.
    Redeclaring them just for _X_EXPORT causes tons of warnings throughout
    xserver, but they need to be declared somewhere to be picked up by
    sdksyms.sh.  Doing so in a private header limits the warnings to
    sdksyms.c; fixing those as well would require changes to fontsproto.
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index ad21860..feb765d 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1823,12 +1823,14 @@ InitFonts(void)
     register_fpe_functions();
 }
 
+_X_EXPORT
 int
 GetDefaultPointSize(void)
 {
     return 120;
 }
 
+_X_EXPORT
 FontResolutionPtr
 GetClientResolutions(int *num)
 {
@@ -1861,6 +1863,7 @@ GetClientResolutions(int *num)
  * should be called (only once!) by each type of fpe when initialized
  */
 
+_X_EXPORT
 int
 RegisterFPEFunctions(NameCheckFunc name_func,
                      InitFpeFunc init_func,
@@ -1932,24 +1935,28 @@ find_old_font(XID id)
     return (FontPtr) pFont;
 }
 
+_X_EXPORT
 Font
 GetNewFontClientID(void)
 {
     return FakeClientID(0);
 }
 
+_X_EXPORT
 int
 StoreFontClientFont(FontPtr pfont, Font id)
 {
     return AddResource(id, RT_NONE, (pointer) pfont);
 }
 
+_X_EXPORT
 void
 DeleteFontClientID(Font id)
 {
     FreeResource(id, RT_NONE);
 }
 
+_X_EXPORT
 int
 client_auth_generation(ClientPtr client)
 {
@@ -1959,6 +1966,7 @@ client_auth_generation(ClientPtr client)
 static int fs_handlers_installed = 0;
 static unsigned int last_server_gen;
 
+_X_EXPORT
 int
 init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
 {
@@ -1977,6 +1985,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
     return Successful;
 }
 
+_X_EXPORT
 void
 remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler,
                    Bool all)
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index fa19893..48b48b5 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -259,6 +259,7 @@ cat > sdksyms.c << EOF
 #include "dixevents.h"
 #include "dixfont.h"
 #include "dixfontstr.h"
+#include "dixfontstubs.h"
 #include "dixgrabs.h"
 #include "dixstruct.h"
 #include "exevents.h"
diff --git a/include/Makefile.am b/include/Makefile.am
index 33116f2..5cdea1d 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -69,6 +69,6 @@ AM_CFLAGS = $(DIX_CFLAGS)
 
 EXTRA_DIST = 	\
 	dix-config-apple-verbatim.h \
-	eventconvert.h eventstr.h inpututils.h \
+	dixfontstubs.h eventconvert.h eventstr.h inpututils.h \
 	protocol-versions.h \
 	xsha1.h
diff --git a/include/dixfont.h b/include/dixfont.h
index 3d09eb5..0a5f105 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -28,6 +28,7 @@ SOFTWARE.
 #include <X11/fonts/font.h>
 #include "closure.h"
 #include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fontproto.h>
 
 #define NullDIXFontProp ((DIXFontPropPtr)0)
 
@@ -143,42 +144,4 @@ extern _X_EXPORT void SetGlyphCachingMode(int /*newmode */ );
 
 extern _X_EXPORT void register_fpe_functions(void);
 
-/*
- * libXfont stubs.
- */
-extern _X_EXPORT int client_auth_generation(ClientPtr client);
-
-extern _X_EXPORT void DeleteFontClientID(Font id);
-
-extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num);
-
-extern _X_EXPORT int GetDefaultPointSize(void);
-
-extern _X_EXPORT Font GetNewFontClientID(void);
-
-extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
-                                      BlockHandlerProcPtr block_handler);
-
-extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
-                                          InitFpeFunc init_func,
-                                          FreeFpeFunc free_func,
-                                          ResetFpeFunc reset_func,
-                                          OpenFontFunc open_func,
-                                          CloseFontFunc close_func,
-                                          ListFontsFunc list_func,
-                                          StartLfwiFunc start_lfwi_func,
-                                          NextLfwiFunc next_lfwi_func,
-                                          WakeupFpeFunc wakeup_func,
-                                          ClientDiedFunc client_died,
-                                          LoadGlyphsFunc load_glyphs,
-                                          StartLaFunc start_list_alias_func,
-                                          NextLaFunc next_list_alias_func,
-                                          SetPathFunc set_path_func);
-
-extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
-                                         BlockHandlerProcPtr blockHandler,
-                                         Bool all);
-
-extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
-
 #endif                          /* DIXFONT_H */
diff --git a/include/dixfontstubs.h b/include/dixfontstubs.h
new file mode 100644
index 0000000..0454ffa
--- /dev/null
+++ b/include/dixfontstubs.h
@@ -0,0 +1,45 @@
+#ifndef DIXFONTSTUBS_H
+#define DIXFONTSTUBS_H 1
+
+/*
+ * libXfont stubs replacements
+ * This header exists solely for the purpose of sdksyms generation;
+ * source code should #include "dixfonts.h" instead, which pulls in these
+ * declarations from <X11/fonts/fontproto.h>
+ */
+extern _X_EXPORT int client_auth_generation(ClientPtr client);
+
+extern _X_EXPORT void DeleteFontClientID(Font id);
+
+extern _X_EXPORT FontResolutionPtr GetClientResolutions(int *num);
+
+extern _X_EXPORT int GetDefaultPointSize(void);
+
+extern _X_EXPORT Font GetNewFontClientID(void);
+
+extern _X_EXPORT int init_fs_handlers(FontPathElementPtr fpe,
+                                      BlockHandlerProcPtr block_handler);
+
+extern _X_EXPORT int RegisterFPEFunctions(NameCheckFunc name_func,
+                                          InitFpeFunc init_func,
+                                          FreeFpeFunc free_func,
+                                          ResetFpeFunc reset_func,
+                                          OpenFontFunc open_func,
+                                          CloseFontFunc close_func,
+                                          ListFontsFunc list_func,
+                                          StartLfwiFunc start_lfwi_func,
+                                          NextLfwiFunc next_lfwi_func,
+                                          WakeupFpeFunc wakeup_func,
+                                          ClientDiedFunc client_died,
+                                          LoadGlyphsFunc load_glyphs,
+                                          StartLaFunc start_list_alias_func,
+                                          NextLaFunc next_list_alias_func,
+                                          SetPathFunc set_path_func);
+
+extern _X_EXPORT void remove_fs_handlers(FontPathElementPtr fpe,
+                                         BlockHandlerProcPtr blockHandler,
+                                         Bool all);
+
+extern _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id);
+
+#endif
commit 27c5966de35d4726dd9795b4828d4236851f6a88
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Mon Oct 15 01:25:17 2012 -0500

    xfree86: os-support: fix old-style function definition warnings
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/os-support/bus/nobus.c b/hw/xfree86/os-support/bus/nobus.c
index dca58fe..dc36ecd 100644
--- a/hw/xfree86/os-support/bus/nobus.c
+++ b/hw/xfree86/os-support/bus/nobus.c
@@ -1,5 +1,5 @@
 static void
-__noop_to_appease_ar__()
+__noop_to_appease_ar__(void)
 {
     return;
 }
diff --git a/hw/xfree86/os-support/shared/agp_noop.c b/hw/xfree86/os-support/shared/agp_noop.c
index 9c6ed4b..da486c0 100644
--- a/hw/xfree86/os-support/shared/agp_noop.c
+++ b/hw/xfree86/os-support/shared/agp_noop.c
@@ -47,7 +47,7 @@ xf86GARTCloseScreen(int screenNum)
 }
 
 Bool
-xf86AgpGARTSupported()
+xf86AgpGARTSupported(void)
 {
     return FALSE;
 }
diff --git a/hw/xfree86/os-support/shared/ioperm_noop.c b/hw/xfree86/os-support/shared/ioperm_noop.c
index 30688c0..eeacee9 100644
--- a/hw/xfree86/os-support/shared/ioperm_noop.c
+++ b/hw/xfree86/os-support/shared/ioperm_noop.c
@@ -36,13 +36,13 @@
 #include "xf86_OSlib.h"
 
 Bool
-xf86EnableIO()
+xf86EnableIO(void)
 {
     return TRUE;
 }
 
 void
-xf86DisableIO()
+xf86DisableIO(void)
 {
     return;
 }
diff --git a/hw/xfree86/os-support/stub/stub_init.c b/hw/xfree86/os-support/stub/stub_init.c
index 629675d..d3e0c3f 100644
--- a/hw/xfree86/os-support/stub/stub_init.c
+++ b/hw/xfree86/os-support/stub/stub_init.c
@@ -5,12 +5,12 @@
 #include "xf86_OSlib.h"
 
 void
-xf86OpenConsole()
+xf86OpenConsole(void)
 {
 }
 
 void
-xf86CloseConsole()
+xf86CloseConsole(void)
 {
 }
 
@@ -21,6 +21,6 @@ xf86ProcessArgument(int argc, char *argv[], int i)
 }
 
 void
-xf86UseMsg()
+xf86UseMsg(void)
 {
 }
commit 64b961bb21369aaea694d883f361a36bc23b19b9
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Wed Oct 24 23:57:11 2012 -0500

    macros: clarify documentation
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xorg-server.m4 b/xorg-server.m4
index bdecf62..18255b9 100644
--- a/xorg-server.m4
+++ b/xorg-server.m4
@@ -23,10 +23,10 @@ dnl other dealings in this Software without prior written authorization
 dnl from the copyright holders.
 dnl 
 
-# XORG_DRIVER_CHECK_EXT()
+# XORG_DRIVER_CHECK_EXT(MACRO, PROTO)
 # --------------------------
-# Checks for the $1 define in xorg-server.h (from the sdk).  If it
-# is defined, then add $1 to $REQUIRED_MODULES.
+# Checks for the MACRO define in xorg-server.h (from the sdk).  If it
+# is defined, then add the given PROTO to $REQUIRED_MODULES.
 
 AC_DEFUN([XORG_DRIVER_CHECK_EXT],[
 	AC_REQUIRE([PKG_PROG_PKG_CONFIG])
commit 04f980ead5e9af066143a921e0a0e98f26f28ee5
Merge: a194630 a4941ce
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Nov 5 08:45:21 2012 -0800

    Merge remote-tracking branch 'jturney/mingw-w64-w32api'

commit a4941ce4961f254ac31e2cef6dd0863866246bab
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 21 15:31:16 2012 +0100

    hw/xwin: Wrap 'Status' when including ddraw.h
    
    Status is #defined as an alias for a type in xkbsrv.h, which conflicts with it's
    use as a parameter name in rpcdce.h
    
    This fixes compilation with MinGW-w64 w32api headers
    
    (The MinGW-w64 w32api headers actually provide a ddraw.h, so this fix tries to
    do things in a way which will still work if our private copy of ddraw.h is
    eventually removed)
    
    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/winms.h b/hw/xwin/winms.h
index 4355bae..5282fc9 100644
--- a/hw/xwin/winms.h
+++ b/hw/xwin/winms.h
@@ -42,7 +42,11 @@
 #include <X11/Xwindows.h>
 #include <windowsx.h>
 
+#pragma push_macro("Status")
+#undef Status
+#define Status wStatus
 #include "ddraw.h"
+#pragma pop_macro("Status")
 
 #undef CreateWindow
 
commit 57bbf6e2aead6cce76a9f5d43829b58868a26059
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Oct 29 14:35:45 2012 +0000

    hw/xwin: Remove pointless winFinishCreateWindowsWindowDDNL()
    
    Remove pointless winFinishCreateWindowsWindowDDNL() and the useless DirectDraw
    surface pointers in the window privates
    
    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 ac9d579..42925e3 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -55,8 +55,6 @@
 #include <X11/Xwindows.h>
 
 /* Local headers */
-#include "objbase.h"
-#include "ddraw.h"
 #include "winwindow.h"
 #include "winprefs.h"
 #include "window.h"
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index 302ba6c..e730615 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -508,50 +508,6 @@ winFreeFBShadowDDNL(ScreenPtr pScreen)
     pScreenInfo->pfb = NULL;
 }
 
-#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
-/*
- * Create a DirectDraw surface for the new multi-window window
- */
-
-static
-    Bool
-winFinishCreateWindowsWindowDDNL(WindowPtr pWin)
-{
-    winWindowPriv(pWin);
-    winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
-    HRESULT ddrval = DD_OK;
-    DDSURFACEDESC2 ddsd;
-    int iWidth, iHeight;
-    int iX, iY;
-
-    winDebug("winFinishCreateWindowsWindowDDNL!\n\n");
-
-    iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
-    iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
-
-    iWidth = pWin->drawable.width;
-    iHeight = pWin->drawable.height;
-
-    /* Describe the primary surface */
-    ZeroMemory(&ddsd, sizeof(ddsd));
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
-    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-    ddsd.dwHeight = iHeight;
-    ddsd.dwWidth = iWidth;
-
-    /* Create the primary surface */
-    ddrval = IDirectDraw4_CreateSurface(pScreenPriv->pdd4,
-                                        &ddsd, &pWinPriv->pddsPrimary4, NULL);
-    if (FAILED(ddrval)) {
-        ErrorF("winFinishCreateWindowsWindowDDNL - Could not create primary "
-               "surface: %08x\n", (unsigned int) ddrval);
-        return FALSE;
-    }
-    return TRUE;
-}
-#endif
-
 /*
  * Transfer the damaged regions of the shadow framebuffer to the display.
  */
@@ -1260,7 +1216,7 @@ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
     pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
 #ifdef XWIN_MULTIWINDOW
     pScreenPriv->pwinFinishCreateWindowsWindow
-        = winFinishCreateWindowsWindowDDNL;
+        = (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
 #endif
 
     return TRUE;
diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h
index a5919ee..49a720a 100644
--- a/hw/xwin/winwindow.h
+++ b/hw/xwin/winwindow.h
@@ -81,15 +81,6 @@ typedef struct {
 #ifdef XWIN_GLX_WINDOWS
     Bool fWglUsed;
 #endif
-
-    /* Privates used by primary fb DirectDraw server */
-    LPDDSURFACEDESC pddsdPrimary;
-
-    /* Privates used by shadow fb DirectDraw Nonlocking server */
-    LPDIRECTDRAWSURFACE4 pddsPrimary4;
-
-    /* Privates used by both shadow fb DirectDraw servers */
-    LPDIRECTDRAWCLIPPER pddcPrimary;
 } winPrivWinRec, *winPrivWinPtr;
 
 #ifdef XWIN_MULTIWINDOW
commit 5bc4c53d23d02d3d7297a8f00a92b6e4d5e0d6fe
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Sep 4 17:28:16 2012 +0100

    hw/xwin: Link with libdxguid rather than defining the DirectX GUIDs ourselves
    
    Decruftify by linking with libdxguid rather than defining the DirectX GUIDs
    ourselves. This fixes compilation with MinGW-w64 w32api headers, which do not
    provide GUID_SECT (which only ever did anything for gcc prior to 2.95, anyhow)
    
    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/Makefile.am b/hw/xwin/Makefile.am
index 99dc556..3fcaf9d 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -147,6 +147,8 @@ XWin_SOURCES = $(SRCS)
 
 INCLUDES = -I$(top_srcdir)/miext/rootless
 
+XWIN_SYS_LIBS += -ldxguid
+
 XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
 XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
 XWin_LDFLAGS = -mwindows -static
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 4c77cc0..3afc57c 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -37,24 +37,6 @@
 #include "win.h"
 
 /*
- * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
- * so we have to redefine it here.
- */
-#ifdef DEFINE_GUID
-#undef DEFINE_GUID
-#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif                          /* DEFINE_GUID */
-
-/*
- * FIXME: Headers are broken, IID_IDirectDraw2 has to be defined
- * here manually.  Should be handled by ddraw.h
- */
-#ifndef IID_IDirectDraw2
-DEFINE_GUID(IID_IDirectDraw2, 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00,
-            0xAA, 0x00, 0xB9, 0x33, 0x56);
-#endif                          /* IID_IDirectDraw2 */
-
-/*
  * Local prototypes
  */
 
diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c
index c087975..302ba6c 100644
--- a/hw/xwin/winshadddnl.c
+++ b/hw/xwin/winshadddnl.c
@@ -36,24 +36,6 @@
 #endif
 #include "win.h"
 
-/*
- * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
- * so we have to redefine it here.
- */
-#ifdef DEFINE_GUID
-#undef DEFINE_GUID
-#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#endif                          /* DEFINE_GUID */
-
-/*
- * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
- * here manually.  Should be handled by ddraw.h
- */
-#ifndef IID_IDirectDraw4
-DEFINE_GUID(IID_IDirectDraw4, 0x9c59509a, 0x39bd, 0x11d1, 0x8c, 0x4a, 0x00,
-            0xc0, 0x4f, 0xd9, 0x30, 0xc5);
-#endif                          /* IID_IDirectDraw4 */
-
 #define FAIL_MSG_MAX_BLT	10
 
 /*
commit a194630f7f7b287cb4ea4a459df0745f4c0d4c1a
Merge: 74a3130 d511a30
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Nov 1 13:38:54 2012 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit d511a3016a79c50cb38e7504d4831a9ae128e422
Author: Benjamin Tissoires <benjamin.tissoires at gmail.com>
Date:   Fri Oct 26 16:27:34 2012 +0200

    Add missing labels for multitouch valuators
    
    ABS_MT_DISTANCE exists since kernel v2.6.38,
    ABS_MT_TOOL_X|Y appeared in v3.6.
    
    Signed-off-by: Benjamin Tissoires <benjamin.tissoires 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/Xi/xiproperty.c b/Xi/xiproperty.c
index 43351bc..796ba09 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -105,6 +105,9 @@ static struct dev_properties {
     {0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
     {0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
     {0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
+    {0, AXIS_LABEL_PROP_ABS_MT_DISTANCE},
+    {0, AXIS_LABEL_PROP_ABS_MT_TOOL_X},
+    {0, AXIS_LABEL_PROP_ABS_MT_TOOL_Y},
     {0, AXIS_LABEL_PROP_ABS_MISC},
     {0, BTN_LABEL_PROP},
     {0, BTN_LABEL_PROP_BTN_UNKNOWN},
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
index 85f2ce5..bf48fab 100644
--- a/include/xserver-properties.h
+++ b/include/xserver-properties.h
@@ -118,6 +118,9 @@
 #define AXIS_LABEL_PROP_ABS_MT_BLOB_ID     "Abs MT Blob ID"
 #define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
 #define AXIS_LABEL_PROP_ABS_MT_PRESSURE    "Abs MT Pressure"
+#define AXIS_LABEL_PROP_ABS_MT_DISTANCE    "Abs MT Distance"
+#define AXIS_LABEL_PROP_ABS_MT_TOOL_X      "Abs MT Tool X"
+#define AXIS_LABEL_PROP_ABS_MT_TOOL_Y      "Abs MT Tool Y"
 #define AXIS_LABEL_PROP_ABS_MISC        "Abs Misc"
 
 /* Button names */
commit ced56f322ead10d1bc93fcd1f8e0ec3ae51292a3
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Thu Oct 25 15:03:50 2012 +0200

    Sync TouchListener memory allocation with population in TouchSetupListeners()
    
    The allocated TouchListener array may fall short by 1 if hitting the worst case
    situation where there's an active grab, passive grabs on each window in the
    sprite trace and event selection for touch in one of the windows. This may lead
    to memory corruptions as the array is overflown.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/touch.c b/dix/touch.c
index e64a626..5f77be5 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
         return FALSE;
 
     /* Mark which grabs/event selections we're delivering to: max one grab per
-     * window plus the bottom-most event selection. */
-    ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
+     * window plus the bottom-most event selection, plus any active grab. */
+    ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
     if (!ti->listeners) {
         sprite->spriteTraceGood = 0;
         return FALSE;
commit 74a3130426d7e1b456e45daa517769cd3e4b58c0
Merge: 1ca096d f32ad6d
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Oct 29 09:09:16 2012 -0700

    Merge remote-tracking branch 'jturney/master'

commit 1ca096d5e07221025c4c4110528772b7d94f15ee
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Oct 29 12:57:54 2012 +0100

    EXA: Track source/mask pixmaps more explicitly for Composite fallback regions.
    
    In particular, make sure pExaScr->src/maskPix are cleared when the
    corresponding pictures aren't associated with drawables, i.e. solid or gradient
    pictures. Without this, we would in some cases associate the source/mask region
    with unrelated pixmaps from previous Composite fallbacks, resulting in random
    corruption.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47266
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 7007578..1f56056 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -208,6 +208,7 @@ typedef struct {
     RegionRec srcReg;
     RegionRec maskReg;
     PixmapPtr srcPix;
+    PixmapPtr maskPix;
 
     DevPrivateKeyRec pixmapPrivateKeyRec;
     DevPrivateKeyRec gcPrivateKeyRec;
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 5716138..b0a0011 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -442,6 +442,13 @@ ExaSrcValidate(DrawablePtr pDrawable,
     RegionPtr dst;
     int xoff, yoff;
 
+    if (pExaScr->srcPix == pPix)
+        dst = &pExaScr->srcReg;
+    else if (pExaScr->maskPix == pPix)
+        dst = &pExaScr->maskReg;
+    else
+        return;
+
     exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
 
     box.x1 = x + xoff;
@@ -449,8 +456,6 @@ ExaSrcValidate(DrawablePtr pDrawable,
     box.x2 = box.x1 + width;
     box.y2 = box.y1 + height;
 
-    dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : &pExaScr->maskReg;
-
     RegionInit(&reg, &box, 1);
     RegionUnion(dst, dst, &reg);
     RegionUninit(&reg);
@@ -495,16 +500,19 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
         if (pSrc != pDst)
             RegionTranslate(pSrc->pCompositeClip,
                             -pSrc->pDrawable->x, -pSrc->pDrawable->y);
-    }
+    } else
+        pExaScr->srcPix = NULL;
 
     if (pMask && pMask->pDrawable) {
         pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
         RegionNull(&pExaScr->maskReg);
         maskReg = &pExaScr->maskReg;
+        pExaScr->maskPix = pMaskPix;
         if (pMask != pDst && pMask != pSrc)
             RegionTranslate(pMask->pCompositeClip,
                             -pMask->pDrawable->x, -pMask->pDrawable->y);
-    }
+    } else
+        pExaScr->maskPix = NULL;
 
     RegionTranslate(pDst->pCompositeClip,
                     -pDst->pDrawable->x, -pDst->pDrawable->y);
commit f32ad6dd314a587c301b7f1a6e4ee74e5d8cc06c
Author: Ryan Pavlik <rpavlik at iastate.edu>
Date:   Fri Oct 21 12:32:49 2011 -0500

    os/utils.c: Provide only stubs for Lock/UnlockServer on WIN32
    
    MinGW and MSVC lack the POSIX functions to compile the lock file code.
    
    Signed-off-by: Ryan Pavlik <rpavlik at iastate.edu>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

diff --git a/os/utils.c b/os/utils.c
index 04bcbc6..3c520ad 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -235,6 +235,19 @@ OsSignal(int sig, OsSigHandlerPtr handler)
 #define LOCK_PREFIX "/.X"
 #define LOCK_SUFFIX "-lock"
 
+#if !defined(WIN32) || defined(__CYGWIN__)
+#define LOCK_SERVER
+#endif
+
+#ifndef LOCK_SERVER
+void
+LockServer(void)
+{}
+
+void
+UnlockServer(void)
+{}
+#else /* LOCK_SERVER */
 static Bool StillLocking = FALSE;
 static char LockFile[PATH_MAX];
 static Bool nolock = FALSE;
@@ -382,6 +395,7 @@ UnlockServer(void)
         (void) unlink(LockFile);
     }
 }
+#endif /* LOCK_SERVER */
 
 /* Force connections to close on SIGHUP from init */
 
@@ -503,7 +517,9 @@ UseMsg(void)
 #ifdef RLIMIT_STACK
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
+#ifdef LOCK_SERVER
     ErrorF("-nolock                disable the locking mechanism\n");
+#endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
     ErrorF("-background [none]     create root window with no background\n");
@@ -664,7 +680,9 @@ ProcessCommandLine(int argc, char *argv[])
             if (++i < argc) {
                 displayfd = atoi(argv[i]);
                 display = NULL;
+#ifdef LOCK_SERVER
                 nolock = TRUE;
+#endif
             }
             else
                 UseMsg();
@@ -744,6 +762,7 @@ ProcessCommandLine(int argc, char *argv[])
                 UseMsg();
         }
 #endif
+#ifdef LOCK_SERVER
         else if (strcmp(argv[i], "-nolock") == 0) {
 #if !defined(WIN32) && !defined(__CYGWIN__)
             if (getuid() != 0)
@@ -753,6 +772,7 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
                 nolock = TRUE;
         }
+#endif
         else if (strcmp(argv[i], "-nolisten") == 0) {
             if (++i < argc) {
                 if (_XSERVTransNoListen(argv[i]))
commit 74735c5ebff15db8891808068fe8569d8ccde9e7
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Sat Feb 18 20:37:19 2012 +0000

    hw/xwin: fmemopen is available on cygwin but not MinGW
    
    This is a follow-up to commit 0659437f5ec0e3f646373394f5f9c5461e2170f3.
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index dbc5b52..6cbd7ad 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -645,6 +645,7 @@ winPrefsLoadPreferences(char *path)
 
     if (path)
         prefFile = fopen(path, "r");
+#ifdef __CYGWIN__
     else {
         char defaultPrefs[] =
             "MENU rmenu {\n"
@@ -656,6 +657,7 @@ winPrefsLoadPreferences(char *path)
         path = "built-in default";
         prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
     }
+#endif
 
     if (!prefFile) {
         ErrorF("LoadPreferences: %s not found\n", path);
commit 748be9da20a8bf3dd99701a95eac7ee3895a28de
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue May 1 20:08:41 2012 +0100

    doc: Update documentation about Windows platforms support a bit
    
    Update what c-extensions says about Windows platforms support a bit:
    - Document that MinGW Win32 gets let off being POSIX-compilant
    - Document the minimum Windows version supported
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/doc/c-extensions b/doc/c-extensions
index eb33e27..4a90061 100644
--- a/doc/c-extensions
+++ b/doc/c-extensions
@@ -35,7 +35,7 @@ The server will not build if your toolchain does not support these extensions.
     * interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); }
 
 
-Use of OS and library facilities throughout the X server tree
+Use of library facilities throughout the X server tree
 -------------------------------------------------------------
 
 Non-OS-dependent code can assume facilities at least as good as
@@ -44,6 +44,17 @@ be C99, but even gcc+glibc doesn't implement that yet.
 
 Unix-like systems are assumed to be at least as good as UNIX03.
 
+Note that there are two Windows ports, Cygwin and MinGW:
+- Cygwin is more or less like Linux.
+- MinGW is more restrictive. Windows does not provide the required
+POSIX facilities, so some non-OS-dependent code is stubbed out or
+has an alternate implementation if WIN32 is defined.  Code that
+needs to be portable to Windows should be careful to, well, be portable.
+
+
+Required OS facilities
+-------------------------------------------------------------
+
 Linux systems must be at least 2.4 or later.  As a practical matter
 though, 2.4 kernels never receive any testing.  Use 2.6 already.
 
@@ -51,11 +62,7 @@ TODO: Solaris.
 
 TODO: *BSD.
 
-Code that needs to be portable to Windows should be careful to,
-well, be portable.  Note that there are two Windows ports, cygwin and
-mingw.  Cygwin is more or less like Linux, but mingw is a bit more
-restrictive.  TODO: document which versions of Windows we actually care
-about.
+Windows-dependent code assumes at least NT 5.1.
 
 OSX support is generally limited to the most recent version.  Currently
 that means 10.5.
commit 760be785eb49fed4652950fb55dc07b0a41d87de
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 24 11:20:54 2012 +1000

    xfree86: remove unused variable sigstate
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 3ad34b5..9dabf10 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -376,7 +376,7 @@ static void
 xf86ReleaseKeys(DeviceIntPtr pDev)
 {
     KeyClassPtr keyc;
-    int i, sigstate;
+    int i;
 
     if (!pDev || !pDev->key)
         return;
commit e7cd5cce740e653000fb1192b600268dcf77dde2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 18 15:11:31 2012 +1000

    dix: fix zaphod screen scrossing (#54654)
    
    POINTER_SCREEN coordinates are screen-relative. For a Zaphod setup, the
    coordinates after a screen crossing are already relative to the new screen's
    origin. Add that offset to the coordinates before re-setting.
    
    regression introduced by
    commit bafbd99080be49a17be97d2cc758fbe623369945
    Author: Peter Hutterer <peter.hutterer at who-t.net>
    Date:   Wed Aug 8 11:34:32 2012 +1000
    
        dix: work around scaling issues during WarpPointer (#53037)
    
    X.Org Bug 54654 <http://bugs.freedesktop.org/show_bug.cgi?id=54654>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 71d83c4..8b4379d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1400,8 +1400,9 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
        coordinates were.
      */
     if (flags & POINTER_SCREEN) {
-        screenx = sx;
-        screeny = sy;
+        scr = miPointerGetScreen(pDev);
+        screenx = sx + scr->x;
+        screeny = sy + scr->y;
     }
 
     scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
commit 676447190190d8546165e21be242cf16dd69f5ae
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 17 14:13:29 2012 +1000

    Xi: don't deliver TouchEnd to a client waiting for TouchBegin (#55738)
    
    If a client is still waiting for the TouchBegin, don't deliver a TouchEnd
    event.
    
    X.Org Bug 55738 <http://bugs.freedesktop.org/show_bug.cgi?id=55738>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Thomas Jaeger <thjaeger at gmail.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6ed4991..4cbeb37 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1862,6 +1862,11 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         goto out;
     }
 
+    if (listener->state == LISTENER_AWAITING_BEGIN) {
+        listener->state = LISTENER_HAS_END;
+        goto out;
+    }
+
     /* Event in response to reject */
     if (ev->device_event.flags & TOUCH_REJECT) {
         if (listener->state != LISTENER_HAS_END)
commit 3018f9c1e5109680dcf69b8f2d7807696a473bde
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Oct 12 13:48:27 2012 +1000

    Xi: set xChangeDeviceControlReply.status to Success by default
    
    If the status is other than Success, the code will set it to the required
    value.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 9fe69a5..7daf584 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -126,7 +126,8 @@ ProcXChangeDeviceControl(ClientPtr client)
         .repType = X_Reply,
         .RepType = X_ChangeDeviceControl,
         .sequenceNumber = client->sequence,
-        .length = 0
+        .length = 0,
+        .status = Success,
     };
 
     switch (stuff->control) {
commit 2decff6393a44b56d80d53570718f95354fde454
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 11 16:03:33 2012 +1000

    xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP
    
    For button release events, the current code picks the VCK. Because that has
    a XKB struct, it thinks this is a PointerKeys event and proceeds to send the
    release event through the XTest pointer. That has no effect in normal
    operation as the button is never down and an attempt is silently discarded
    (normal event processing continues with the VCP).
    
    On server shutdown, the XTest device is already removed, leading to a
    null-pointer derefernce when the device is checked for whether buttons are
    down (XkbFakeDeviceButton → button_is_down(xtest pointer)).
    
    The current state has only worked by accident, the right approach here is to
    handle the VCP's event as such and not switch to the keyboard.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 082c0db..c1af32e 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -709,7 +709,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
     DeviceEvent *event = &ev->device_event;
 
-    dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
+    dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
 
     if (dev && dev->key) {
         xkbi = dev->key->xkbInfo;
commit cc1d8fa8a4ef2e34e9837a44945094fd77e40a0b
Author: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Date:   Sun Oct 14 23:38:20 2012 -0500

    Configure fixes for MinGW
    
    As for Cygwin, define FD_SETSIZE for uses of select() to be correct.
    Link with libpthread.
    
    Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/configure.ac b/configure.ac
index b6ed92c..86153ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -420,7 +420,7 @@ case $host_os in
   darwin*)
 	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
 	;;
-  cygwin*)
+  cygwin*|mingw*)
 	CFLAGS="$CFLAGS -DFD_SETSIZE=256"
 	;;
 esac
@@ -1904,7 +1904,7 @@ if test "x$XWIN" = xyes; then
 			XWIN_SERVER_NAME=Xming
 			AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
 			AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
-			XWIN_SYS_LIBS=-lws2_32
+			XWIN_SYS_LIBS="-lpthread -lws2_32"
 			;;
 	esac
 
commit 53830281b4da096f9c13107d73ec9c76ff1d14cc
Merge: abc2ef5 9cbcb5b
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Oct 26 18:04:34 2012 -0700

    Merge remote-tracking branch 'sandmann/for-keithp'

commit abc2ef590c7cb33ebe21726f83b7347406975f95
Merge: 0e85e5e c5396ec
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Oct 26 17:11:58 2012 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Wed May 30 05:19:08 2012 -0400

    Use new pixman_glyph_cache_t API that will be in pixman 0.28.0
    
    This new API allows glyphs to be cached in a data structure in pixman,
    and entire glyph strings to be composited in one go.
    
    Also bump pixman dependency to 0.27.2.
    
    Results from the cairo peformance test suite running against Xvfb with
    a screen size of 1680x1050 at 32bpp:
    
    Speedups
    ========
     xlib          firefox-talos-gfx  12416.63 -> 3603.93   3.45x speedup
    ██▌
     xlib          xfce4-terminal-a1   1727.57 -> 1048.85:  1.65x speedup
    â–‹
     xlib                  evolution   1370.49 -> 869.34:   1.58x speedup
    â–‹
     xlib         gnome-terminal-vim   1832.83 -> 1251.94:  1.46x speedup
    ▌
     xlib                    poppler   1519.70 -> 1204.05:  1.26x speedup
    â–Ž
     xlib       firefox-planet-gnome   6982.55 -> 5598.16:  1.25x speedup
    â–Ž
     xlib                  ocitysmap   1142.77 -> 1071.53:  1.07x speedup
    ▏
    
    No slowdowns were reported.
    
    Results of x11perf -aa10text:
    
    Before:
    
          8000000 reps @   0.0007 msec (1450000.0/sec)
          8000000 reps @   0.0007 msec (1460000.0/sec)
          8000000 reps @   0.0007 msec (1460000.0/sec)
          8000000 reps @   0.0007 msec (1470000.0/sec)
          8000000 reps @   0.0007 msec (1480000.0/sec)
         40000000 trep @   0.0007 msec (1460000.0/sec)
    
    After:
    
         32000000 reps @   0.0002 msec (4910000.0/sec)
         32000000 reps @   0.0002 msec (4830000.0/sec)
         32000000 reps @   0.0002 msec (4890000.0/sec)
         32000000 reps @   0.0002 msec (4830000.0/sec)
         32000000 reps @   0.0002 msec (4900000.0/sec)
        160000000 trep @   0.0002 msec (4870000.0/sec)
    
    Version 2: Destroy the glyph cache at server regen time
    
    Acked-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/configure.ac b/configure.ac
index e686614..b6ed92c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -811,7 +811,7 @@ LIBPCIACCESS="pciaccess >= 0.12.901"
 LIBUDEV="libudev >= 143"
 LIBSELINUX="libselinux >= 2.0.86"
 LIBDBUS="dbus-1 >= 1.0"
-LIBPIXMAN="pixman-1 >= 0.21.8"
+LIBPIXMAN="pixman-1 >= 0.27.2"
 
 dnl Pixman is always required, but we separate it out so we can link
 dnl specific modules against it
diff --git a/fb/fb.h b/fb/fb.h
index 75596c5..b869d12 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1344,6 +1344,9 @@ extern _X_EXPORT void
 extern _X_EXPORT Bool
  fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
+extern _X_EXPORT void
+fbDestroyGlyphCache(void);
+
 /*
  * fbpixmap.c
  */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 097a1a6..2804ff4 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -70,6 +70,156 @@ fbComposite(CARD8 op,
     free_pixman_pict(pDst, dest);
 }
 
+static pixman_glyph_cache_t *glyphCache;
+
+void
+fbDestroyGlyphCache(void)
+{
+    if (glyphCache)
+    {
+	pixman_glyph_cache_destroy (glyphCache);
+	glyphCache = NULL;
+    }
+}
+
+static void
+fbUnrealizeGlyph(ScreenPtr pScreen,
+		 GlyphPtr pGlyph)
+{
+    if (glyphCache)
+	pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
+}
+
+static void
+fbGlyphs(CARD8 op,
+	 PicturePtr pSrc,
+	 PicturePtr pDst,
+	 PictFormatPtr maskFormat,
+	 INT16 xSrc,
+	 INT16 ySrc, int nlist,
+	 GlyphListPtr list,
+	 GlyphPtr *glyphs)
+{
+#define N_STACK_GLYPHS 512
+    ScreenPtr pScreen = pDst->pDrawable->pScreen;
+    pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
+    pixman_glyph_t *pglyphs = stack_glyphs;
+    pixman_image_t *srcImage, *dstImage;
+    int srcXoff, srcYoff, dstXoff, dstYoff;
+    GlyphPtr glyph;
+    int n_glyphs;
+    int x, y;
+    int i, n;
+    int xDst = list->xOff, yDst = list->yOff;
+
+    miCompositeSourceValidate(pSrc);
+    
+    n_glyphs = 0;
+    for (i = 0; i < nlist; ++i)
+	n_glyphs += list[i].len;
+
+    if (!glyphCache)
+	glyphCache = pixman_glyph_cache_create();
+
+    pixman_glyph_cache_freeze (glyphCache);
+    
+    if (n_glyphs > N_STACK_GLYPHS) {
+	if (!(pglyphs = malloc (n_glyphs * sizeof (pixman_glyph_t))))
+	    goto out;
+    }
+    
+    i = 0;
+    x = y = 0;
+    while (nlist--) {
+        x += list->xOff;
+        y += list->yOff;
+        n = list->len;
+        while (n--) {
+	    const void *g;
+
+            glyph = *glyphs++;
+
+	    if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
+		pixman_image_t *glyphImage;
+		PicturePtr pPicture;
+		int xoff, yoff;
+
+		pPicture = GetGlyphPicture(glyph, pScreen);
+		if (!pPicture) {
+		    n_glyphs--;
+		    goto next;
+		}
+
+		if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
+		    goto out;
+
+		g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
+					      glyph->info.x,
+					      glyph->info.y,
+					      glyphImage);
+
+		free_pixman_pict(pPicture, glyphImage);
+
+		if (!g)
+		    goto out;
+	    }
+
+	    pglyphs[i].x = x;
+	    pglyphs[i].y = y;
+	    pglyphs[i].glyph = g;
+	    i++;
+
+	next:
+            x += glyph->info.xOff;
+            y += glyph->info.yOff;
+	}
+	list++;
+    }
+
+    if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
+	goto out;
+
+    if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
+	goto out_free_src;
+
+    if (maskFormat) {
+	pixman_format_code_t format;
+	pixman_box32_t extents;
+	int x, y;
+
+	format = maskFormat->format | (maskFormat->depth << 24);
+
+	pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
+
+	x = extents.x1;
+	y = extents.y1;
+
+	pixman_composite_glyphs(op, srcImage, dstImage, format,
+				xSrc + srcXoff + xDst, ySrc + srcYoff + yDst,
+				x, y,
+				x + dstXoff, y + dstYoff,
+				extents.x2 - extents.x1,
+				extents.y2 - extents.y1,
+				glyphCache, n_glyphs, pglyphs);
+    }
+    else {
+	pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
+					xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
+					dstXoff, dstYoff,
+					glyphCache, n_glyphs, pglyphs);
+    }
+
+    free_pixman_pict(pDst, dstImage);
+
+out_free_src:
+    free_pixman_pict(pSrc, srcImage);
+
+out:
+    pixman_glyph_cache_thaw(glyphCache);
+    if (pglyphs != stack_glyphs)
+	free(pglyphs);
+}
+
 static pixman_image_t *
 create_solid_fill_image(PicturePtr pict)
 {
@@ -357,7 +507,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
         return FALSE;
     ps = GetPictureScreen(pScreen);
     ps->Composite = fbComposite;
-    ps->Glyphs = miGlyphs;
+    ps->Glyphs = fbGlyphs;
+    ps->UnrealizeGlyph = fbUnrealizeGlyph;
     ps->CompositeRects = miCompositeRects;
     ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
     ps->Trapezoids = fbTrapezoids;
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 7c7d656..f9080a4 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -32,6 +32,7 @@ fbCloseScreen(ScreenPtr pScreen)
     int d;
     DepthPtr depths = pScreen->allowedDepths;
 
+    fbDestroyGlyphCache();
     for (d = 0; d < pScreen->numDepths; d++)
         free(depths[d].vids);
     free(depths);
commit c5396ec05a5c6cab6608ba677f703c5227b1de13
Author: Thierry Reding <thierry.reding at avionic-design.de>
Date:   Wed Oct 17 12:11:49 2012 +0200

    xf86: Fix build against recent Linux kernel
    
    Recent Linux kernels reworked the linux/input.h header file, which is
    now part of the "user-space API". The include guard therefore has an
    additional additional _UAPI prefix.
    
    Instead of adding another case to the #ifdef, drop any include guard
    checks and instead always undefine the BUS_* definitions on Linux.
    
    Signed-off-by: Thierry Reding <thierry.reding at avionic-design.de>
    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/xf86str.h b/hw/xfree86/common/xf86str.h
index 0590262..4c2d147 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -347,7 +347,7 @@ typedef struct _DriverRec {
  */
 
 /* Tolerate prior #include <linux/input.h> */
-#if defined(linux) && defined(_INPUT_H)
+#if defined(linux)
 #undef BUS_NONE
 #undef BUS_PCI
 #undef BUS_SBUS
commit 7d89eb4978a6649be22747c3de2886781e311647
Author: Colin Walters <walters at verbum.org>
Date:   Wed Jan 4 17:37:06 2012 -0500

    autogen.sh: Honor NOCONFIGURE=1
    
    (Also while we have the patient open, use exec instead of hanging
     around uselessly in waitpid)
    
    http://people.gnome.org/~walters/docs/build-api.txt
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Colin Walters <walters at verbum.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/autogen.sh b/autogen.sh
index 8b6f58f..dd0731a 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,4 +9,6 @@ cd $srcdir
 autoreconf --force -v --install || exit 1
 cd $ORIGDIR || exit $?
 
-$srcdir/configure "$@"
+if test -z "$NOCONFIGURE"; then
+    exec $srcdir/configure "$@"
+fi
commit c0a752d2864872023216005375a6a1973fadeffe
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Oct 9 03:17:49 2012 +0200

    dix: fix Ungrab action #55785
    
    UngrabAllDevices(Bool kill_client):
    If we are not going to kill the client (kill_clients false),
    we need to deactivate grabs of active clients, too.
    (If we are going to kill the client,
     no need to deactivate the grab,
     as this will be done as part of the client kill.)
    
    Fixes: X.Org Bug 55785 <http://bugs.freedesktop.org/show_bug.cgi?id=55785>
    
    Signed-off-by: Lionel Elie Mamane <lionel at mamane.lu>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/grabs.c b/dix/grabs.c
index 55bf64f..fe79674 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -179,7 +179,7 @@ UngrabAllDevices(Bool kill_client)
             continue;
         PrintDeviceGrabInfo(dev);
         client = clients[CLIENT_ID(dev->deviceGrab.grab->resource)];
-        if (!client || client->clientGone)
+        if (!kill_client || !client || client->clientGone)
             dev->deviceGrab.DeactivateGrab(dev);
         if (kill_client)
             CloseDownClient(client);
commit 3b67cd26149eb991b5f015061a818af65369e668
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Thu Jun 7 14:12:06 2012 -0700

    End physically active touches when device is disabled
    
    Otherwise:
    
    * We can't end the touches while device is disabled
    * New touches after enabling the device may erroneously be mapped to old
      logical touches
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.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/dix/devices.c b/dix/devices.c
index 66d4406..fd4916a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -443,6 +443,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
     if (*prev != dev)
         return FALSE;
 
+    TouchEndPhysicallyActiveTouches(dev);
     ReleaseButtonsAndKeys(dev);
     SyncRemoveDeviceIdleTime(dev->idle_counter);
     dev->idle_counter = NULL;
diff --git a/dix/touch.c b/dix/touch.c
index 497ad7d..e64a626 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -1029,3 +1029,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
 
     return TouchListenerAcceptReject(dev, ti, i, mode);
 }
+
+/**
+ * End physically active touches for a device.
+ */
+void
+TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+    InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+    int i;
+
+    OsBlockSignals();
+    mieqProcessInputEvents();
+    for (i = 0; i < dev->last.num_touches; i++) {
+        DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
+
+        if (ddxti->active) {
+            int j;
+            int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
+                                         XI_TouchEnd, 0, NULL);
+
+            for (j = 0; j < nevents; j++)
+                mieqProcessDeviceEvent(dev, eventlist + j, NULL);
+        }
+    }
+    OsReleaseSignals();
+
+    FreeEventList(eventlist, GetMaximumEventsNum());
+}
diff --git a/include/input.h b/include/input.h
index 5747f3c..f8459b8 100644
--- a/include/input.h
+++ b/include/input.h
@@ -579,6 +579,7 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                      int listener, int mode);
 extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
                              uint32_t touchid, Window grab_window, XID *error);
+extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
 
 /* misc event helpers */
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);
commit 0e85e5e62819c9e516d6e19836f9f5d7a5d53e87
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Thu Oct 11 18:05:47 2012 +0100

    hw/xwin: Fix no return value warning in winClipboardProc()
    
    winclipboardthread.c: In function ‘winClipboardProc’:
    winclipboardthread.c:415:9: warning: ‘return’ with no value, in function returning non-void
    winclipboardthread.c:424:13: warning: ‘return’ with no value, in function returning non-void
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index 4479b54..8912782 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -412,7 +412,7 @@ winClipboardProc(void *pvNotUsed)
             ("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n",
              clipboardRestarts);
         g_fClipboard = FALSE;
-        return;
+        return NULL;
     }
 
     if (g_fClipboard) {
@@ -421,7 +421,7 @@ winClipboardProc(void *pvNotUsed)
         /* Create the clipboard client thread */
         if (!winInitClipboard()) {
             ErrorF("winClipboardProc - winClipboardInit failed.\n");
-            return;
+            return NULL;
         }
 
         winDebug("winClipboardProc - winInitClipboard returned.\n");
commit 51ed6a7d46c6cc19eb9aaf838be41eb57fd8230a
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Thu Oct 11 17:57:37 2012 +0100

    hw/xwin: Remove unused variable in winmultiwindowwm.c
    
    winmultiwindowwm.c: In function ‘UpdateName’:
    winmultiwindowwm.c:522:14: warning: unused variable ‘pszName’ [-Wunused-variable]
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 8d55e01..ac9d579 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -519,7 +519,6 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
 static void
 UpdateName(WMInfoPtr pWMInfo, Window iWindow)
 {
-    wchar_t *pszName;
     HWND hWnd;
     XWindowAttributes attr;
 
commit 5886b1dc4d2ce12a238a2e3600fdb576abc6e419
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Thu Oct 11 17:56:11 2012 +0100

    hw/xwin: Remove unused variables in winwindow.c
    
    winwindow.c: In function ‘winCreateWindowNativeGDI’:
    winwindow.c:62:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    winwindow.c: In function ‘winDestroyWindowNativeGDI’:
    winwindow.c:85:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    winwindow.c: In function ‘winPositionWindowNativeGDI’:
    winwindow.c:108:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    winwindow.c: In function ‘winChangeWindowAttributesNativeGDI’:
    winwindow.c:213:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    winwindow.c: In function ‘winUnmapWindowNativeGDI’:
    winwindow.c:241:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    winwindow.c: In function ‘winMapWindowNativeGDI’:
    winwindow.c:265:19: warning: unused variable ‘pWinPriv’ [-Wunused-variable]
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index 5947917..ab6d8de 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -59,7 +59,6 @@ winCreateWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -82,7 +81,6 @@ winDestroyWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -105,7 +103,6 @@ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -210,7 +207,6 @@ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -238,7 +234,6 @@ winUnmapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -262,7 +257,6 @@ winMapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
commit 08b33882f34fed0c23d54ff7361efc5833868a4b
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Thu Oct 11 17:52:11 2012 +0100

    hw/xwin: Remove unused variables in winvalargs.c
    
    winvalargs.c: In function ‘winValidateArgs’:
    winvalargs.c:62:10: warning: unused variable ‘fImplicitScreenFound’ [-Wunused-variable]
    winvalargs.c:60:9: warning: unused variable ‘iMaxConsecutiveScreen’ [-Wunused-variable]
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c
index eb6e973..edfd71f 100644
--- a/hw/xwin/winvalargs.c
+++ b/hw/xwin/winvalargs.c
@@ -57,9 +57,7 @@ Bool
 winValidateArgs(void)
 {
     int i;
-    int iMaxConsecutiveScreen = 0;
     BOOL fHasNormalScreen0 = FALSE;
-    BOOL fImplicitScreenFound = FALSE;
 
     /*
      * Check for a malformed set of -screen parameters.
commit 7e665f1a21468118dababdbf6d8573f1ce1ebd47
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Thu Oct 11 17:50:42 2012 +0100

    hw/xwin: Remove unused variables in winwindowswm.c
    
    winwindowswm.c: In function ‘ProcWindowsWMQueryVersion’:
    winwindowswm.c:85:9: warning: unused variable ‘n’ [-Wunused-variable]
    winwindowswm.c: In function ‘SProcWindowsWMQueryVersion’:
    winwindowswm.c:565:9: warning: unused variable ‘n’ [-Wunused-variable]
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 01ae088..fbd41aa 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -82,7 +82,6 @@ static int
 ProcWindowsWMQueryVersion(ClientPtr client)
 {
     xWindowsWMQueryVersionReply rep;
-    int n;
 
     REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
     rep.type = X_Reply;
@@ -562,8 +561,6 @@ SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
 static int
 SProcWindowsWMQueryVersion(ClientPtr client)
 {
-    int n;
-
     REQUEST(xWindowsWMQueryVersionReq);
     swaps(&stuff->length);
     return ProcWindowsWMQueryVersion(client);
commit e893d570aa3e9ae8df6a30ac4adaf0949a2fc733
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 19:36:13 2012 +0100

    Use X_ATTRIBUTE_PRINTF where suggested for os.h
    
    InitOutput.c: In function ‘OsVendorInit’:
    InitOutput.c:630:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wmissing-format-attribute]
    winprocarg.c: In function ‘ddxProcessArgument’:
    winprocarg.c:231:29: warning: assignment left-hand side might be a candidate for a format attribute [-Wmissing-format-attribute]
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/include/os.h b/include/os.h
index e324216..c7108a5 100644
--- a/include/os.h
+++ b/include/os.h
@@ -88,7 +88,9 @@ extern void ddxBeforeReset(void);
 #endif
 
 #ifdef DDXOSVERRORF
-extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args);
+extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *,
+                                              va_list args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 #endif
 
 extern _X_EXPORT int WaitForSomething(int *     /*pClientsReady */
commit e59cc83bcdca6b64c1bfb2de395d741757f615f6
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 19:35:19 2012 +0100

    hw/xwin: Use X_ATTRIBUTE_PRINTF where suggested for winmsg.c
    
    winmsg.c: In function ‘winVMsg’:
    winmsg.c:47:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winDrvMsg’:
    winmsg.c:56:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winMsg’:
    winmsg.c:66:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winDrvMsgVerb’:
    winmsg.c:77:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winMsgVerb’:
    winmsg.c:87:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winErrorFVerb’:
    winmsg.c:97:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winDebug’:
    winmsg.c:107:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winmsg.c: In function ‘winTrace’:
    winmsg.c:117:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    
    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/winmsg.c b/hw/xwin/winmsg.c
index 07c2f30..57c1d18 100644
--- a/hw/xwin/winmsg.c
+++ b/hw/xwin/winmsg.c
@@ -38,7 +38,9 @@
 #endif
 #include <stdarg.h>
 
-void winVMsg(int, MessageType, int verb, const char *, va_list);
+void
+winVMsg(int, MessageType, int verb, const char *, va_list)
+_X_ATTRIBUTE_PRINTF(4, 0);
 
 void
 winVMsg(int scrnIndex, MessageType type, int verb, const char *format,
diff --git a/hw/xwin/winmsg.h b/hw/xwin/winmsg.h
index ec285ba..b638f2c 100644
--- a/hw/xwin/winmsg.h
+++ b/hw/xwin/winmsg.h
@@ -34,15 +34,29 @@
  * Function prototypes
  */
 
-void winDrvMsgVerb(int scrnIndex,
-                   MessageType type, int verb, const char *format, ...);
-void winDrvMsg(int scrnIndex, MessageType type, const char *format, ...);
-void winMsgVerb(MessageType type, int verb, const char *format, ...);
-void winMsg(MessageType type, const char *format, ...);
-void winDebug(const char *format, ...);
-void winTrace(const char *format, ...);
+void
+winDrvMsgVerb(int scrnIndex,
+              MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(4, 5);
+void
+winDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsgVerb(MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsg(MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+void
+winDebug(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+winTrace(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
 
-void winErrorFVerb(int verb, const char *format, ...);
+void
+winErrorFVerb(int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
 void winW32Error(int verb, const char *message);
 void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
 void winDebugWin32Message(const char *function, HWND hwnd, UINT message,
commit 3d6e6a394ea2d5dcb77aa706f751423315d8a7ed
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 19:32:24 2012 +0100

    hw/xwin: Use X_ATTRIBUTE_PRINTF where suggested for winerror.c
    
    Also, fix the typoed name OsVenderVErrorF (sic), so it actually gets prototyped
    and remove redundant declarations of it's prototype.
    
    winerror.c: In function ‘OsVendorVErrorF’:
    winerror.c:56:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    winerror.c: In function ‘winMessageBoxF’:
    winerror.c:104:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
    
    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 14ce852..4bcd3a0 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -77,11 +77,6 @@ static void
  winClipboardShutdown(void);
 #endif
 
-#if defined(DDXOSVERRORF)
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 static Bool
  winCheckDisplayNumber(void);
 
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index e632c79..7b34e84 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -857,11 +857,13 @@ void
 
 #ifdef DDXOSVERRORF
 void
- OSVenderVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF(const char *pszFormat, va_list va_args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 #endif
 
 void
- winMessageBoxF(const char *pszError, UINT uType, ...);
+winMessageBoxF(const char *pszError, UINT uType, ...)
+_X_ATTRIBUTE_PRINTF(1, 3);
 
 #ifdef XWIN_NATIVEGDI
 /*
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 56c1e34..6645469 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -36,10 +36,6 @@
 #include "win.h"
 
 #ifdef DDXOSVERRORF
-/* Prototype */
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-
 void
 OsVendorVErrorF(const char *pszFormat, va_list va_args)
 {
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index a5b3c07..14056fa 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -56,10 +56,6 @@ void
 void
  winLogVersionInfo(void);
 
-#ifdef DDXOSVERRORF
-void OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 /*
  * Process arguments on the command line
  */
commit 13fb6b36b8742a79b9768944eee6d1ad66d7e4d9
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 16:20:35 2012 +0100

    hw/xwin: Use char strings in winClipboardUNIXtoDOS for consistency with the rest of the clipboard code
    
    winclipboardxevents.c: In function ‘winClipboardFlushXEvents’:
    winclipboardxevents.c:575:13: warning: passing argument 1 of ‘winClipboardUNIXtoDOS’ from incompatible pointer type
    winclipboard.h:102:2: note: expected ‘unsigned char **’ but argument is of type ‘char **’
    
    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/winclipboard.h b/hw/xwin/winclipboard.h
index 40da551..2cd775d 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -99,7 +99,7 @@ void
  winClipboardDOStoUNIX(char *pszData, int iLength);
 
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * winclipboardthread.c
diff --git a/hw/xwin/winclipboardtextconv.c b/hw/xwin/winclipboardtextconv.c
index 74a351b..fd405a0 100644
--- a/hw/xwin/winclipboardtextconv.c
+++ b/hw/xwin/winclipboardtextconv.c
@@ -38,7 +38,7 @@
 void
  winClipboardDOStoUNIX(char *pszSrc, int iLength);
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * Convert \r\n to \n
@@ -75,12 +75,12 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength)
  */
 
 void
-winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS(char **ppszData, int iLength)
 {
     int iNewlineCount = 0;
-    unsigned char *pszSrc = *ppszData;
-    unsigned char *pszEnd = pszSrc + iLength;
-    unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+    char *pszSrc = *ppszData;
+    char *pszEnd = pszSrc + iLength;
+    char *pszDest = NULL, *pszDestBegin = NULL;
 
     winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
 
commit fa36a7cd488e4f7fb91beed8a87764b8e0c1a72f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 15:51:39 2012 +0100

    hw/xwin: Fix warning about discarding const in initializing winKBLayouts
    
    winlayouts.h:46:5: warning: initialization discards qualifiers from pointer target type
    winlayouts.h:46:5: warning: initialization discards qualifiers from pointer target type
    winlayouts.h:46:5: warning: initialization discards qualifiers from pointer target type
    [repeated for each layout]
    
    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/winlayouts.h b/hw/xwin/winlayouts.h
index d8875ce..8b6b984 100644
--- a/hw/xwin/winlayouts.h
+++ b/hw/xwin/winlayouts.h
@@ -30,11 +30,11 @@
 typedef struct {
     unsigned int winlayout;
     int winkbtype;
-    char *xkbmodel;
-    char *xkblayout;
-    char *xkbvariant;
-    char *xkboptions;
-    char *layoutname;
+    const char *xkbmodel;
+    const char *xkblayout;
+    const char *xkbvariant;
+    const char *xkboptions;
+    const char *layoutname;
 } WinKBLayoutRec, *WinKBLayoutPtr;
 
 /*
commit 0ea65df8a5f97a6fe5225226493aa01380080d2f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Sep 27 17:23:43 2012 +0100

    hw/xwin: Fix some of the warnings in generated gl wrapper code
    
    Fix some of the warnings in generated gl wrapper code:
    - glWinResolveHelper takes a const char * argument
    - ensure formal parameter names don't collide with reserved names or shadow
    global declarations (e.g. near, far, index (from string.h), remainder (from
    math.h), pointer (from Xdefs.h) by postpending a '_'.
    
    generated_gl_wrappers.c:13:3: warning: passing argument 2 of 'glWinResolveHelper' discards qualifiers from pointer target type
    glwrap.c:70:1: note: expected 'char *' but argument is of type 'const char *'
    [repeated many times]
    generated_gl_wrappers.c: In function 'glVertexAttrib1dARBWrapper': generated_gl_wrappers.c:6884:47: warning: declaration of 'index' shadows a global declaration [-Wshadow]
    generated_gl_wrappers.c:6886:3: warning: passing argument 2 of 'glWinResolveHelper' discards qualifiers from pointer target type
    [repeated many times]
    
    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/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py
index 15f7ef8..2273589 100755
--- a/hw/xwin/glx/gen_gl_wrappers.py
+++ b/hw/xwin/glx/gen_gl_wrappers.py
@@ -146,9 +146,8 @@ for line in glspec :
                         arglist_use = m1.group(2)
                         wrappers[function] = {}
 
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        arglist_use = arglist_use.replace('near','zNear')
-                        arglist_use = arglist_use.replace('far','zFar')
+                        # ensure formal parameter names don't collide with reserved names or shadow global declarations
+                        arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")])
 
                         wrappers[function]['arglist_use'] = arglist_use
                         param_count = 0
@@ -217,9 +216,8 @@ for w in sorted(wrappers.keys()) :
                 if k.startswith('param') :
                         l = wrappers[w][k].split()
 
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        l[0] = l[0].replace('near','zNear')
-                        l[0] = l[0].replace('far','zFar')
+                        # ensure formal parameter names don't collide with reserved names or shadow global declarations
+                        l[0] = l[0] + '_'
 
                         if l[2] == 'in' :
                                 if l[3] == 'array' :
diff --git a/hw/xwin/glx/glwrap.c b/hw/xwin/glx/glwrap.c
index 690b829..73cff3c 100644
--- a/hw/xwin/glx/glwrap.c
+++ b/hw/xwin/glx/glwrap.c
@@ -67,7 +67,7 @@ glWinCallDelta(void)
 }
 
 static PROC
-glWinResolveHelper(PROC * cache, char *symbol)
+glWinResolveHelper(PROC * cache, const char *symbol)
 {
     PROC proc = NULL;
 
commit f7f0739311927ad177dece7119272481b75b73b4
Author: Colin Harrison <colin.harrison at virgin.net>
Date:   Tue Oct 19 23:42:53 2010 +0100

    hw/xwin: Warning fix in ProcWindowsWMFrameSetTitle()
    
    winwindowswm.c: In function ‘ProcWindowsWMFrameSetTitle’:
    winwindowswm.c:514: error: pointer targets in passing argument 2 of ‘strncpy’ differ in signedness
    
    If you're going to stick random casts into your code, at least use the goddammed
    right ones. :-)
    
    Signed-off-by: Colin Harrison <colin.harrison at virgin.net>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 88c3757..01ae088 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -491,7 +491,7 @@ ProcWindowsWMFrameSetTitle(ClientPtr client)
 #endif
 
     title_bytes = malloc(title_length + 1);
-    strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
+    strncpy(title_bytes, (char *) &stuff[1], title_length);
     title_bytes[title_length] = '\0';
 
     pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
commit 97c9ed026a7f7efe5fca02c188bcbdbcd7c594e9
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 19:01:55 2012 +0000

    hw/xwin: Fix shadowed local variable i in HandleCustomWM_COMMAND()
    
    Fix shadowed local variable i in HandleCustomWM_COMMAND()
    
    Also, fds are meant to be representable as an int
    
    winprefs.c: In function ‘HandleCustomWM_COMMAND’:
    winprefs.c:346:23: error: declaration of ‘i’ shadows a previous local
    winprefs.c:322:7: error: shadowed declaration is here
    
    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/winprefs.c b/hw/xwin/winprefs.c
index 5d2512e..dbc5b52 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -327,12 +327,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
                 case CMD_EXEC:
                     if (fork() == 0) {
                         struct rlimit rl;
-                        unsigned long i;
+                        int fd;
 
                         /* Close any open descriptors except for STD* */
                         getrlimit(RLIMIT_NOFILE, &rl);
-                        for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
-                            close(i);
+                        for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
+                            close(fd);
 
                         /* Disassociate any TTYs */
                         setsid();
commit b55d0b92fc536793a877f6073754801a7c3c2dd5
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 18:56:22 2012 +0000

    hw/xwin: Fix shadowed local variables in winLoadCursor()
    
    Move shadowed local variables x and y to the places they are used
    
    wincursor.c: In function ‘winLoadCursor’:
    wincursor.c:212:11: error: declaration of ‘x’ shadows a previous local
    wincursor.c:166:7: error: shadowed declaration is here
    wincursor.c:212:14: error: declaration of ‘y’ shadows a previous local
    wincursor.c:166:10: error: shadowed declaration is here
    wincursor.c:228:11: error: declaration of ‘x’ shadows a previous local
    wincursor.c:166:7: error: shadowed declaration is here
    wincursor.c:228:14: error: declaration of ‘y’ shadows a previous local
    wincursor.c:166:10: error: shadowed declaration is here
    
    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 b56104f..b5ea0db 100644
--- a/hw/xwin/wincursor.c
+++ b/hw/xwin/wincursor.c
@@ -158,7 +158,6 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
     HBITMAP hAnd, hXor;
     ICONINFO ii;
     unsigned char *pCur;
-    int x, y;
     unsigned char bit;
     HDC hDC;
     BITMAPV4HEADER bi;
@@ -262,6 +261,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
                                      sizeof(unsigned long));
 
         if (lpBits) {
+            int y;
             for (y = 0; y < nCY; y++) {
                 unsigned long *src, *dst;
 
@@ -305,6 +305,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
 
         pCur = (unsigned char *) lpBits;
         if (lpBits) {
+	    int x, y;
             for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) {
                 for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) {
                     if (x >= nCX || y >= nCY)   /* Outside of X11 icon bounds */
commit a8c9c3699e6dfde29eeec058d903740a499dcf3b
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct 11 19:11:36 2012 +0100

    hw/xwin/glx: Fix using Mask as a formal parameter shadows a global typedef of the same name
    
    Fix using Mask as a formal parameter shadows the typedef of the same name from X.h
    
    indirect.c: In function 'GetShift':
    indirect.c:1629:14: warning: declaration of 'Mask' shadows a global declaration [-Wshadow]
    
    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/glx/indirect.c b/hw/xwin/glx/indirect.c
index 97b6045..c0069a2 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -1626,15 +1626,15 @@ glxWinCreateContext(__GLXscreen * screen,
  */
 
 static int
-GetShift(int Mask)
+GetShift(int mask)
 {
-    int Shift = 0;
+    int shift = 0;
 
-    while ((Mask &1) == 0) {
-        Shift++;
-        Mask >>=1;
+    while ((mask &1) == 0) {
+        shift++;
+        mask >>=1;
     }
-    return Shift;
+    return shift;
 }
 
 static int
commit 47df98c7851fd9e97a54f0b4950340506d4a9244
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 19:17:16 2012 +0000

    hw/xwin: Fix using screenInfo as a formal parameter to InitOutput() shadows a global declaration
    
    Using screenInfo as a formal parameter to InitOutput() shadows a global declaration of screenInfo.
    Change the formal parameter name from screenInfo to pScreenInfo, as everywhere else uses.
    
    InitOutput.c: In function ‘InitOutput’:
    InitOutput.c:891:25: error: declaration of ‘screenInfo’ shadows a global declaration
    ../../include/scrnintstr.h:570:19: error: shadowed declaration is here
    
    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 23b53cf..14ce852 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -897,7 +897,7 @@ ddxUseMsg(void)
  */
 
 void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
 {
     int i;
 
@@ -940,15 +940,15 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
     LoadPreferences();
 
     /* Setup global screen info parameters */
-    screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
-    screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
-    screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
-    screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-    screenInfo->numPixmapFormats = NUMFORMATS;
+    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+    pScreenInfo->numPixmapFormats = NUMFORMATS;
 
     /* Describe how we want common pixmap formats padded */
     for (i = 0; i < NUMFORMATS; i++) {
-        screenInfo->formats[i] = g_PixmapFormats[i];
+        pScreenInfo->formats[i] = g_PixmapFormats[i];
     }
 
     /* Load pointers to DirectDraw functions */
commit 97e9c34687f7dc05ee0bdef097a19e7623fb59a3
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 19:07:49 2012 +0000

    hw/xwin: Fix using menu as a formal parameter shadows a global variable of the same name
    
    Using menu as a formal parameter shadows a global variable of the same name
    
    winprefsyacc.y: In function ‘SetRootMenu’:
    winprefsyacc.y:286:20: error: declaration of ‘menu’ shadows a global declaration
    winprefsyacc.y:55:19: error: shadowed declaration is here
    winprefsyacc.y: In function ‘SetDefaultSysMenu’:
    winprefsyacc.y:293:26: error: declaration of ‘menu’ shadows a global declaration
    winprefsyacc.y:55:19: error: shadowed declaration is here
    
    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/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 19c2f40..3b376b3 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -283,16 +283,16 @@ SetTrayIcon (char *fname)
 }
 
 static void
-SetRootMenu (char *menu)
+SetRootMenu (char *menuname)
 {
-  strncpy (pref.rootMenuName, menu, MENU_MAX);
+  strncpy (pref.rootMenuName, menuname, MENU_MAX);
   pref.rootMenuName[MENU_MAX] = 0;
 }
 
 static void
-SetDefaultSysMenu (char *menu, int pos)
+SetDefaultSysMenu (char *menuname, int pos)
 {
-  strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
+  strncpy (pref.defaultSysMenuName, menuname, MENU_MAX);
   pref.defaultSysMenuName[MENU_MAX] = 0;
   pref.defaultSysMenuPos = pos;
 }
commit efe96a17bd741f222ccb226d306b5c1dc1f25ade
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 18:54:57 2012 +0000

    hw/xwin: Fix using index as a formal parameter shadows index()
    
    Using index as a formal parameter shadows index() from strings.h
    
    winallpriv.c: In function ‘winInitCmapPrivates’:
    winallpriv.c:119:45: error: declaration of ‘index’ shadows a global declaration
    
    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/winallpriv.c b/hw/xwin/winallpriv.c
index ea3126f..cc3b3d1 100644
--- a/hw/xwin/winallpriv.c
+++ b/hw/xwin/winallpriv.c
@@ -110,7 +110,7 @@ winAllocatePrivates(ScreenPtr pScreen)
  */
 
 Bool
-winInitCmapPrivates(ColormapPtr pcmap, int index)
+winInitCmapPrivates(ColormapPtr pcmap, int i)
 {
 #if CYGDEBUG
     winDebug("winInitCmapPrivates\n");
commit 451c5d9175cdeb36fd614502ff0317f968490dfc
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 19:09:12 2012 +0000

    hw/xwin: Fix using index as a formal parameter in winscrinit.c shadows index()
    
    Using index as a local variable shadows index() from strings.h
    
    winscrinit.c: In function ‘winFinishScreenInitFB’:
    winscrinit.c:274:28: error: declaration of ‘index’ shadows a global declaration
    winscrinit.c: In function ‘winFinishScreenInitNativeGDI’:
    winscrinit.c:623:35: error: declaration of ‘index’ shadows a global declaration
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index be25f12..639a99c 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -254,7 +254,7 @@ winCreateScreenResources(ScreenPtr pScreen)
 
 /* See Porting Layer Definition - p. 20 */
 Bool
-winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
+winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
@@ -578,11 +578,11 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
 /* See Porting Layer Definition - p. 20 */
 
 Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI(int i,
                              ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
-    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
     VisualPtr pVisuals = NULL;
     DepthPtr pDepths = NULL;
     VisualID rootVisual = 0;
commit 21faee4b383a12bef58f300b4ad1a3bd34d6de2d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 19:05:42 2012 +0000

    hw/xwin: Fix using index as a local variable shadows index()
    
    Using index as a local variable shadows index() from strings.h
    
    winprefs.c: In function ‘LoadImageComma’:
    winprefs.c:574:7: error: declaration of ‘index’ shadows a global declaration
    
    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/winprefs.c b/hw/xwin/winprefs.c
index 52d1bc1..5d2512e 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -535,21 +535,21 @@ static HICON
 LoadImageComma(char *fname, int sx, int sy, int flags)
 {
     HICON hicon;
-    int index;
+    int i;
     char file[PATH_MAX + NAME_MAX + 2];
 
     /* Some input error checking */
     if (!fname || !fname[0])
         return NULL;
 
-    index = 0;
+    i = 0;
     hicon = NULL;
 
     if (fname[0] == ',') {
         /* It's the XWIN.EXE resource they want */
-        index = atoi(fname + 1);
+        i = atoi(fname + 1);
         hicon = LoadImage(g_hInstance,
-                          MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
+                          MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags);
     }
     else {
         file[0] = 0;
@@ -566,8 +566,8 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
             /* Specified as <fname>,<index> */
 
             *(strrchr(file, ',')) = 0;  /* End string at comma */
-            index = atoi(strrchr(fname, ',') + 1);
-            hicon = ExtractIcon(g_hInstance, file, index);
+            i = atoi(strrchr(fname, ',') + 1);
+            hicon = ExtractIcon(g_hInstance, file, i);
         }
         else {
             /* Just an .ico file... */
commit 2d9123fd0c89c1a72e7281e56985196bc53507bf
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 18:59:21 2012 +0000

    hw/xwin: Fix using index as a formal parameter in winmonitors.c shadows index()
    
    Fix using index as a local variable shadows global declaration of index() from strings.h
    
    winmonitors.c: In function ‘QueryMonitor’:
    winmonitors.c:59:23: error: declaration of ‘index’ shadows a global declaration
    
    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/winmonitors.c b/hw/xwin/winmonitors.c
index 76063d3..955fb92 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -59,13 +59,13 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
 }
 
 Bool
-QueryMonitor(int index, struct GetMonitorInfoData *data)
+QueryMonitor(int i, struct GetMonitorInfoData *data)
 {
     /* prepare data */
     if (data == NULL)
         return FALSE;
     memset(data, 0, sizeof(*data));
-    data->requestedMonitor = index;
+    data->requestedMonitor = i;
 
     /* query information */
     EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
commit 5b0435dbdaa47404629800e4e9c5a6952a7bb260
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 18:53:02 2012 +0000

    hw/xwin: Fix using system as a local variable in winCheckMount() shadows system()
    
    Using system as local variable in winCheckMount() shadows the global declaration of system() from stdlib.h
    
    InitOutput.c: In function ‘winCheckMount’:
    InitOutput.c:296:10: error: declaration of ‘system’ shadows a global declaration
    
    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 1cf0f02..23b53cf 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -299,11 +299,11 @@ winCheckMount(void)
     }
 
     while ((ent = getmntent(mnt)) != NULL) {
-        BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+        BOOL sys = (winCheckMntOpt(ent, "user") != NULL);
         BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
         BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
 
-        if (system) {
+        if (sys) {
             if (root)
                 curlevel = sys_root;
             else if (tmp)
commit 17d84c743d6b52f32c4ca0341aebaff972522945
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 17:18:12 2012 +0000

    hw/xwin: Remove obsolete redundant declarations of winPushPixels()
    
    winPushPixels() and winpushpxl.c was removed in it's entirety in commit
    f31bd087e8a7f65cd588bd1d022bb18e72b2a60c "Death to mfb"
    
    wingc.c:37:1: error: redundant redeclaration of ‘winPushPixels’
    win.h:1104:1: note: previous declaration of ‘winPushPixels’ was here
    
    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/win.h b/hw/xwin/win.h
index 08d0d3f..e632c79 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -1052,18 +1052,6 @@ void
 winPolyLineNativeGDI(DrawablePtr pDrawable,
                      GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
 #endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
-              int dx, int dy, int xOrg, int yOrg);
-#endif
-
 /*
  * winscrinit.c
  */
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index 8b7c704..7ac305d 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -33,11 +33,6 @@
 #endif
 #include "win.h"
 
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx,
-              int dy, int xOrg, int yOrg);
-
 /*
  * Local prototypes
  */
commit f06b468d96afd323e28645dde44170ab367da4f1
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 17:09:18 2012 +0000

    hw/xwin: Fix redundant declarations in winmultiwindowwm.c
    
    winmultiwindowwm.c:139:14: error: redundant redeclaration of ‘display’
    ../../include/opaque.h:52:14: note: previous declaration of ‘display’ was here
    winmultiwindowwm.c:140:13: error: redundant redeclaration of ‘ErrorF’
    ../../include/os.h:558:13: note: previous declaration of ‘ErrorF’ was here
    
    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 ffb7c2d..8d55e01 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -132,13 +132,6 @@ typedef struct _XMsgProcArgRec {
 } XMsgProcArgRec, *XMsgProcArgPtr;
 
 /*
- * References to external symbols
- */
-
-extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
-
-/*
  * Prototypes for local functions
  */
 
commit 3e8269177ee01fe107830032b60a8d311d4b4b0e
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 17:08:17 2012 +0000

    hw/xwin: Fix redundant declarations in winclipboardwrappers.c
    
    Fix redundant declarations in winclipboardwrappers.c.
    Also remove obsolete winProcQueryTree() prototype.
    
    winclipboardwrappers.c:64:12: error: redundant redeclaration of ‘g_iNumScreens’
    winglobals.h:33:12: note: previous declaration of ‘g_iNumScreens’ was here
    winclipboardwrappers.c:67:13: error: redundant redeclaration of ‘g_fXdmcpEnabled’
    winglobals.h:45:13: note: previous declaration of ‘g_fXdmcpEnabled’ was here
    winclipboardwrappers.c:75:27: error: redundant redeclaration of ‘winProcEstablishConnectionOrig’
    winglobals.h:66:27: note: previous declaration of ‘winProcEstablishConnectionOrig’ was here
    winclipboardwrappers.c:76:27: error: redundant redeclaration of ‘winProcQueryTreeOrig’
    winglobals.h:67:27: note: previous declaration of ‘winProcQueryTreeOrig’ was here
    winclipboardwrappers.c:77:27: error: redundant redeclaration of ‘winProcSetSelectionOwnerOrig’
    winglobals.h:68:27: note: previous declaration of ‘winProcSetSelectionOwnerOrig’ was here
    
    winclipboardwrappers.c:56:5: warning: redundant redeclaration of ‘winProcEstablishConnection’ [-Wredundant-decls]
    winclipboardwrappers.c:52:5: note: previous declaration of ‘winProcEstablishConnection’ was here
    winclipboardwrappers.c:57:5: warning: redundant redeclaration of ‘winProcSetSelectionOwner’ [-Wredundant-decls]
    winclipboardwrappers.c:54:5: note: previous declaration of ‘winProcSetSelectionOwner’ was here
    
    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/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c
index 1118f4f..008088b 100644
--- a/hw/xwin/winclipboardwrappers.c
+++ b/hw/xwin/winclipboardwrappers.c
@@ -49,10 +49,6 @@
  * Local function prototypes
  */
 
-int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcQueryTree(ClientPtr /* client */ );
-int winProcSetSelectionOwner(ClientPtr /* client */ );
-
 DISPATCH_PROC(winProcEstablishConnection);
 DISPATCH_PROC(winProcSetSelectionOwner);
 
@@ -60,10 +56,8 @@ DISPATCH_PROC(winProcSetSelectionOwner);
  * References to external symbols
  */
 
-extern int g_iNumScreens;
 extern unsigned int g_uiAuthDataLen;
 extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboard;
@@ -71,9 +65,6 @@ extern Window g_iClipboardWindow;
 extern Atom g_atomLastOwnedSelection;
 extern HWND g_hwndClipboard;
 
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
 
 /*
  * Wrapper for internal EstablishConnection function.
commit 0975fa0b391d7b8d7e8a127ebf7a863e53fcab7d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 17:06:27 2012 +0000

    hw/xwin: Fix redundant declaration in winclipboardthread.c
    
    winclipboardthread.c:51:22: error: redundant redeclaration of ‘serverGeneration’
    ../../include/misc.h:362:22: note: previous declaration of ‘serverGeneration’ was here
    winclipboardthread.c: In function ‘winClipboardProc’:
    
    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 f2e8e6d..4479b54 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -47,7 +47,6 @@
  */
 
 extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboard;
commit 4a1da00c495706e0fbcec2b30aef3ad7acf5b703
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 17:05:25 2012 +0000

    hw/xwin: Fix redundant declaration in winclipboardinit.c
    
    In file included from winclipboardinit.c:35:0:
    winclipboard.h:81:13: error: redundant redeclaration of ‘ErrorF’
    ../../include/os.h:558:13: note: previous declaration of ‘ErrorF’ was here
    
    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/winclipboard.h b/hw/xwin/winclipboard.h
index 27eb2f9..40da551 100644
--- a/hw/xwin/winclipboard.h
+++ b/hw/xwin/winclipboard.h
@@ -79,7 +79,6 @@
  */
 
 extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
 extern void winDebug(const char *format, ...);
 extern void winErrorFVerb(int verb, const char *format, ...);
 
commit 30f31b80f0105676359105c895bc195b9f3e704c
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 16:48:45 2012 +0000

    hw/xwin: Fix various warnings in code generated by lex/yacc
    
    Remove various redundant declarations.
    
    Instruct lex not to generate code which isn't going to be used, thus avoiding
    some unused function warnings.
    
    Note that bison <2.5 expects stdlib.h to define _STDLIB_H if it's been included,
    and avoids prototyping free/malloc in that case. Some stdlib.h (e.g. newlib) may
    not match precisely (e.g. defining _STDLIB_H_), so we define it after including
    stdlib.h to be sure, and avoid a redudant declaration warning for those symbols.
    
    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 ba8aea6..15f7077 100644
--- a/hw/xwin/winprefslex.l
+++ b/hw/xwin/winprefslex.l
@@ -37,14 +37,10 @@
 #include <string.h>
 #include "winprefsyacc.h"
 
-extern YYSTYPE yylval;
-extern char *yytext;
 extern int yyparse(void);
 
 extern void ErrorF (const char* /*f*/, ...);
 
-int yylineno;
-
 /* Copy the parsed string, must be free()d in yacc parser */
 static char *makestr(char *str)
 {
@@ -62,6 +58,9 @@ static char *makestr(char *str)
 %}
 
 %option yylineno
+%option nounput
+%option noinput
+%option never-interactive
 
 %%
 \#.*[\r\n]              { /* comment */ return NEWLINE; }
diff --git a/hw/xwin/winprefsyacc.y b/hw/xwin/winprefsyacc.y
index 0acf160..19c2f40 100644
--- a/hw/xwin/winprefsyacc.y
+++ b/hw/xwin/winprefsyacc.y
@@ -37,6 +37,7 @@
 #endif
 #include <stdio.h>
 #include <stdlib.h>
+#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
 #include <string.h>
 #include "winprefs.h"
 
@@ -80,7 +81,6 @@ static void CloseSysMenu(void);
 
 static int yyerror (char *s);
 
-extern void ErrorF (const char* /*f*/, ...);
 extern char *yytext;
 extern int yylex(void);
 
commit 4231b9541c6fd26f43b605ecc9dd76622dd786f7
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 16:38:49 2012 +0000

    hw/xwin: Fix redundant declaration in winprefs.c
    
    winprefs.c:63:14: error: redundant redeclaration of ‘display’
    ../../include/opaque.h:52:14: note: previous declaration of ‘display’ was here
    
    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/winprefs.c b/hw/xwin/winprefs.c
index faa97c3..52d1bc1 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -57,9 +57,6 @@ extern int parse_file(FILE * fp);
 /* Currently in use command ID, incremented each new menu item created */
 static int g_cmdid = STARTMENUID;
 
-/* Defined in DIX */
-extern char *display;
-
 /* Local function to handle comma-ified icon names */
 static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
 
commit 70087c55fffc3cbc52f550418e6b1230bbb1b3b3
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 16:36:40 2012 +0000

    hw/xwin: Fix redundant declaration warnings in winmonitors.c
    
    Include xwin-config.h so HAVE_STRLCPY and HAVE_STRNDUP are defined, so
    duplicate declarations of strlcpy(), strlcat() and strndup() aren't made
    by os.h
    
    In file included from ../../include/misc.h:111:0,
                     from ../../include/screenint.h:51,
                     from ../../include/scrnintstr.h:51,
                     from win.h:157,
                     from winmonitors.c:31:
    ../../include/os.h:491:15: error: redundant redeclaration of ‘strlcpy’
    /usr/include/string.h:86:35: note: previous declaration of ‘strlcpy’ was here
    ../../include/os.h:492:15: error: redundant redeclaration of ‘strlcat’
    /usr/include/string.h:85:35: note: previous declaration of ‘strlcat’ was here
    ../../include/os.h:496:15: error: redundant redeclaration of ‘strndup’
    
    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/winmonitors.c b/hw/xwin/winmonitors.c
index 07532f6..76063d3 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -27,6 +27,10 @@ from The Open Group.
 
 */
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
 #include "win.h"
 #include "winmonitors.h"
 
commit 9904c8fe75c96cf84d8885aa95f2743c1b25ea37
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Jan 25 16:09:59 2012 +0000

    hw/xwin: Remove completely unused winregistry.c
    
    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/Makefile.am b/hw/xwin/Makefile.am
index 33729a9..99dc556 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -95,7 +95,6 @@ SRCS =	InitInput.c \
 	winprefsyacc.y \
 	winprefslex.l \
 	winprocarg.c \
-	winregistry.c \
 	winscrinit.c \
 	winshaddd.c \
 	winshadddnl.c \
diff --git a/hw/xwin/winregistry.c b/hw/xwin/winregistry.c
deleted file mode 100644
index d33f8c36..0000000
--- a/hw/xwin/winregistry.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *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
- *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.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* Prototypes */
-DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey);
-
-DWORD
-winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey)
-{
-    HKEY hkResult;
-    DWORD dwDisposition;
-
-    RegCreateKeyEx(hkey,
-                   pszRegistryKey,
-                   0,
-                   '\0',
-                   REG_OPTION_NON_VOLATILE,
-                   KEY_READ, NULL, &hkResult, &dwDisposition);
-
-    if (dwDisposition == REG_CREATED_NEW_KEY) {
-        ErrorF("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
-    }
-    else if (dwDisposition == REG_OPENED_EXISTING_KEY) {
-        ErrorF("winGetRegistryDWORD - Opened existing key: %s\n",
-               pszRegistryKey);
-    }
-
-    /* Free the registry key handle */
-    RegCloseKey(hkResult);
-    hkResult = NULL;
-
-    return 0;
-}
commit a69429a17bf4630f6e26f61630a1c2b287202627
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Sep 7 14:58:06 2012 +0100

    Fix 'make distcheck' for hw/xwin
    
    Add some missing header files to _SOURCES so they get distributed properly
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 4c2f04e..33729a9 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -109,13 +109,16 @@ SRCS =	InitInput.c \
 	winclipboard.h \
 	winconfig.h \
 	win.h \
+	winglobals.h \
 	winkeybd.h \
 	winkeynames.h \
 	winlayouts.h \
 	winmessages.h \
+	winmonitors.h \
 	winmsg.h \
 	winms.h \
 	winmultiwindowclass.h \
+	winmultiwindowicons.h \
 	winprefs.h \
 	winresource.h \
 	winwindow.h \
diff --git a/hw/xwin/glx/Makefile.am b/hw/xwin/glx/Makefile.am
index 7222a9f..59f6879 100644
--- a/hw/xwin/glx/Makefile.am
+++ b/hw/xwin/glx/Makefile.am
@@ -6,7 +6,8 @@ libXwinGLX_la_SOURCES = \
 	glwindows.h \
 	glwrap.c \
 	indirect.c \
-	wgl_ext_api.c
+	wgl_ext_api.c \
+	wgl_ext_api.h
 
 if XWIN_MULTIWINDOW
 DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
commit 1d9fd7ffb03ff6e44f3a8736a94e4558203ce607
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Sep 6 13:51:38 2012 +0100

    Fix compilation of Xorg DDX without XF86VIDMODE
    
    Fix compilation of Xorg DDX without XF86VIDMODE since 6e74fdda, by putting
    xf86vmode.c back under the XF86VIDMODE automake conditional it was accidentally
    taken out of.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Tested-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index f8fcde9..532d87b 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -15,6 +15,7 @@ XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
 endif
 
 if XF86VIDMODE
+XF86VMODESOURCES = xf86vmode.c
 XF86VMODE_SDK = vidmodeproc.h
 endif
 
@@ -47,7 +48,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
                       xf86VidMode.c xf86fbman.c xf86cmap.c \
                       xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
                       xf86Mode.c xorgHelper.c xf86Extensions.h \
-		      xf86Extensions.c xf86vmode.c \
+		      xf86Extensions.c $(XF86VMODESOURCES) \
                       $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
 nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
 libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
commit 25741b1aa3a0fb39cb842a43ab52935673cfdefa
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Sep 2 15:17:05 2012 +0100

    hw/xwin: Only add GLX extension once.
    
    Using of LoadExtension() to add GLX onto to the end of the list of extensions on
    every server regeneration leads to hilarious consequences (i.e. crashing) after
    the first regeneration :-)
    
    Possibly xf86ExtensionInit() and QuartzExtensionInit() need a similar fix.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 37cd8b3..1cf0f02 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -164,7 +164,7 @@ void XwinExtensionInit(void)
     int i;
 
 #ifdef XWIN_GLX_WINDOWS
-    if ((g_fNativeGl) && (serverGeneration == 1)) {
+    if (g_fNativeGl) {
         /* install the native GL provider */
         glxWinPushNativeProvider();
     }
@@ -901,7 +901,8 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
 {
     int i;
 
-    XwinExtensionInit();
+    if (serverGeneration == 1)
+        XwinExtensionInit();
 
     /* Log the command line */
     winLogCommandLine(argc, argv);
commit 7ceb85481280fecbf033f147f0f7834cad3890c6
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Sep 2 14:55:25 2012 +0100

    Correct description of -displayfd option in man page.
    
    A display number, not a port number, is written to the specified fd.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/man/Xserver.man b/man/Xserver.man
index 8d243d6..b103551 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -130,7 +130,7 @@ causes the server to generate a core dump on fatal errors.
 .B \-displayfd \fIfd\fP
 specifies a file descriptor in the launching process.  Rather than specify
 a display number, the X server will attempt to listen on successively higher
-display numbers, and upon finding a free one, will write the port number back
+display numbers, and upon finding a free one, will write the display number back
 on this file descriptor as a newline-terminated string.  The \-pn option is
 ignored when using \-displayfd.
 .TP 8
commit 4b7f00346daed20c96f3e8ea13ae411858a5424b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 10 13:33:48 2012 +1000

    dix: fix crash on shutdown if a disabled device is still grabbed (XI1 grab)
    
    A disabled device doesn't have a sprite (less so a sprite->win) and triggers
    a NULL-pointer dereference on shutdown when all active grabs are released as
    part of the cleanup.
    
    Fix this by checking for sprite being non-null and setting the focus window
    to the NullWindow if it is. The rest of the patch just attempts to make
    things more readable.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index c0e330b..ddb5b34 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1593,13 +1593,10 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
 {
     GrabPtr grab = keybd->deviceGrab.grab;
     DeviceIntPtr dev;
-    WindowPtr focusWin = keybd->focus ? keybd->focus->win
-        : keybd->spriteInfo->sprite->win;
+    WindowPtr focusWin;
     Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
                         keybd->deviceGrab.implicitGrab);
 
-    if (focusWin == FollowKeyboardWin)
-        focusWin = inputInfo.keyboard->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
     keybd->deviceGrab.grab = NullGrab;
@@ -1610,6 +1607,17 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
         if (dev->deviceGrab.sync.other == grab)
             dev->deviceGrab.sync.other = NullGrab;
     }
+
+    if (keybd->focus)
+        focusWin = keybd->focus->win;
+    else if (keybd->spriteInfo->sprite)
+        focusWin = keybd->spriteInfo->sprite->win;
+    else
+        focusWin = NullWindow;
+
+    if (focusWin == FollowKeyboardWin)
+        focusWin = inputInfo.keyboard->focus->win;
+
     DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
 
     if (!wasImplicit && grab->grabtype == XI2)
commit 0c7109f3215378bb3ed6c00c71129a63ffb4e787
Author: Denys Vlasenko <dvlasenk at redhat.com>
Date:   Mon Oct 8 14:18:02 2012 +1000

    os: fix typo in OsSigHandler() error message
    
    Recieved → Received
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/osinit.c b/os/osinit.c
index 2eb1f7a..45ab527 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -129,7 +129,7 @@ OsSigHandler(int signo)
 
 #ifdef SA_SIGINFO
     if (sip->si_code == SI_USER) {
-        ErrorFSigSafe("Recieved signal %u sent by process %u, uid %u\n", signo,
+        ErrorFSigSafe("Received signal %u sent by process %u, uid %u\n", signo,
                      sip->si_pid, sip->si_uid);
     }
     else {
commit 0a75bd640b3dc26b89d9e342999a7f4b7e98edbf
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 3 13:12:27 2012 +1000

    xfree86: add xf86UpdateDesktopDimensions()
    
    This call is required for external drivers (specifically NVIDIA) that do
    not share the xfree86 infrastructure to update the desktop dimensions.
    Without it, the driver would update the ScreenRecs but not update the total
    dimensions the input code relies on for transformation.
    
    This call is a thin wrapper around the already-existing internal call and
    should be backported to all stable series servers, with the minor ABI bump.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    CC: Andy Ritger <aritger at nvidia.com>
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 179b87c..1514c26 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -469,4 +469,8 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
 /* flags passed to xf86 allocate screen */
 #define XF86_ALLOCATE_GPU_SCREEN 1
 
+/* Update the internal total dimensions of all ScreenRecs together */
+extern _X_EXPORT void
+xf86UpdateDesktopDimensions(void);
+
 #endif                          /* _XF86_H */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index f681a85..721159d 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1898,3 +1898,9 @@ xf86ScrnToScreen(ScrnInfoPtr pScrn)
         return screenInfo.screens[pScrn->scrnIndex];
     }
 }
+
+void
+xf86UpdateDesktopDimensions(void)
+{
+    update_desktop_dimensions();
+}
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index fd90aac..1be7ba5 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(14, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(14, 1)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(18, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(7, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
commit 09f1e5b15b769e1122f0a8d7cae0820038992312
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Oct 7 18:40:35 2012 +0200

    Revert "kinput: allocate enough space for null character."
    
    This reverts commit 531785dd746d64ef7f473a83ca73bb20e74b6fca.
    
    The above commit breaks Xephyr option parsing.  Andrzej writes:
    
      Xephyr -retro -keybd evdev,,device=/dev/input/event2,xkbrules=evdev,xkbmodel=evdev,xkblayout=pl -mouse evdev,,device=/dev/input/event1 :3
    
      results in:
    
      <snip>
      Pointer option key (device=) of value (/dev/input/event1) not assigned!
      Kbd option key (device=) of value (/dev/input/event2) not assigned!
      Kbd option key (xkbrules=) of value (evdev) not assigned!
      Kbd option key (xkbmodel=) of value (evdev) not assigned!
      Kbd option key (xkblayout=) of value (pl) not assigned!
      <snip>
    
      The effect of the patch is that the "key=value" pairs are parsed in such
      a way that the key is added an "equals" sign to it and we end up with
      keys like "device=" instead of "device". This in turn has effect on
      KdParsePointerOptions and KdParseKbdOptions: the key does not match
      any choice presented in the "switch" statement, and so "Pointer/Kbd
      option key (...) of value (...) not assigned!" happens, making all
      "key=value" options inaccessible to the user. Reverting the patch makes
      them available again.
    
    Reference: http://bugs.debian.org/689246
    Reported-by: Andrzej Pietrasiewicz <andrzejtp2010 at gmail.com>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Cc: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Søren Sandmann <ssp at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index d35dcf8..b1068bb 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1034,7 +1034,7 @@ KdGetOptions(InputOption **options, char *string)
 
     if (strchr(string, '=')) {
         tam_key = (strchr(string, '=') - string);
-        key = strndup(string, tam_key + 1);
+        key = strndup(string, tam_key);
         if (!key)
             goto out;
 
commit 7f9d78d8ffb1a312f9b3d69c05323f601571e162
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 4 22:51:06 2012 -0700

    os: Don't re-declare ConnectionInputPtr and ConnectionOutputPtr
    
    They're declared in osdep.h, so don't redeclare them in io.c as
    well. Keeps the compiler happier.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/os/io.c b/os/io.c
index 5c3aceb..2f091c4 100644
--- a/os/io.c
+++ b/os/io.c
@@ -90,14 +90,14 @@ typedef struct _connectionInput {
     int lenLastReq;
     int size;
     unsigned int ignoreBytes;   /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
+} ConnectionInput;
 
 typedef struct _connectionOutput {
     struct _connectionOutput *next;
     unsigned char *buf;
     int size;
     int count;
-} ConnectionOutput, *ConnectionOutputPtr;
+} ConnectionOutput;
 
 static ConnectionInputPtr AllocateInputBuffer(void);
 static ConnectionOutputPtr AllocateOutputBuffer(void);
commit d5bf6f95f31037bd49b11348b500c3c13b7e0c99
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 4 14:42:37 2012 -0700

    Fix FlushClient to write extraBuf when provided (regression fix)
    
    In commit:
    
    	commit 092c57ab173c8b71056f6feb3b9d04d063a46579
    	Author: Adam Jackson <ajax at redhat.com>
    	Date:   Fri Jun 17 14:03:01 2011 -0400
    
    	    os: Hide the Connection{In,Out}put implementation details
    
    	    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    	    Signed-off-by: Adam Jackson <ajax at redhat.com>
    
    the check for an empty output buffer was moved from one calling
    location into the FlushClient implementation itself. However, this
    neglected the possibility that additional data, in the form of
    'extraBuf' would be passed to FlushClient from other code paths. If the
    output buffer happened to be empty at that time, the extra data would
    never be written to the client.
    
    This is fixed by checking the total data to be written, which includes
    both pending and extra data, instead of just the pending data.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/os/io.c b/os/io.c
index 015f137..5c3aceb 100644
--- a/os/io.c
+++ b/os/io.c
@@ -862,11 +862,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     long notWritten;
     long todo;
 
-    if (!oco || !oco->count)
+    if (!oco)
 	return 0;
     written = 0;
     padsize = padding_for_int32(extraCount);
     notWritten = oco->count + extraCount + padsize;
+    if (!notWritten)
+        return 0;
+
     todo = notWritten;
     while (notWritten) {
         long before = written;  /* amount of whole thing written */
commit 8367dd9736d74eca971da345c2bf559ce5bbf649
Merge: 36c18bb 7998e26
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 4 13:08:35 2012 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit 36c18bb81be619df712778bcb99dd6f1fa38701a
Author: Stephan Schreiber <info at fs-driver.org>
Date:   Wed Aug 29 20:03:58 2012 +0200

    int10: fix pci_device_read_rom usage
    
    I noticed that the build-in int10 driver always reports
    "Unable to retrieve all of segment 0x0C0000."
    even though the entire BIOS data is retrieved with success.
    
    The associated code is in hw/xfree86/int10/generic.c, in the function
    xf86ExtendedInitInt10():
    
        if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
            xf86DrvMsg(screen, X_WARNING,
                       "Unable to retrieve all of segment 0x0C0000.\n");
        }
    
    The function pci_device_read_rom() is from libpciaccess; its return
    value is not a size but an error status code: 0 means success.
    If pci_device_read_rom() returns 0 for success, the warning is generated.
    
    The proposed patch corrects the evaluation of the return value of
    pci_device_read_rom() and of the supplied BIOS size.
    
    Debian bug#686153
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 4633120..d7594de 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -178,7 +178,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
      */
     vbiosMem = (char *) base + V_BIOS;
     memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
-    if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
+    if (pci_device_read_rom(pInt->dev, vbiosMem) != 0
+        || pInt->dev->rom_size < V_BIOS_SIZE) {
         xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                    "Unable to retrieve all of segment 0x0C0000.\n");
     }
commit 4bf3eac5fe20fb203b917a486f69514c55be595a
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 27 17:12:19 2012 -0400

    configure: Stop using AM_MAINTAINER_MODE
    
    All this does is make it so editing configure.ac or Makefile.am doesn't
    rebuild the makefiles.  Which is just stupid.
    
    v2: Remove --enable-maintainer-mode from autogen.sh
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/autogen.sh b/autogen.sh
index 4e8b11b..8b6f58f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,4 +9,4 @@ cd $srcdir
 autoreconf --force -v --install || exit 1
 cd $ORIGDIR || exit $?
 
-$srcdir/configure --enable-maintainer-mode "$@"
+$srcdir/configure "$@"
diff --git a/configure.ac b/configure.ac
index 6ec180c..e686614 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,6 @@ RELEASE_DATE="2012-10-04"
 RELEASE_NAME="Horchata"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
-AM_MAINTAINER_MODE
 
 # Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
 m4_ifndef([XORG_MACROS_VERSION],
commit 262679d436941580485a10e30938974958f7d588
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 4 11:42:22 2012 -0700

    Set version to 1.14 development branch (1.13.99.0)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index ac3bf26..6ec180c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.13.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-09-05"
-RELEASE_NAME="Iced Tea"
+AC_INIT([xorg-server], 1.13.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-10-04"
+RELEASE_NAME="Horchata"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit f179b13b91c8891254d31345ee04e773839e6b87
Merge: 4dd5989 3d2b768
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 4 11:39:46 2012 -0700

    Merge remote-tracking branch 'daniels/master'

commit 7998e26159893674be69183a73a89a53f5608d58
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Fri Sep 28 15:03:42 2012 -0700

    Fix additional gcc -Wwrite-strings warning in xf86 ddx
    
    Commit 09e4b78f missed a case.
    
    Signed-off-by: Jason Gerecke <killertofu 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/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index 0d808de..c3ba2d7 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -85,7 +85,7 @@ extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name,
 extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist,
                                             const char *name, double deflt);
 extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist,
-                                          const char *name, char *deflt);
+                                          const char *name, const char *deflt);
 extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name,
                                          int deflt);
 extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list,
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 7cc7440..c2ec79a 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -276,7 +276,7 @@ xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
 }
 
 char *
-xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
+xf86CheckStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
 {
     return LookupStrOption(optlist, name, deflt, FALSE);
 }
commit f64254d85e731d0b4369d871a9a735b03f283ba6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Aug 23 15:00:24 2012 +1000

    mi: drop two useless conditions in miPointerSetPosition
    
    pDev cannot be NULL here since fill_pointer_events is the only caller.
    And if the screen is NULL, then the device tries to send events before it is
    fully initialised. That certainly shouldn't happen and would be a bug
    elsewhere.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/mipointer.c b/mi/mipointer.c
index 4defaf5..f345063 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -575,13 +575,8 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
 
     miPointerPtr pPointer;
 
-    if (!pDev)
-        return NULL;
-
     pPointer = MIPOINTER(pDev);
     pScreen = pPointer->pScreen;
-    if (!pScreen)
-        return NULL;            /* called before ready */
 
     x = trunc(*screenx);
     y = trunc(*screeny);
commit 314776eb369ca2e438907795ae030dd743c281fc
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Sep 7 18:30:23 2012 +0100

    Touch: Fix duplicate TouchBegin selection with virtual devices
    
    Given the following scenario:
      1) client A selects for TouchBegin on window W for device D
      2) client B selects for TouchBegin on window W for XIAllDevices
      3) client C selects for TouchBegin on window W with device E
    
    Step 3 will fail with BadImplementation, because attempting to look up
    XIAllDevices or XIAllMasterDevices with dixLookupDevices doesn't work.
    This should succeed (or, if it was selecting for device D, fail with
    BadAccess as it would be a duplicate selection).
    
    Fix this by performing the appropriate lookup for virtual devices.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Cc: Peter Hutterer <peter.hutterer at who-t.net>
    Cc: Chase Douglas <chase.douglas at ubuntu.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 0e45cb8..ab1b624 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -180,8 +180,13 @@ ProcXISelectEvents(ClientPtr client)
                     if (CLIENT_ID(iclient->resource) == client->index)
                         continue;
 
-                    dixLookupDevice(&tmp, evmask->deviceid, serverClient,
-                                    DixReadAccess);
+                    if (evmask->deviceid == XIAllDevices)
+                        tmp = inputInfo.all_devices;
+                    else if (evmask->deviceid == XIAllMasterDevices)
+                        tmp = inputInfo.all_master_devices;
+                    else
+                        dixLookupDevice(&tmp, evmask->deviceid, serverClient,
+                                        DixReadAccess);
                     if (!tmp)
                         return BadImplementation;       /* this shouldn't happen */
 
commit 3e6358ee6c33979329b78fe2097a1fdf76fb69cd
Author: Daniel Drake <dsd at laptop.org>
Date:   Fri Sep 7 21:48:35 2012 -0400

    Xi: Don't check for TOUCH_END, it's never set
    
    This flag is never set, so checking for it here means that we'll
    never release the simulated mouse button press after the user touches
    (and releases) the touchscreen for the first time.
    
    Fixes a problem where the XO laptop touchpad became totally
    unusable after touching the screen for the first time (since X then
    behaved as if the mouse button was held down all the time).
    
    Signed-off-by: Daniel Drake <dsd at laptop.org>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 494d07e..6ed4991 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -949,8 +949,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
 
         if (!(event->flags & TOUCH_POINTER_EMULATED))
             return DONT_PROCESS;
-        if (!(event->flags & TOUCH_END))
-            return DONT_PROCESS;
 
         DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
                             &t->state);
commit 9d6b8365702e4648e793fea21ad22f7174558680
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Sep 28 11:49:29 2012 +1000

    dix: fix crash on XI 1.x grabs on disabled devices.  (#54934)
    
    If the device is disabled, the sprite window is NULL and dereferencing
    crashes the server.
    
    This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would
    trigger another code path, creating a sprite for the disabled device as if
    detaching it (which is wrong and fixed with this patch too).
    
    Grabbing a disabled device doesn't make sense as it won't send events
    anyway. However, the protocol specs do not prohibit it, so we need to keep
    it working.
    Luckily, oldWin is only used for focus out events, which aren't necessary
    given that the device is disabled.
    
    X.Org Bug 54934 <http://bugs.freedesktop.org/show_bug.cgi?id=54934>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>

diff --git a/dix/events.c b/dix/events.c
index 3b40446..c0e330b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1555,11 +1555,13 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
     WindowPtr oldWin;
 
     /* slave devices need to float for the duration of the grab. */
-    if (grab->grabtype == XI2 &&
+    if (grab->grabtype == XI2 && keybd->enabled &&
         !(passive & ImplicitGrabMask) && !IsMaster(keybd))
         DetachFromMaster(keybd);
 
-    if (grabinfo->grab)
+    if (!keybd->enabled)
+        oldWin = NULL;
+    else if (grabinfo->grab)
         oldWin = grabinfo->grab->window;
     else if (keybd->focus)
         oldWin = keybd->focus->win;
@@ -1569,7 +1571,8 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
         oldWin = keybd->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
-    DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
+    if (oldWin)
+        DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
     if (syncEvents.playingEvents)
         grabinfo->grabTime = syncEvents.time;
     else
commit 3d2b768efae9936c6929c2bc13c7a1acc074ecd3
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Sep 7 18:17:46 2012 +0100

    Touch: Fix duplicate TouchBegin selection with virtual devices
    
    Given the following scenario:
      1) client A selects for TouchBegin on window W for device D
      2) client B selects for TouchBegin on window W for XIAllDevices
      3) client C selects for TouchBegin on window W with device E
    
    Step 3 will fail with BadImplementation, because attempting to look up
    XIAllDevices or XIAllMasterDevices with dixLookupDevices doesn't work.
    This should succeed (or, if it was selecting for device D, fail with
    BadAccess as it would be a duplicate selection).
    
    Fix this by performing the appropriate lookup for virtual devices.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>

diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 0e45cb8..ab1b624 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -180,8 +180,13 @@ ProcXISelectEvents(ClientPtr client)
                     if (CLIENT_ID(iclient->resource) == client->index)
                         continue;
 
-                    dixLookupDevice(&tmp, evmask->deviceid, serverClient,
-                                    DixReadAccess);
+                    if (evmask->deviceid == XIAllDevices)
+                        tmp = inputInfo.all_devices;
+                    else if (evmask->deviceid == XIAllMasterDevices)
+                        tmp = inputInfo.all_master_devices;
+                    else
+                        dixLookupDevice(&tmp, evmask->deviceid, serverClient,
+                                        DixReadAccess);
                     if (!tmp)
                         return BadImplementation;       /* this shouldn't happen */
 
commit e3903a9383351b061b1a99dfc653ca50de764ec4
Author: Frederic Plourde <frederic.plourde at collabora.com>
Date:   Wed Sep 12 10:48:32 2012 -0400

    Add glXCreateNewContext support in Xephyr #54798
    
    Similar to how we intercept and pass through CreateContext, also pass
    through newer CreateNewContext requests.
    
    Fixes Clutter → Xephyr → VirtualBox.
    
    Signed-off-by: Frederic Plourde <frederic.plourde at collabora.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index 892d99f..22d5108 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -61,6 +61,8 @@ int ephyrGLXGetFBConfigsSGIX(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetFBConfigsSGIXSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXCreateContext(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXCreateContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateNewContext(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXCreateNewContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
@@ -112,6 +114,9 @@ ephyrHijackGLXExtension(void)
     dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext;
     dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap;
 
+    dispatch_functions[X_GLXCreateNewContext][0] = ephyrGLXCreateNewContext;
+    dispatch_functions[X_GLXCreateNewContext][1] = ephyrGLXCreateNewContextSwap;
+
     dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext;
     dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap;
 
@@ -459,7 +464,8 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
     if (!ephyrHostGLXCreateContext(a_req->screen,
                                    host_w_attrs.visualid,
                                    a_req->context,
-                                   a_req->shareList, a_req->isDirect)) {
+                                   a_req->shareList, 0,
+                                   a_req->isDirect, X_GLXCreateContext)) {
         EPHYR_LOG_ERROR("ephyrHostGLXCreateContext() failed\n");
         goto out;
     }
@@ -469,6 +475,45 @@ ephyrGLXCreateContextReal(xGLXCreateContextReq * a_req, Bool a_do_swap)
     return res;
 }
 
+static int
+ephyrGLXCreateNewContextReal(xGLXCreateNewContextReq * a_req, Bool a_do_swap)
+{
+    int res = BadImplementation;
+
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    EPHYR_RETURN_VAL_IF_FAIL(a_req, BadValue);
+    EPHYR_LOG("enter\n");
+
+    if (a_do_swap) {
+        __GLX_SWAP_SHORT(&a_req->length);
+        __GLX_SWAP_INT(&a_req->context);
+        __GLX_SWAP_INT(&a_req->fbconfig);
+        __GLX_SWAP_INT(&a_req->screen);
+        __GLX_SWAP_INT(&a_req->renderType);
+        __GLX_SWAP_INT(&a_req->shareList);
+    }
+
+    EPHYR_LOG("context creation requested. localid:%d, "
+              "screen:%d, fbconfig:%d, renderType:%d, direct:%d\n",
+              (int) a_req->context, (int) a_req->screen,
+              (int) a_req->fbconfig, (int) a_req->renderType,
+              (int) a_req->isDirect);
+
+    if (!ephyrHostGLXCreateContext(a_req->screen,
+                                   a_req->fbconfig,
+                                   a_req->context,
+                                   a_req->shareList, a_req->renderType,
+                                   a_req->isDirect, X_GLXCreateNewContext)) {
+        EPHYR_LOG_ERROR("ephyrHostGLXCreateNewContext() failed\n");
+        goto out;
+    }
+    res = Success;
+ out:
+    EPHYR_LOG("leave\n");
+    return res;
+}
+
 int
 ephyrGLXCreateContext(__GLXclientState * cl, GLbyte * pc)
 {
@@ -485,6 +530,22 @@ ephyrGLXCreateContextSwap(__GLXclientState * cl, GLbyte * pc)
     return ephyrGLXCreateContextReal(req, TRUE);
 }
 
+int
+ephyrGLXCreateNewContext(__GLXclientState * cl, GLbyte * pc)
+{
+    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+    return ephyrGLXCreateNewContextReal(req, FALSE);
+}
+
+int
+ephyrGLXCreateNewContextSwap(__GLXclientState * cl, GLbyte * pc)
+{
+    xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+    return ephyrGLXCreateNewContextReal(req, TRUE);
+}
+
 static int
 ephyrGLXDestroyContextReal(__GLXclientState * a_cl,
                            GLbyte * a_pc, Bool a_do_swap)
diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c
index b1f729a..392489a 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/hw/kdrive/ephyr/ephyrhostglx.c
@@ -439,17 +439,20 @@ ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
 
 Bool
 ephyrHostGLXCreateContext(int a_screen,
-                          int a_visual_id,
+                          int a_generic_id,
                           int a_context_id,
-                          int a_share_list_ctxt_id, Bool a_direct)
+                          int a_share_list_ctxt_id,
+                          int a_render_type,
+                          Bool a_direct,
+                          int code)
 {
     Bool is_ok = FALSE;
     Display *dpy = hostx_get_display();
     int major_opcode = 0, remote_context_id = 0;
-    xGLXCreateContextReq *req;
 
-    EPHYR_LOG("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
-              a_screen, a_visual_id, a_context_id, a_direct);
+    EPHYR_LOG("enter. screen:%d, generic_id:%d, contextid:%d, rendertype:%d, "
+                 "direct:%d\n", a_screen, a_generic_id, a_context_id,
+                 a_render_type, a_direct);
 
     if (!hostx_allocate_resource_id_peer(a_context_id, &remote_context_id)) {
         EPHYR_LOG_ERROR("failed to peer the context id %d host X",
@@ -464,15 +467,38 @@ ephyrHostGLXCreateContext(int a_screen,
 
     LockDisplay(dpy);
 
-    /* Send the glXCreateContext request */
-    GetReq(GLXCreateContext, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXCreateContext;
-    req->context = remote_context_id;
-    req->visual = a_visual_id;
-    req->screen = DefaultScreen(dpy);
-    req->shareList = a_share_list_ctxt_id;
-    req->isDirect = a_direct;
+    switch (code) {
+    case X_GLXCreateContext: {
+        /* Send the glXCreateContext request */
+        xGLXCreateContextReq *req;
+        GetReq(GLXCreateContext, req);
+        req->reqType = major_opcode;
+        req->glxCode = X_GLXCreateContext;
+        req->context = remote_context_id;
+        req->visual = a_generic_id;
+        req->screen = DefaultScreen(dpy);
+        req->shareList = a_share_list_ctxt_id;
+        req->isDirect = a_direct;
+    }
+
+    case X_GLXCreateNewContext: {
+        /* Send the glXCreateNewContext request */
+        xGLXCreateNewContextReq *req;
+        GetReq(GLXCreateNewContext, req);
+        req->reqType = major_opcode;
+        req->glxCode = X_GLXCreateNewContext;
+        req->context = remote_context_id;
+        req->fbconfig = a_generic_id;
+        req->screen = DefaultScreen(dpy);
+        req->renderType = a_render_type;
+        req->shareList = a_share_list_ctxt_id;
+        req->isDirect = a_direct;
+    }
+
+    default:
+        /* This should never be reached !*/
+        EPHYR_LOG("Internal error! Invalid CreateContext code!\n");
+    }
 
     UnlockDisplay(dpy);
     SyncHandle();
diff --git a/hw/kdrive/ephyr/ephyrhostglx.h b/hw/kdrive/ephyr/ephyrhostglx.h
index 9aa8bdc..7ff515d 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.h
+++ b/hw/kdrive/ephyr/ephyrhostglx.h
@@ -55,9 +55,12 @@ Bool ephyrHostGLXGetMajorOpcode(int32_t * a_opcode);
 Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor,
                                 const char *a_extension_list);
 Bool ephyrHostGLXCreateContext(int a_screen,
-                               int a_visual_id,
+                               int a_generic_id,
                                int a_context_id,
-                               int a_shared_list_ctx_id, Bool a_direct);
+                               int a_share_list_ctxt_id,
+                               int a_render_type,
+                               Bool a_direct,
+                               int code);
 
 Bool ephyrHostDestroyContext(int a_ctxt_id);
 
commit 11afebc92ce1a7462ff2886286504425b1c8f0ba
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Sep 7 18:10:35 2012 +0100

    Xephyr: GLX: Support MakeContextCurrent and MakeCurrentReadSGI
    
    We need to pass these requests through to the host server in the same
    way we do glXMakeCurrent.  Generalise the existing MakeCurrent
    submission into once that will send MakeCurrent, MakeContextCurrent or
    MakeCurrentReadSGI, depending on the request and the host server's
    capabilities, and add decoding/hijack support for incoming
    MakeContextCurrent and MakeCurrentReadSGI requests.
    
    Fixes Clutter → Xephyr → VirtualBox.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index df285cf..892d99f 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -65,6 +65,10 @@ int ephyrGLXDestroyContext(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc);
+int ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetString(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetStringSwap(__GLXclientState * a_cl, GLbyte * a_pc);
 int ephyrGLXGetIntegerv(__GLXclientState * a_cl, GLbyte * a_pc);
@@ -123,14 +127,24 @@ ephyrHijackGLXExtension(void)
     dispatch_functions[61][0] = ephyrGLXGetIntegerv;
     dispatch_functions[61][1] = ephyrGLXGetIntegervSwap;
 
+    dispatch_functions[X_GLXMakeContextCurrent][0] =
+        ephyrGLXMakeContextCurrent;
+    dispatch_functions[X_GLXMakeContextCurrent][1] =
+        ephyrGLXMakeContextCurrentSwap;
+
     /*
      * hijack some vendor priv entry point dispatch functions
      */
     dispatch_functions = VendorPriv_dispatch_info.dispatch_functions;
     dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
     dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
+
+    dispatch_functions[89][0] = ephyrGLXMakeCurrentReadSGI;
+    dispatch_functions[89][1] = ephyrGLXMakeCurrentReadSGISwap;
+
     EPHYR_LOG("hijacked glx entry points to forward requests to host X\n");
 
+
     return TRUE;
 }
 
@@ -505,26 +519,34 @@ ephyrGLXDestroyContextSwap(__GLXclientState * a_cl, GLbyte * a_pc)
 }
 
 static int
-ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
+ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLXDrawable write,
+                        GLXDrawable read, GLXContextTag ctx,
+                        GLXContextTag old_ctx, Bool a_do_swap)
 {
     int res = BadImplementation;
-    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
     xGLXMakeCurrentReply reply;
-    DrawablePtr drawable = NULL;
-    GLXContextTag contextTag = 0;
-    int rc = 0;
+    DrawablePtr drawableR = NULL, drawableW = NULL;
+    GLXContextTag new_ctx = 0;
 
     EPHYR_LOG("enter\n");
-    rc = dixLookupDrawable(&drawable,
-                           req->drawable, a_cl->client, 0, DixReadAccess);
-    EPHYR_RETURN_VAL_IF_FAIL(drawable, BadValue);
-    EPHYR_RETURN_VAL_IF_FAIL(drawable->pScreen, BadValue);
-    EPHYR_LOG("screen nummber requested:%d\n", drawable->pScreen->myNum);
-
-    if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
-                                 req->context,
-                                 req->oldContextTag,
-                                 (int *) &contextTag)) {
+    res = dixLookupDrawable(&drawableW, write, a_cl->client, 0, DixReadAccess);
+    EPHYR_RETURN_VAL_IF_FAIL(drawableW, BadValue);
+    EPHYR_RETURN_VAL_IF_FAIL(drawableW->pScreen, BadValue);
+    EPHYR_LOG("screen nummber requested:%d\n", drawableW->pScreen->myNum);
+
+    if (read != write) {
+        res = dixLookupDrawable(&drawableR, read, a_cl->client, 0,
+                                DixReadAccess);
+        EPHYR_RETURN_VAL_IF_FAIL(drawableR, BadValue);
+        EPHYR_RETURN_VAL_IF_FAIL(drawableR->pScreen, BadValue);
+    }
+    else {
+        drawableR = drawableW;
+    }
+
+    if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawableW->pScreen->myNum),
+                                 hostx_get_window(drawableR->pScreen->myNum),
+                                 ctx, old_ctx, (int *) &new_ctx)) {
         EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
         goto out;
     }
@@ -532,7 +554,7 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
         .type = X_Reply,
         .sequenceNumber = a_cl->client->sequence,
         .length = 0,
-        .contextTag = contextTag
+        .contextTag = new_ctx
     };
     if (a_do_swap) {
         __GLX_DECLARE_SWAP_VARIABLES;
@@ -551,13 +573,71 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
 int
 ephyrGLXMakeCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
 {
-    return ephyrGLXMakeCurrentReal(a_cl, a_pc, FALSE);
+    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
+                                   req->context, req->oldContextTag, FALSE);
 }
 
 int
 ephyrGLXMakeCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
 {
-    return ephyrGLXMakeCurrentReal(a_cl, a_pc, TRUE);
+    xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->drawable,
+                                   req->context, req->oldContextTag, TRUE);
+}
+
+int
+ephyrGLXMakeCurrentReadSGI(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
+                                   req->context, req->oldContextTag, FALSE);
+}
+
+int
+ephyrGLXMakeCurrentReadSGISwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->readable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readable,
+                                   req->context, req->oldContextTag, TRUE);
+}
+
+int
+ephyrGLXMakeContextCurrent(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
+                                   req->context, req->oldContextTag, FALSE);
+}
+
+int
+ephyrGLXMakeContextCurrentSwap(__GLXclientState * a_cl, GLbyte * a_pc)
+{
+    xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) a_pc;
+    __GLX_DECLARE_SWAP_VARIABLES;
+
+    __GLX_SWAP_INT(&req->drawable);
+    __GLX_SWAP_INT(&req->readdrawable);
+    __GLX_SWAP_INT(&req->context);
+    __GLX_SWAP_INT(&req->oldContextTag);
+
+    return ephyrGLXMakeCurrentReal(a_cl, req->drawable, req->readdrawable,
+                                   req->context, req->oldContextTag, TRUE);
 }
 
 static int
diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c
index 6b9da6f..b1f729a 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/hw/kdrive/ephyr/ephyrhostglx.c
@@ -52,6 +52,8 @@
 #include "ephyrlog.h"
 #include "hostx.h"
 
+static int glx_major, glx_minor;
+
 enum VisualConfRequestType {
     EPHYR_GET_FB_CONFIG,
     EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
@@ -99,6 +101,12 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
     EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE);
     EPHYR_LOG("enter\n");
 
+    if (glx_major) {
+        *a_major = glx_major;
+        *a_minor = glx_minor;
+        return TRUE;
+    }
+
     if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
         EPHYR_LOG_ERROR("failed to get major opcode\n");
         goto out;
@@ -117,8 +125,8 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
     UnlockDisplay(dpy);
     SyncHandle();
 
-    *a_major = reply.majorVersion;
-    *a_minor = reply.minorVersion;
+    *a_major = glx_major = reply.majorVersion;
+    *a_minor = glx_minor = reply.minorVersion;
 
     EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor);
 
@@ -512,20 +520,19 @@ ephyrHostDestroyContext(int a_ctxt_id)
 }
 
 Bool
-ephyrHostGLXMakeCurrent(int a_drawable,
+ephyrHostGLXMakeCurrent(int a_drawable, int a_readable,
                         int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag)
 {
     Bool is_ok = FALSE;
     Display *dpy = hostx_get_display();
     int32_t major_opcode = 0;
     int remote_glx_ctxt_id = 0;
-    xGLXMakeCurrentReq *req;
     xGLXMakeCurrentReply reply;
 
     EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE);
 
-    EPHYR_LOG("enter. drawable:%d, context:%d, oldtag:%d\n",
-              a_drawable, a_glx_ctxt_id, a_old_ctxt_tag);
+    EPHYR_LOG("enter. drawable:%d, read:%d, context:%d, oldtag:%d\n",
+              a_drawable, a_readable, a_glx_ctxt_id, a_old_ctxt_tag);
 
     if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
         EPHYR_LOG_ERROR("failed to get major opcode\n");
@@ -538,12 +545,48 @@ ephyrHostGLXMakeCurrent(int a_drawable,
 
     LockDisplay(dpy);
 
-    GetReq(GLXMakeCurrent, req);
-    req->reqType = major_opcode;
-    req->glxCode = X_GLXMakeCurrent;
-    req->drawable = a_drawable;
-    req->context = remote_glx_ctxt_id;
-    req->oldContextTag = a_old_ctxt_tag;
+    /* If both drawables are the same, use the old MakeCurrent request.
+     * Otherwise, if we have GLX 1.3 or higher, use the MakeContextCurrent
+     * request which supports separate read and draw targets.  Failing that,
+     * try the SGI MakeCurrentRead extension.  Logic cribbed from Mesa. */
+    if (a_drawable == a_readable) {
+        xGLXMakeCurrentReq *req;
+
+        GetReq(GLXMakeCurrent, req);
+        req->reqType = major_opcode;
+        req->glxCode = X_GLXMakeCurrent;
+        req->drawable = a_drawable;
+        req->context = remote_glx_ctxt_id;
+        req->oldContextTag = a_old_ctxt_tag;
+    }
+    else if (glx_major > 1 || glx_minor >= 3) {
+        xGLXMakeContextCurrentReq *req;
+
+        GetReq(GLXMakeContextCurrent, req);
+        req->reqType = major_opcode;
+        req->glxCode = X_GLXMakeContextCurrent;
+        req->drawable = a_drawable;
+        req->readdrawable = a_readable;
+        req->context = remote_glx_ctxt_id;
+        req->oldContextTag = a_old_ctxt_tag;
+    }
+    else {
+        xGLXVendorPrivateWithReplyReq *vpreq;
+        xGLXMakeCurrentReadSGIReq *req;
+
+        GetReqExtra(GLXVendorPrivateWithReply,
+                    (sz_xGLXMakeCurrentReadSGIReq -
+                     sz_xGLXVendorPrivateWithReplyReq),
+                    vpreq);
+        req = (xGLXMakeCurrentReadSGIReq *) vpreq;
+        req->reqType = major_opcode;
+        req->glxCode = X_GLXVendorPrivateWithReply;
+        req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+        req->drawable = a_drawable;
+        req->readable = a_readable;
+        req->context = remote_glx_ctxt_id;
+        req->oldContextTag = a_old_ctxt_tag;
+    }
 
     memset(&reply, 0, sizeof(reply));
     if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
diff --git a/hw/kdrive/ephyr/ephyrhostglx.h b/hw/kdrive/ephyr/ephyrhostglx.h
index 9c60120..9aa8bdc 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.h
+++ b/hw/kdrive/ephyr/ephyrhostglx.h
@@ -61,7 +61,7 @@ Bool ephyrHostGLXCreateContext(int a_screen,
 
 Bool ephyrHostDestroyContext(int a_ctxt_id);
 
-Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_glx_ctxt_id,
+Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id,
                              int a_olg_ctxt_tag, int *a_ctxt_tag);
 
 Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val);
commit 4dd5989d15465f3f3480b521d4e36673972fa24a
Merge: 0b02150 506e343
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 24 11:43:01 2012 -0700

    Merge remote-tracking branch 'ajax/server-1.14-abi-churn'

commit 0b02150c27e98f996e10d7489f9f67a30e4e3497
Author: Yufeng Shen <miletus at chromium.org>
Date:   Mon Sep 24 14:03:31 2012 -0400

    dix: fix scale_to_desktop for edge ABS events
    
    Scale_to_desktop() converts ABS events from device coordinates
    to screen coordinates:
    [dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max]
    [dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max]
    
    An edge ABS event with X = dev_X_max (e.g., generated from the
    edge of a touchscreen) will be converted to have screen X value
    = screen_X_max, which, however, will be filterd out when xserver
    tries to find proper Window to receive the event, because the
    range check for a Window to receive events is
           window_X_min <= event_screen_X < window_X_max
    Events with event_screen_X = screen_X_max will fail the test get
    and rejected by the Window.
    
    To fix this, we change the device to screen coordinates mapping to
    [dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max-1]
    [dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max-1]
    
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Signed-off-by: Yufeng Shen <miletus at chromium.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/getevents.c b/dix/getevents.c
index 4e62507..71d83c4 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -896,9 +896,9 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
 
     /* scale x&y to desktop coordinates */
     *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
-                                   screenInfo.x, screenInfo.width);
+                                   screenInfo.x, screenInfo.width - 1);
     *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
-                                   screenInfo.y, screenInfo.height);
+                                   screenInfo.y, screenInfo.height - 1);
 
     *devx = x;
     *devy = y;
commit 7722bcbab2507d263c7685b15cccbfdd52fc3a24
Merge: 4dc2a76 f54987d
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Sep 23 16:04:13 2012 -0700

    Merge remote-tracking branch 'jeremyhu/master'

commit 4dc2a76740d921c824a4d8193f39dd373475f02a
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 17:57:00 2012 -0400

    miext/damage: Only wrap into the GC ops chain if there's a listener (v3)
    
     before           after          Operation
    --------    -----------------    -----------------
    1148346.9   1191807.5 (  1.04)   PutImage 10x10 square
    2091666.1   2180983.0 (  1.04)   ShmPutImage 10x10 square
    
    v3: In miDamage{R,Unr}egister, bump the serial number of the affected
    drawable (and all children if it's a window) so subsequent drawing
    against the damage will trigger another ValidateGC pass and we wrap
    in/out correctly.  Spotted by Aaron Plattner.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 2d2b422..a98c20e 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -436,9 +436,13 @@ damageCreateGC(GCPtr pGC)
 static void
 damageValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 {
+    drawableDamage(pDrawable);
     DAMAGE_GC_FUNC_PROLOGUE(pGC);
     (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
-    pGCPriv->ops = pGC->ops;    /* just so it's not NULL */
+    if (pDamage)
+        pGCPriv->ops = pGC->ops; /* so it's not NULL, so FUNC_EPILOGUE does work */
+    else
+        pGCPriv->ops = NULL;
     DAMAGE_GC_FUNC_EPILOGUE(pGC);
 }
 
@@ -1663,14 +1667,38 @@ miDamageCreate(DamagePtr pDamage)
 {
 }
 
+/*
+ * We only wrap into the GC when there's a registered listener.  For windows,
+ * damage includes damage to children.  So if there's a GC validated against
+ * a subwindow and we then register a damage on the parent, we need to bump
+ * the serial numbers of the children to re-trigger validation.
+ *
+ * Since we can't know if a GC has been validated against one of the affected
+ * children, just bump them all to be safe.
+ */
+static int 
+damageRegisterVisit(WindowPtr pWin, void *data)
+{
+    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+    return WT_WALKCHILDREN;
+}
+
 void
 miDamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
 {
+    if (pDrawable->type == DRAWABLE_WINDOW)
+        TraverseTree((WindowPtr)pDrawable, damageRegisterVisit, NULL);
+    else
+        pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
 }
 
 void
 miDamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage)
 {
+    if (pDrawable->type == DRAWABLE_WINDOW)
+        TraverseTree((WindowPtr)pDrawable, damageRegisterVisit, NULL);
+    else
+        pDrawable->serialNumber = NEXT_SERIAL_NUMBER;
 }
 
 void
commit ad0156c369a40762df6b70780358ce14e5f2c9b1
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:16:26 2012 -0400

    dix: Remove MapUnmapEventsEnabled and friends
    
    This hack was added to suppress events generated by Composite's internal
    unmap/map cycle on redirection state change.  Since that cycle was
    removed in 193ecc8b4, these can go.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Ville Syrjälä <syrjala at sci.fi>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index 40f2516..e70531a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2505,30 +2505,6 @@ RealizeTree(WindowPtr pWin)
     }
 }
 
-static WindowPtr windowDisableMapUnmapEvents;
-
-void
-DisableMapUnmapEvents(WindowPtr pWin)
-{
-    assert(windowDisableMapUnmapEvents == NULL);
-
-    windowDisableMapUnmapEvents = pWin;
-}
-
-void
-EnableMapUnmapEvents(WindowPtr pWin)
-{
-    assert(windowDisableMapUnmapEvents != NULL);
-
-    windowDisableMapUnmapEvents = NULL;
-}
-
-static Bool
-MapUnmapEventsEnabled(WindowPtr pWin)
-{
-    return pWin != windowDisableMapUnmapEvents;
-}
-
 static Bool
 MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client)
 {
@@ -2587,7 +2563,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
                 return Success;
 
         pWin->mapped = TRUE;
-        if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+        if (SubStrSend(pWin, pParent))
             DeliverMapNotify(pWin);
 
         if (!pParent->realized)
@@ -2717,8 +2693,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
             }
 #endif
             (*Unrealize) (pChild);
-            if (MapUnmapEventsEnabled(pWin))
-                DeleteWindowFromAnyEvents(pChild, FALSE);
+            DeleteWindowFromAnyEvents(pChild, FALSE);
             if (pChild->viewable) {
                 pChild->viewable = FALSE;
                 (*MarkUnrealizedWindow) (pChild, pWin, fromConfigure);
@@ -2766,7 +2741,7 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
 
     if ((!pWin->mapped) || (!(pParent = pWin->parent)))
         return Success;
-    if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+    if (SubStrSend(pWin, pParent))
         DeliverUnmapNotify(pWin, fromConfigure);
     if (wasViewable && !fromConfigure) {
         pWin->valdata = UnmapValData;
@@ -2946,8 +2921,6 @@ SendVisibilityNotify(WindowPtr pWin)
     xEvent event;
     unsigned int visibility = pWin->visibility;
 
-    if (!MapUnmapEventsEnabled(pWin))
-        return;
 #ifdef PANORAMIX
     /* This is not quite correct yet, but it's close */
     if (!noPanoramiXExtension) {
diff --git a/include/window.h b/include/window.h
index f8fc2a5..b6d61c3 100644
--- a/include/window.h
+++ b/include/window.h
@@ -221,9 +221,6 @@ extern _X_EXPORT RegionPtr CreateBoundingShape(WindowPtr /* pWin */ );
 
 extern _X_EXPORT RegionPtr CreateClipShape(WindowPtr /* pWin */ );
 
-extern _X_EXPORT void DisableMapUnmapEvents(WindowPtr /* pWin */ );
-extern _X_EXPORT void EnableMapUnmapEvents(WindowPtr /* pWin */ );
-
 extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable);
 extern _X_EXPORT void PrintWindowTree(void);
 
commit 387b1ac33ca63d27e42d4f61cf248bafb7c43c17
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:16:25 2012 -0400

    dix: Factor out DeliverUnmapNotify
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index 127f4c1..40f2516 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2737,6 +2737,17 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
     }
 }
 
+static void
+DeliverUnmapNotify(WindowPtr pWin, Bool fromConfigure)
+{
+    xEvent event = {
+        .u.unmapNotify.window = pWin->drawable.id,
+        .u.unmapNotify.fromConfigure = fromConfigure
+    };
+    event.u.u.type = UnmapNotify;
+    DeliverEvents(pWin, &event, 1, NullWindow);
+}
+
 /*****
  * UnmapWindow
  *    If the window is already unmapped, this request has no effect.
@@ -2755,14 +2766,8 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
 
     if ((!pWin->mapped) || (!(pParent = pWin->parent)))
         return Success;
-    if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-        xEvent event = {
-            .u.unmapNotify.window = pWin->drawable.id,
-            .u.unmapNotify.fromConfigure = fromConfigure
-        };
-        event.u.u.type = UnmapNotify;
-        DeliverEvents(pWin, &event, 1, NullWindow);
-    }
+    if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+        DeliverUnmapNotify(pWin, fromConfigure);
     if (wasViewable && !fromConfigure) {
         pWin->valdata = UnmapValData;
         (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin);
@@ -2813,14 +2818,8 @@ UnmapSubwindows(WindowPtr pWin)
 
     for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
         if (pChild->mapped) {
-            if (parentNotify || StrSend(pChild)) {
-                xEvent event = {
-                    .u.unmapNotify.window = pChild->drawable.id,
-                    .u.unmapNotify.fromConfigure = xFalse
-                };
-                event.u.u.type = UnmapNotify;
-                DeliverEvents(pChild, &event, 1, NullWindow);
-            }
+            if (parentNotify || StrSend(pChild))
+                DeliverUnmapNotify(pChild, xFalse);
             if (pChild->viewable) {
                 pChild->valdata = UnmapValData;
                 anyMarked = TRUE;
commit d20cc0fca4e36ad9bdbda8950c4466b1976e70a1
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:16:24 2012 -0400

    dix: Factor out DeliverMapNotify
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index 804ac0e..127f4c1 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2543,6 +2543,17 @@ MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client)
                                       client) == 1;
 }
 
+static void
+DeliverMapNotify(WindowPtr pWin)
+{
+    xEvent event = {
+        .u.mapNotify.window = pWin->drawable.id,
+        .u.mapNotify.override = pWin->overrideRedirect,
+    };
+    event.u.u.type = MapNotify;
+    DeliverEvents(pWin, &event, 1, NullWindow);
+}
+
 /*****
  * MapWindow
  *    If some other client has selected SubStructureReDirect on the parent
@@ -2576,14 +2587,8 @@ MapWindow(WindowPtr pWin, ClientPtr client)
                 return Success;
 
         pWin->mapped = TRUE;
-        if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
-            xEvent event = {
-                .u.mapNotify.window = pWin->drawable.id,
-                .u.mapNotify.override = pWin->overrideRedirect,
-            };
-            event.u.u.type = MapNotify;
-            DeliverEvents(pWin, &event, 1, NullWindow);
-        }
+        if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+            DeliverMapNotify(pWin);
 
         if (!pParent->realized)
             return Success;
@@ -2650,14 +2655,8 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
                     continue;
 
             pWin->mapped = TRUE;
-            if (parentNotify || StrSend(pWin)) {
-                xEvent event = {
-                    .u.mapNotify.window = pWin->drawable.id,
-                    .u.mapNotify.override = pWin->overrideRedirect
-                };
-                event.u.u.type = MapNotify;
-                DeliverEvents(pWin, &event, 1, NullWindow);
-            }
+            if (parentNotify || StrSend(pWin))
+                DeliverMapNotify(pWin);
 
             if (!pFirstMapped)
                 pFirstMapped = pWin;
commit 63843cb70030812bb3a311b2e8dfb0d1b0a75176
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:16:23 2012 -0400

    dix: Factor out MaybeDeliverMapRequest
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index 6fb420d..804ac0e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2529,6 +2529,20 @@ MapUnmapEventsEnabled(WindowPtr pWin)
     return pWin != windowDisableMapUnmapEvents;
 }
 
+static Bool
+MaybeDeliverMapRequest(WindowPtr pWin, WindowPtr pParent, ClientPtr client)
+{
+    xEvent event = {
+        .u.mapRequest.window = pWin->drawable.id,
+        .u.mapRequest.parent = pParent->drawable.id
+    };
+    event.u.u.type = MapRequest;
+
+    return MaybeDeliverEventsToClient(pParent, &event, 1,
+                                      SubstructureRedirectMask,
+                                      client) == 1;
+}
+
 /*****
  * MapWindow
  *    If some other client has selected SubStructureReDirect on the parent
@@ -2557,18 +2571,9 @@ MapWindow(WindowPtr pWin, ClientPtr client)
     if ((pParent = pWin->parent)) {
         Bool anyMarked;
 
-        if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) {
-            xEvent event = {
-                .u.mapRequest.window = pWin->drawable.id,
-                .u.mapRequest.parent = pParent->drawable.id
-            };
-            event.u.u.type = MapRequest;
-
-            if (MaybeDeliverEventsToClient(pParent, &event, 1,
-                                           SubstructureRedirectMask,
-                                           client) == 1)
+        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)))
+            if (MaybeDeliverMapRequest(pWin, pParent, client))
                 return Success;
-        }
 
         pWin->mapped = TRUE;
         if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
@@ -2640,18 +2645,9 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
     anyMarked = FALSE;
     for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) {
         if (!pWin->mapped) {
-            if (parentRedirect && !pWin->overrideRedirect) {
-                xEvent event = {
-                    .u.mapRequest.window = pWin->drawable.id,
-                    .u.mapRequest.parent = pParent->drawable.id
-                };
-                event.u.u.type = MapRequest;
-
-                if (MaybeDeliverEventsToClient(pParent, &event, 1,
-                                               SubstructureRedirectMask,
-                                               client) == 1)
+            if (parentRedirect && !pWin->overrideRedirect)
+                if (MaybeDeliverMapRequest(pWin, pParent, client))
                     continue;
-            }
 
             pWin->mapped = TRUE;
             if (parentNotify || StrSend(pWin)) {
commit dab7a1ec7fd97e07405e0b01dc1f1ec6e5fc2e7c
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:16:22 2012 -0400

    dix: Fix some indentation
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/window.c b/dix/window.c
index cdd12dc..6fb420d 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1886,8 +1886,7 @@ AnyWindowOverlapsMe(WindowPtr pWin, WindowPtr pHead, BoxPtr box)
         if (pSib->mapped) {
             sbox = WindowExtents(pSib, &sboxrec);
             if (BOXES_OVERLAP(sbox, box)
-                && ShapeOverlap(pWin, box, pSib, sbox)
-                )
+                && ShapeOverlap(pWin, box, pSib, sbox))
                 return TRUE;
         }
     }
@@ -1905,8 +1904,7 @@ IOverlapAnyWindow(WindowPtr pWin, BoxPtr box)
         if (pSib->mapped) {
             sbox = WindowExtents(pSib, &sboxrec);
             if (BOXES_OVERLAP(sbox, box)
-                && ShapeOverlap(pWin, box, pSib, sbox)
-                )
+                && ShapeOverlap(pWin, box, pSib, sbox))
                 return TRUE;
         }
     }
@@ -2174,8 +2172,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
     else
         pSib = pWin->nextSib;
 
-    if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
-        )) {
+    if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) {
         xEvent event = {
             .u.configureRequest.window = pWin->drawable.id,
             .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None,
@@ -2551,7 +2548,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
     if (pWin->mapped)
         return Success;
 
-    /*  general check for permission to map window */
+    /* general check for permission to map window */
     if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
                  pWin, RT_NONE, NULL, DixShowAccess) != Success)
         return Success;
@@ -2560,8 +2557,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
     if ((pParent = pWin->parent)) {
         Bool anyMarked;
 
-        if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
-            )) {
+        if ((!pWin->overrideRedirect) && (RedirectSend(pParent))) {
             xEvent event = {
                 .u.mapRequest.window = pWin->drawable.id,
                 .u.mapRequest.parent = pParent->drawable.id
commit 3d1051aecbb1955084804133cacd12c7f696833a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Sep 20 05:56:39 2012 +1000

    dix: set the device transformation matrix
    
    The property handler is registered after setting the property, so
    dev->transform remains as all-zeros. That causes pixman_f_transform_invert()
    to fail (in transformAbsolute()) and invert remains as garbage. This
    may then cause a cursor jump to 0,0.
    
    Since the axes are not yet initialized here and we need to allow for drivers
    changing the matrix, we cannot use the property handler for matrix
    initialization, essentially duplicating the code.
    
    Triggered by the fix to (#49347) in 749a593e49adccdf1225be28a521412ec85333f4
    
    https://bugzilla.redhat.com/show_bug.cgi?id=852841
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/devices.c b/dix/devices.c
index 9cf04ed..66d4406 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -306,6 +306,9 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     /* unity matrix */
     memset(transform, 0, sizeof(transform));
     transform[0] = transform[4] = transform[8] = 1.0f;
+    dev->transform.m[0][0] = 1.0;
+    dev->transform.m[1][1] = 1.0;
+    dev->transform.m[2][2] = 1.0;
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
                            XIGetKnownProperty(XATOM_FLOAT), 32,
commit 1cb0261ef54b7dd6a7ef84e1c3959e424706228b
Author: Daniel Martin <consume.noise at gmail.com>
Date:   Thu Sep 6 00:38:26 2012 +0200

    dix: Delete mibstore.h
    
    Since Nov 2010 (commit c4c4676) the only purpose of mibstore.h was to
    define an empty function (miInitializeBackingStore()) for backward
    compatibility. Time to say goodbye.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index 96ceeaa..0cef779 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = libmi.la
 
 if XORG
-sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \
+sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
               migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
               mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h
 endif
@@ -12,7 +12,6 @@ libmi_la_SOURCES = 	\
 	mi.h		\
 	miarc.c		\
 	mibitblt.c	\
-	mibstore.h	\
 	micmap.c	\
 	micmap.h	\
 	micoord.h	\
diff --git a/mi/mibstore.h b/mi/mibstore.h
deleted file mode 100644
index f8ed444..0000000
--- a/mi/mibstore.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*-
- * mibstore.h --
- *	Header file for users of the MI backing-store scheme.
- *
- * Copyright (c) 1987 by the Regents of the University of California
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies.  The University of California
- * makes no representations about the suitability of this
- * software for any purpose.  It is provided "as is" without
- * express or implied warranty.
- */
-
-#ifndef _MIBSTORE_H
-#define _MIBSTORE_H
-
-#include "screenint.h"
-
-#define miInitializeBackingStore(x) do {} while (0)
-
-#endif                          /* _MIBSTORE_H */
commit 08a9ed2524679ed939fa0ad466ee3faf905b8ac4
Author: Daniel Martin <consume.noise at gmail.com>
Date:   Thu Sep 6 00:38:25 2012 +0200

    dix: Remove refs to mi backing store from docs
    
    Remove any reference to mibstore.h and miInitializeBackingStore() from
    the documentation.
    
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml
index 793aace..6d7df41 100644
--- a/hw/dmx/doc/dmx.xml
+++ b/hw/dmx/doc/dmx.xml
@@ -1215,14 +1215,6 @@ area.  Common functions to wrap are CloseScreen() and SaveScreen().
 </para></listitem></varlistentry>
 
 <varlistentry>
-<term>miInitializeBackingStore()</term>
-<listitem>
-<para>This MI function initializes the
-screen's backing storage functions, which are used to save areas of
-windows that are currently covered by other windows.
-</para></listitem></varlistentry>
-
-<varlistentry>
 <term>miDCInitialize()</term>
 <listitem>
 <para>This MI function initializes the MI cursor
@@ -1320,8 +1312,8 @@ initialize each of its screens.
 <para>Xnest's ScreenInit() function is called
 xnestOpenScreen().  This function initializes its screen's depth and
 visual information, and then calls miScreenInit() to set up the default
-screen functions.  It then calls miInitializeBackingStore() and
-miDCInitialize() to initialize backing store and the software cursor.
+screen functions.  It then calls miDCInitialize() to initialize the
+software cursor.
 Finally, it replaces many of the screen functions with its own
 functions that repackage and send the requests to the real X server to
 which Xnest is attached.
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 4c2ca47..7c2c20f 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -3561,13 +3561,6 @@ The following include files are typically required by video drivers:
 	  </para>
 
 	  <para>
-  All drivers implementing backing store need this:
-	    <literallayout><filename>
-    "mibstore.h"
-	      </filename></literallayout>
-	  </para>
-
-	  <para>
   All drivers using the mi colourmap code need this:
 	    <literallayout><filename>
     "micmap.h"
@@ -8092,13 +8085,6 @@ visible symbols.
       </para>
 
       <para>
-  All drivers implementing backing store need this:
-	<literallayout><filename>
-    "mibstore.h"
-	  </filename></literallayout>
-      </para>
-
-      <para>
   All drivers using the mi colourmap code need this:
 	<literallayout><filename>
     "micmap.h"
@@ -9103,12 +9089,6 @@ ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv)
         return FALSE;
 
     /*
-     * If backing store is to be supported (as is usually the case),
-     * initialise it.
-     */
-    miInitializeBackingStore(pScreen);
-
-    /*
      * Set initial black &amp; white colourmap indices.
      */
     xf86SetBlackWhitePixels(pScreen);
commit 76d8739b1f4ed07b874ae56a492d1e0aa0fd9b04
Author: Daniel Martin <consume.noise at gmail.com>
Date:   Thu Sep 6 00:38:24 2012 +0200

    dix: Remove #includes of mibstore.h
    
    Remove more backing store leftovers.
    
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index ea7e7fa..7007578 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -41,7 +41,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
diff --git a/fb/fb.h b/fb/fb.h
index 40a7e38..75596c5 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -39,7 +39,6 @@
 #include "privates.h"
 #include "mi.h"
 #include "migc.h"
-#include "mibstore.h"
 #include "picturestr.h"
 
 #ifdef FB_ACCESS_WRAPPER
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index b37041f..4829e1a 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -32,7 +32,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 9d0fd98..52cde72 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -36,7 +36,6 @@ from The Open Group.
 #include "scrnintstr.h"
 #include "inputstr.h"
 #include <X11/Xos.h>
-#include "mibstore.h"
 #include "mipointer.h"
 #include "xkbsrv.h"
 #include <X11/keysym.h>
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 955624f..07ea8ea 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -41,7 +41,6 @@ from The Open Group.
 #include "servermd.h"
 #define PSZ 8
 #include "fb.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 07372ad..fa19893 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -207,7 +207,6 @@ cat > sdksyms.c << EOF
 #include "miline.h"
 #include "mipointer.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "migc.h"
 #include "mipointrst.h"
 #include "mizerarc.h"
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 7b3c1b3..58b5a11 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -21,7 +21,6 @@ is" without express or implied warranty.
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "micmap.h"
 #include "colormapst.h"
 #include "resource.h"
diff --git a/hw/xnest/Visual.c b/hw/xnest/Visual.c
index 63198ba..11673c4 100644
--- a/hw/xnest/Visual.c
+++ b/hw/xnest/Visual.c
@@ -21,7 +21,6 @@ is" without express or implied warranty.
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
-#include "mibstore.h"
 #include "Xnest.h"
 
 #include "Display.h"
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index d26f18a..bf51180 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -38,7 +38,6 @@
 #include "servermd.h"
 #include "inputstr.h"
 #include "scrnintstr.h"
-#include "mibstore.h"           // mi backing store implementation
 #include "mipointer.h"          // mi software cursor
 #include "micmap.h"             // mi colormap code
 #include "fb.h"                 // fb framebuffer code
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 89e2a38..08d0d3f 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -169,7 +169,6 @@
 #include "micmap.h"
 #include "mifillarc.h"
 #include "mifpoly.h"
-#include "mibstore.h"
 #include "input.h"
 #include "mipointer.h"
 #include "X11/keysym.h"
commit 056fd15deaa85d3ed936df9a3b2e0cdcfa599da8
Author: Daniel Martin <consume.noise at gmail.com>
Date:   Thu Sep 6 00:38:23 2012 +0200

    dix: Delete mibstore.c
    
    The only reference to mibstore.c was removed with commit c4c4676. Remove the
    file itself too.
    
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/mibstore.c b/mi/mibstore.c
deleted file mode 100644
index 6cadb2b..0000000
--- a/mi/mibstore.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2007 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-#include "scrnintstr.h"
-#include "mibstore.h"
-
-/*
- * There is no longer an mi implementation of backing store.  This function
- * is only for source compatibility with old drivers.
- *
- * Note though that you do get backing store for free if your server has
- * Composite enabled, since the automatic redirection mechanism provides
- * essentially the same functionality.  See compChangeWindowAttributes()
- * for the implementation.
- */
-
-void
-miInitializeBackingStore(ScreenPtr pScreen)
-{
-}
commit 506e3437c73e5ae935ff7c056d7808fbb0c7e614
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 14:22:48 2012 -0400

    dix: Fix types in WindowOptRec
    
    No reason for these to be 64 bits on LP64.
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/windowstr.h b/include/windowstr.h
index 9caafba..a1e608f 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -86,8 +86,8 @@ typedef struct _WindowOpt {
     struct _OtherClients *otherClients; /* default: NULL */
     struct _GrabRec *passiveGrabs;      /* default: NULL */
     PropertyPtr userProps;      /* default: NULL */
-    unsigned long backingBitPlanes;     /* default: ~0L */
-    unsigned long backingPixel; /* default: 0 */
+    CARD32 backingBitPlanes;    /* default: ~0L */
+    CARD32 backingPixel;        /* default: 0 */
     RegionPtr boundingShape;    /* default: NULL */
     RegionPtr clipShape;        /* default: NULL */
     RegionPtr inputShape;       /* default: NULL */
commit 092c57ab173c8b71056f6feb3b9d04d063a46579
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 17 14:03:01 2011 -0400

    os: Hide the Connection{In,Out}put implementation details
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/os/connection.c b/os/connection.c
index 4561caa..6cd8bcf 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1038,8 +1038,8 @@ CloseDownConnection(ClientPtr client)
     if (FlushCallback)
         CallCallbacks(&FlushCallback, NULL);
 
-    if (oc->output && oc->output->count)
-        FlushClient(client, oc, (char *) NULL, 0);
+    if (oc->output)
+	FlushClient(client, oc, (char *) NULL, 0);
 #ifdef XDMCP
     XdmcpCloseDisplay(oc->fd);
 #endif
diff --git a/os/io.c b/os/io.c
index e44db39..015f137 100644
--- a/os/io.c
+++ b/os/io.c
@@ -82,6 +82,23 @@ SOFTWARE.
 CallbackListPtr ReplyCallback;
 CallbackListPtr FlushCallback;
 
+typedef struct _connectionInput {
+    struct _connectionInput *next;
+    char *buffer;               /* contains current client input */
+    char *bufptr;               /* pointer to current start of data */
+    int bufcnt;                 /* count of bytes in buffer */
+    int lenLastReq;
+    int size;
+    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
+} ConnectionInput, *ConnectionInputPtr;
+
+typedef struct _connectionOutput {
+    struct _connectionOutput *next;
+    unsigned char *buf;
+    int size;
+    int count;
+} ConnectionOutput, *ConnectionOutputPtr;
+
 static ConnectionInputPtr AllocateInputBuffer(void);
 static ConnectionOutputPtr AllocateOutputBuffer(void);
 
@@ -845,8 +862,8 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     long notWritten;
     long todo;
 
-    if (!oco)
-        return 0;
+    if (!oco || !oco->count)
+	return 0;
     written = 0;
     padsize = padding_for_int32(extraCount);
     notWritten = oco->count + extraCount + padsize;
diff --git a/os/osdep.h b/os/osdep.h
index 55db16f..0ccdb62 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -107,22 +107,8 @@ typedef Bool (*AddAuthorFunc) (unsigned name_length, const char *name,
                                unsigned data_length, char *data);
 #endif
 
-typedef struct _connectionInput {
-    struct _connectionInput *next;
-    char *buffer;               /* contains current client input */
-    char *bufptr;               /* pointer to current start of data */
-    int bufcnt;                 /* count of bytes in buffer */
-    int lenLastReq;
-    int size;
-    unsigned int ignoreBytes;   /* bytes to ignore before the next request */
-} ConnectionInput, *ConnectionInputPtr;
-
-typedef struct _connectionOutput {
-    struct _connectionOutput *next;
-    unsigned char *buf;
-    int size;
-    int count;
-} ConnectionOutput, *ConnectionOutputPtr;
+typedef struct _connectionInput *ConnectionInputPtr;
+typedef struct _connectionOutput *ConnectionOutputPtr;
 
 struct _osComm;
 
commit e2c7d70e5ddb8b17676a13ceebfbb87d14d63243
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 17 13:43:38 2011 -0400

    dix: Extend initial connection handshake for forwarding proxies
    
    Forwarding proxies like sshd will appear to be local, even though they
    aren't really.  This leads to weird behaviour for extensions that truly
    require running under the same OS services as the client, like MIT-SHM
    and DRI2.
    
    Add two new legal values for the initial connection's byteOrder field,
    'r' and 'R'.  These act like 'l' and 'B' respectively, but have the side
    effect of forcing the client to be treated as non-local.  Forwarding
    proxies should attempt to munge the first packet of the connection
    accordingly; older servers will reject connections thusly munged, so the
    proxy should fall back to passthrough if the munged connection attempt
    fails.
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 0ce10c2..2df1a6e 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3499,14 +3499,16 @@ ProcInitialConnection(ClientPtr client)
     REQUEST(xReq);
     xConnClientPrefix *prefix;
     int whichbyte = 1;
+    char order;
 
-    prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq);
-    if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
-        return client->noClientException = -1;
-    if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
-        (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) {
-        client->swapped = TRUE;
-        SwapConnClientPrefix(prefix);
+    prefix = (xConnClientPrefix *) ((char *)stuff + sz_xReq);
+    order = prefix->byteOrder;
+    if (order != 'l' && order != 'B' && order != 'r' && order != 'R')
+	return client->noClientException = -1;
+    if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+	(!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
+	client->swapped = TRUE;
+	SwapConnClientPrefix(prefix);
     }
     stuff->reqType = 2;
     stuff->length += bytes_to_int32(prefix->nbytesAuthProto) +
@@ -3514,6 +3516,9 @@ ProcInitialConnection(ClientPtr client)
     if (client->swapped) {
         swaps(&stuff->length);
     }
+    if (order == 'r' || order == 'R') {
+	client->local = FALSE;
+    }
     ResetCurrentRequest(client);
     return Success;
 }
diff --git a/os/connection.c b/os/connection.c
index d27116a..4561caa 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -894,7 +894,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
     xConnSetupPrefix csp;
     char pad[3] = { 0, 0, 0 };
     struct iovec iov[3];
-    char byteOrder = 0;
+    char order = 0;
     int whichbyte = 1;
     struct timeval waittime;
     fd_set mask;
@@ -907,15 +907,15 @@ ErrorConnMax(XtransConnInfo trans_conn)
     FD_SET(fd, &mask);
     (void) Select(fd + 1, &mask, NULL, NULL, &waittime);
     /* try to read the byte-order of the connection */
-    (void) _XSERVTransRead(trans_conn, &byteOrder, 1);
-    if ((byteOrder == 'l') || (byteOrder == 'B')) {
+    (void) _XSERVTransRead(trans_conn, &order, 1);
+    if (order == 'l' || order == 'B' || order == 'r' || order == 'R') {
         csp.success = xFalse;
         csp.lengthReason = sizeof(NOROOM) - 1;
         csp.length = (sizeof(NOROOM) + 2) >> 2;
         csp.majorVersion = X_PROTOCOL;
         csp.minorVersion = X_PROTOCOL_REVISION;
-        if (((*(char *) &whichbyte) && (byteOrder == 'B')) ||
-            (!(*(char *) &whichbyte) && (byteOrder == 'l'))) {
+	if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) ||
+	    (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) {
             swaps(&csp.majorVersion);
             swaps(&csp.minorVersion);
             swaps(&csp.length);
commit 31bf81772e146af79b0c456aae2159eba8b0280f
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 14:00:09 2012 -0400

    dix: Repack ClientRec
    
    Pick smaller types where possible, including bitfielding some Bools and
    small enums, then shuffle the result to be hole-free.  192 -> 128 bytes
    on LP64, 144 -> 96 bytes on ILP32.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/dixstruct.h b/include/dixstruct.h
index 875f6ca..c1236f5 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -56,8 +56,7 @@ ReplyNotSwappd(ClientPtr /* pClient */ ,
                void * /* pbuf */ ) _X_NORETURN;
 
 typedef enum { ClientStateInitial,
-    /* 1 is unused now, was ClientStateAuthenticating */
-    ClientStateRunning = 2,
+    ClientStateRunning,
     ClientStateRetained,
     ClientStateGone
 } ClientState;
@@ -86,27 +85,29 @@ typedef struct _Window *SaveSetElt;
 #endif
 
 typedef struct _Client {
-    int index;
-    Mask clientAsMask;
     pointer requestBuffer;
     pointer osPrivate;          /* for OS layer, including scheduler */
-    Bool swapped;
-    Bool local;
+    Mask clientAsMask;
+    short index;
+    unsigned char majorOp, minorOp;
+    int swapped:1;
+    int local:1;
+    int big_requests:1;          /* supports large requests */
+    int clientGone:1;
+    int closeDownMode:2;
+    int clientState:2;
+    char smart_priority;
+    short noClientException;      /* this client died or needs to be killed */
+    int priority;
     ReplySwapPtr pSwapReplyFunc;
     XID errorValue;
     int sequence;
-    int closeDownMode;
-    int clientGone;
-    int noClientException;      /* this client died or needs to be
-                                 * killed */
     int ignoreCount;            /* count for Attend/IgnoreClient */
-    SaveSetElt *saveSet;
     int numSaved;
+    SaveSetElt *saveSet;
     int (**requestVector) (ClientPtr /* pClient */ );
     CARD32 req_len;             /* length of current request */
-    Bool big_requests;          /* supports large requests */
-    int priority;
-    ClientState clientState;
+    unsigned int replyBytesRemaining;
     PrivateRec *devPrivates;
     unsigned short xkbClientFlags;
     unsigned short mapNotifyMask;
@@ -114,15 +115,12 @@ typedef struct _Client {
     unsigned short vMajor, vMinor;
     KeyCode minKC, maxKC;
 
-    unsigned long replyBytesRemaining;
-    int smart_priority;
-    long smart_start_tick;
-    long smart_stop_tick;
-    long smart_check_tick;
+    int smart_start_tick;
+    int smart_stop_tick;
+    int smart_check_tick;
 
     DeviceIntPtr clientPtr;
     ClientIdPtr clientIds;
-    unsigned short majorOp, minorOp;
 } ClientRec;
 
 /*
commit ff8e3ad8074cd2c8bed49b39c40c2b4892118270
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 13:16:59 2012 -0400

    dix: Pull client-is-local flag up to the ClientRec
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index b4ef5e4..faf81f7 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -288,7 +288,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
         .gid = getegid(),
 #ifdef HAS_SHM
         .signature = signature,
-        .capabilities = (LocalClient(client) && !client->swapped)
+        .capabilities = (client->local && !client->swapped)
                          ? XF86Bigfont_CAP_LocalShm : 0
 #else
         .signature = 0,
@@ -357,7 +357,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
 #else
     switch (client->req_len) {
     case 2:                    /* client with version 1.0 libX11 */
-        stuff_flags = (LocalClient(client) &&
+        stuff_flags = (client->local &&
                        !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
         break;
     case 3:                    /* client with version 1.1 libX11 */
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index a42be07..1a98a2d 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -561,7 +561,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
         isCapable = 0;
 
     rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -1229,7 +1229,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
     }
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data) {
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index a441dee..c25a274 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -2095,7 +2095,7 @@ ProcXDGADispatch(ClientPtr client)
 {
     REQUEST(xReq);
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DGAErrorBase + XF86DGAClientNotLocal;
 
 #ifdef DGA_REQ_DEBUG
diff --git a/hw/xfree86/common/xf86vmode.c b/hw/xfree86/common/xf86vmode.c
index 7cd2eed..cad0e6a 100644
--- a/hw/xfree86/common/xf86vmode.c
+++ b/hw/xfree86/common/xf86vmode.c
@@ -1590,7 +1590,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
         return BadValue;
 
     if (xf86GetVidModeEnabled() &&
-        (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
+        (xf86GetVidModeAllowNonLocal() || client->local)) {
         rep.permissions |= XF86VM_WRITE_PERMISSION;
     }
     if (client->swapped) {
@@ -1659,7 +1659,7 @@ ProcXF86VidModeDispatch(ClientPtr client)
     default:
         if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
-        if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+        if (xf86GetVidModeAllowNonLocal() || client->local) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return ProcXF86VidModeAddModeLine(client);
@@ -2083,7 +2083,7 @@ SProcXF86VidModeDispatch(ClientPtr client)
     default:
         if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
-        if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+        if (xf86GetVidModeAllowNonLocal() || client->local) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return SProcXF86VidModeAddModeLine(client);
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index ba74bb0..0b2e8fa 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -118,7 +118,7 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
         return BadValue;
     }
 
-    if (!LocalClient(client) || client->swapped)
+    if (!client->local || client->swapped)
         isCapable = 0;
 
     rep = (xXF86DRIQueryDirectRenderingCapableReply) {
@@ -528,7 +528,7 @@ ProcXF86DRIDispatch(register ClientPtr client)
         return ProcXF86DRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + XF86DRIClientNotLocal;
 
     switch (stuff->data) {
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index ee610c0..e1decec 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -588,7 +588,7 @@ ProcDRI2Dispatch(ClientPtr client)
         return ProcDRI2QueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return BadRequest;
 
     switch (stuff->data) {
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index d41a81d..aea0a45 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -612,7 +612,7 @@ ProcAppleWMDispatch(register ClientPtr client)
         return ProcAppleWMQueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     switch (stuff->data) {
@@ -684,7 +684,7 @@ SProcAppleWMDispatch(register ClientPtr client)
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + AppleWMClientNotLocal;
 
     /* only local clients are allowed WM access */
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index f77848f..9aac072 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -129,7 +129,7 @@ ProcAppleDRIQueryDirectRenderingCapable(register ClientPtr client)
     }
     rep.isCapable = isCapable;
 
-    if (!LocalClient(client))
+    if (!client->local)
         rep.isCapable = 0;
 
     if (client->swapped) {
@@ -354,7 +354,7 @@ ProcAppleDRIDispatch(register ClientPtr client)
         return ProcAppleDRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     switch (stuff->data) {
@@ -469,7 +469,7 @@ SProcAppleDRIDispatch(register ClientPtr client)
         return SProcAppleDRIQueryDirectRenderingCapable(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return DRIErrorBase + AppleDRIClientNotLocal;
 
     switch (stuff->data) {
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 5d513a8..88c3757 100644
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -525,7 +525,7 @@ ProcWindowsWMDispatch(ClientPtr client)
         return ProcWindowsWMQueryVersion(client);
     }
 
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + WindowsWMClientNotLocal;
 
     switch (stuff->data) {
@@ -575,7 +575,7 @@ SProcWindowsWMDispatch(ClientPtr client)
     REQUEST(xReq);
 
     /* It is bound to be non-local when there is byte swapping */
-    if (!LocalClient(client))
+    if (!client->local)
         return WMErrorBase + WindowsWMClientNotLocal;
 
     /* only local clients are allowed WM access */
diff --git a/include/dixstruct.h b/include/dixstruct.h
index b2a168a..875f6ca 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -91,6 +91,7 @@ typedef struct _Client {
     pointer requestBuffer;
     pointer osPrivate;          /* for OS layer, including scheduler */
     Bool swapped;
+    Bool local;
     ReplySwapPtr pSwapReplyFunc;
     XID errorValue;
     int sequence;
diff --git a/include/os.h b/include/os.h
index 9e323f3..e324216 100644
--- a/include/os.h
+++ b/include/os.h
@@ -407,9 +407,6 @@ extern _X_EXPORT int
 InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
 
 extern _X_EXPORT int
-LocalClient(ClientPtr /* client */ );
-
-extern _X_EXPORT int
 LocalClientCred(ClientPtr, int *, int *);
 
 #define LCC_UID_SET	(1 << 0)
diff --git a/os/access.c b/os/access.c
index 550f2ed..104b6a7 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1007,14 +1007,6 @@ ComputeLocalClient(ClientPtr client)
     return FALSE;
 }
 
-Bool
-LocalClient(ClientPtr client)
-{
-    if (!client->osPrivate)
-        return FALSE;
-    return ((OsCommPtr) client->osPrivate)->local_client;
-}
-
 /*
  * Return the uid and gid of a connected local client
  * 
@@ -1176,7 +1168,7 @@ AuthorizedClient(ClientPtr client)
     if (rc != Success)
         return rc;
 
-    return LocalClient(client) ? Success : BadAccess;
+    return client->local ? Success : BadAccess;
 }
 
 /* Add a host to the access control list.  This is the external interface
diff --git a/os/connection.c b/os/connection.c
index 721ad65..d27116a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -764,7 +764,7 @@ AllocNewConnection(XtransConnInfo trans_conn, int fd, CARD32 conn_time)
         free(oc);
         return NullClient;
     }
-    oc->local_client = ComputeLocalClient(client);
+    client->local = ComputeLocalClient(client);
 #if !defined(WIN32)
     ConnectionTranslation[fd] = client->index;
 #else
diff --git a/os/osdep.h b/os/osdep.h
index 587bd03..55db16f 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -162,7 +162,6 @@ typedef struct _osComm {
     XID auth_id;                /* authorization id */
     CARD32 conn_time;           /* timestamp if not established, else 0  */
     struct _XtransConnInfo *trans_conn; /* transport connection object */
-    Bool local_client;
 } OsCommRec, *OsCommPtr;
 
 extern int FlushClient(ClientPtr /*who */ ,
commit 3f7bc222638d5d38324ecbc8c2c4e39af17d110e
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jun 16 17:40:24 2011 -0400

    os: Repack ConnectionOutput for LP64
    
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/os/osdep.h b/os/osdep.h
index fff0887..587bd03 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -119,8 +119,8 @@ typedef struct _connectionInput {
 
 typedef struct _connectionOutput {
     struct _connectionOutput *next;
-    int size;
     unsigned char *buf;
+    int size;
     int count;
 } ConnectionOutput, *ConnectionOutputPtr;
 
commit 5109c7f6581b3e4e23700bfd03b4daf0ba97630e
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Sep 20 11:19:39 2012 -0400

    xfree86: Bump video ABI to 14
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 83f9790..fd90aac 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(13, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(14, 0)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(18, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(7, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)


More information about the Xquartz-changes mailing list