xserver: Branch 'server-1.7-branch' - 12 commits

Julien Cristau jcristau at kemper.freedesktop.org
Sat Nov 13 15:39:09 PST 2010


 Xi/exevents.c                  |    4 ---
 Xi/extinit.c                   |    3 +-
 Xi/xiproperty.c                |    9 +++++++
 Xi/xiproperty.h                |    3 ++
 dix/devices.c                  |    4 +--
 dix/events.c                   |   52 +----------------------------------------
 dix/getevents.c                |    2 -
 dix/main.c                     |    4 ---
 hw/xfree86/common/xf86Helper.c |    7 +++++
 hw/xfree86/ddc/ddc.c           |    4 ---
 hw/xfree86/modes/xf86Crtc.c    |    4 +--
 hw/xfree86/modes/xf86Cursors.c |    9 ++++---
 include/eventstr.h             |    2 -
 randr/rrtransform.c            |   28 +++++++++++-----------
 xkb/xkbUtils.c                 |   41 ++++++++++++++++++++++++++++++--
 15 files changed, 89 insertions(+), 87 deletions(-)

New commits:
commit c9bca39848add875a76cf2434aabbadb97ddd721
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jun 9 17:10:57 2010 +1000

    Xi: move property reset from extension shutdown to init.
    
    If any part of the stack calls XIGetKnownProperty during device shutdown
    the property is re-initialized before the server generation resets, leaving
    the value invalid again.
    
    Move the reset to the extension init which happens before input devices are
    initialized before the first property is requested.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 5cd11d2356d153840f1b429bdb8284367f8dc468)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index d0fd2f6..daa79f6 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1123,8 +1123,6 @@ RestoreExtensionEvents(void)
 static void
 IResetProc(ExtensionEntry * unused)
 {
-    XIResetProperties();
-
     ReplySwapVector[IReqCode] = ReplyNotSwappd;
     EventSwapVector[DeviceValuator] = NotImplemented;
     EventSwapVector[DeviceKeyPress] = NotImplemented;
@@ -1303,6 +1301,8 @@ XInputExtensionInit(void)
 
 	inputInfo.all_devices = &xi_all_devices;
 	inputInfo.all_master_devices = &xi_all_master_devices;
+
+	XIResetProperties();
     } else {
 	FatalError("IExtensionInit: AddExtensions failed\n");
     }
commit 266dc682f623a2aca6654c42164a8d8b9362c53b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri May 7 16:22:12 2010 +1000

    Xi: reset the known properties at the end of the server generation.
    
    Properties allocated through XIGetKnownProperty() aren't reset on the second
    server generation but keep the old value. As a result, wrong Atoms are
    supplied to the driver, resulting in potential data corruption or weird
    error message.
    
    Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server.
    The second X server generation won't have the FLOAT atom defined anymore,
    despite the users of this atom not noticing any errors.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 9802839d35aaf788790f1d0e8300db4693a70096)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 0c12919..d0fd2f6 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1123,6 +1123,7 @@ RestoreExtensionEvents(void)
 static void
 IResetProc(ExtensionEntry * unused)
 {
+    XIResetProperties();
 
     ReplySwapVector[IReqCode] = ReplyNotSwappd;
     EventSwapVector[DeviceValuator] = NotImplemented;
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index ea66c54..2482171 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -392,6 +392,15 @@ XIGetKnownProperty(char *name)
     return 0;
 }
 
+void
+XIResetProperties(void)
+{
+    int i;
+
+    for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
+        dev_properties[i].type = None;
+}
+
 /**
  * Convert the given property's value(s) into @nelem_return integer values and
  * store them in @buf_return. If @nelem_return is larger than the number of
diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h
index 69b41fa..d8b8863 100644
--- a/Xi/xiproperty.h
+++ b/Xi/xiproperty.h
@@ -62,4 +62,7 @@ void SRepXIListProperties(ClientPtr client, int size,
                           xXIListPropertiesReply *rep);
 void SRepXIGetProperty(ClientPtr client, int size,
                        xXIGetPropertyReply *rep);
+
+void XIResetProperties(void);
+
 #endif /* XIPROPERTY_H */
commit 240e7c50cecdcc0ce6087e141f11f165d828a7e9
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 18 15:42:54 2010 -0400

    ddc: Don't probe for DDC/CI or EEPROM
    
    For whatever reason, some (broken) monitors will crash if you do this.
    We're not actually using this information for anything, so let's just
    not do it.
    
    Originally reported as http://bugzilla.redhat.com/620333
    
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit d2064fbb687839c297a851a5d85f32dfbbe4a0d5)

diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c
index 6fad9fb..df46689 100644
--- a/hw/xfree86/ddc/ddc.c
+++ b/hw/xfree86/ddc/ddc.c
@@ -311,10 +311,6 @@ DDC2Init(int scrnIndex, I2CBusPtr pBus)
     dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
     if (xf86I2CProbeAddress(pBus, 0x0060))
 	DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
-    if (xf86I2CProbeAddress(pBus, 0x0062))
-	DDC2MakeDevice(pBus, 0x0062, "EDID EEPROM interface");
-    if (xf86I2CProbeAddress(pBus, 0x006E))
-	DDC2MakeDevice(pBus, 0x006E, "DDC control interface");
 
     return dev;
 }
commit d7c2f764b399152eeaaf18b82abaf941574e6744
Author: Dirk Wallenstein <halsmit at t-online.de>
Date:   Sat Apr 17 21:36:23 2010 +0200

    xkb: Fix omissions in geometry initialization #27679
    
    _XkbCopyGeom did not copy all of the data from the source geometry. This
    resulted in failures when trying to obtain the keymap from a server
    where the default geometry has not been replaced by a custom
    configuration.
    
    Signed-off-by: Dirk Wallenstein <halsmit at t-online.de>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit bac1c5f1be4588b2b1eb646ee98a5442e1b767d5)

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 1abb5a8..fe093a4 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1601,6 +1601,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                 else {
                     dcolor->spec = xstrdup(scolor->spec);
                 }
+                dcolor->pixel = scolor->pixel;
             }
 
             dst->geom->num_colors = dst->geom->sz_colors;
@@ -1672,6 +1673,8 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
 
                             memcpy(doutline->points, soutline->points,
                                    soutline->num_points * sizeof(XkbPointRec));
+
+                            doutline->corner_radius = soutline->corner_radius;
                         }
 
                         doutline->num_points = soutline->num_points;
@@ -1681,6 +1684,36 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
 
                 dshape->num_outlines = sshape->num_outlines;
                 dshape->sz_outlines = sshape->num_outlines;
+                dshape->name = sshape->name;
+                dshape->bounds = sshape->bounds;
+
+                dshape->approx = NULL;
+                if (sshape->approx && sshape->num_outlines > 0) {
+
+                    const ptrdiff_t approx_idx =
+                            sshape->approx - sshape->outlines;
+
+                    if (approx_idx < dshape->num_outlines) {
+                            dshape->approx = dshape->outlines + approx_idx;
+                    } else {
+                            LogMessage(X_WARNING, "XKB: approx outline "
+                                            "index is out of range\n");
+                    }
+                }
+
+                dshape->primary = NULL;
+                if (sshape->primary && sshape->num_outlines > 0) {
+
+                    const ptrdiff_t primary_idx =
+                            sshape->primary - sshape->outlines;
+
+                    if (primary_idx < dshape->num_outlines) {
+                            dshape->primary = dshape->outlines + primary_idx;
+                    } else {
+                            LogMessage(X_WARNING, "XKB: primary outline "
+                                            "index is out of range\n");
+                    }
+                }
             }
 
             dst->geom->num_shapes = src->geom->num_shapes;
@@ -1784,6 +1817,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                     }
                     drow->num_keys = srow->num_keys;
                     drow->sz_keys = srow->num_keys;
+                    drow->top = srow->top;
+                    drow->left = srow->left;
+                    drow->vertical = srow->vertical;
+                    drow->bounds = srow->bounds;
                 }
 
                 if (ssection->num_doodads) {
@@ -1802,6 +1839,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                       ddoodad = dsection->doodads;
                      k < ssection->num_doodads;
                      k++, sdoodad++, ddoodad++) {
+                    memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
                     if (sdoodad->any.type == XkbTextDoodad) {
                         if (sdoodad->text.text)
                             ddoodad->text.text =
@@ -1815,7 +1853,6 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                             ddoodad->logo.logo_name =
                              xstrdup(sdoodad->logo.logo_name);
                     }
-                    ddoodad->any.type = sdoodad->any.type;
                 }
                 dsection->overlays = NULL;
                 dsection->sz_overlays = 0;
@@ -1880,7 +1917,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                   ddoodad = dst->geom->doodads;
                  i < src->geom->num_doodads;
                  i++, sdoodad++, ddoodad++) {
-                ddoodad->any.type = sdoodad->any.type;
+                memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
                 if (sdoodad->any.type == XkbTextDoodad) {
                     if (sdoodad->text.text)
                         ddoodad->text.text = xstrdup(sdoodad->text.text);
commit 8981b0a99ca5828ddc1b375c269aa493af40e6fd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Jun 12 08:19:16 2010 -0700

    Don't coredump on "X -showopts" (bug 25874)
    
    Don't try walking the xf86ConfigLayout.screens table if it's empty
    https://bugs.freedesktop.org/show_bug.cgi?id=25874
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b8615d592700b7be319c04cc0563fdeb5a266534)

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 1cc1526..512b39e 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1447,6 +1447,13 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
     if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
 
     /*
+     * This can happen when running Xorg -showopts and a module like ati
+     * or vmware tries to load its submodules when xf86ConfigLayout is empty
+     */
+    if (!xf86ConfigLayout.screens)
+	return 0;
+
+    /*
      * This is a very important function that matches the device sections
      * as they show up in the config file with the drivers that the server
      * loads at run time.
commit a3e6e599f50902712f4a10fdbf806371335aaed3
Author: Nicolas George <nicolas.george at normalesup.org>
Date:   Wed Jun 2 13:40:51 2010 +0200

    Change keyboard controls on slave keyboards (#27926)
    
    Makes the use of IsMaster in ProcChangeKeyboardControl consistent with other
    similar loops.
    
    Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 968a79dcf5e17ac3963953ef56b8f94dbd75323b)

diff --git a/dix/devices.c b/dix/devices.c
index 87b6dc7..1037e42 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1956,7 +1956,7 @@ ProcChangeKeyboardControl (ClientPtr client)
     keyboard = PickKeyboard(client);
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) &&
+        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
             pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
 	    if (ret != Success)
@@ -1965,7 +1965,7 @@ ProcChangeKeyboardControl (ClientPtr client)
     }
 
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
-        if ((pDev == keyboard || (!IsMaster(keyboard) && pDev->u.master == keyboard)) &&
+        if ((pDev == keyboard || (!IsMaster(pDev) && pDev->u.master == keyboard)) &&
             pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
             ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
             if (ret != Success)
commit 48407d86e3be526826c2207886ec304779c93f78
Author: Ben Skeggs <bskeggs at redhat.com>
Date:   Mon Jun 7 10:21:18 2010 +1000

    randr: prevent an unnecessary screen resize with multiple displays
    
    crtc->{x,y} is always 0 when xf86DefaultScreenLimits() is called, so we
    calculate too small an area for the initial framebuffer and force a resize
    to happen.
    
    This commit fixes the code to use desired{X,Y} instead, which contains the
    initial output positions.
    
    Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit f7af00e9f0e0e1d854b0e882378c032518ab71ca)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 3fcd79b..0b077d0 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1043,8 +1043,8 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
 
 	if (crtc->enabled)
 	{
-	    crtc_width = crtc->x + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
-	    crtc_height = crtc->y + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
+	    crtc_width = crtc->desiredX + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
+	    crtc_height = crtc->desiredY + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
 	}
 	if (!canGrow) {
 	    for (o = 0; o < config->num_output; o++)
commit a6374668bda2cb78736e5f603f048adea1822d08
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 10 12:21:36 2010 +1000

    Xi: don't copy the modifier key count when copying device classes (#25480)
    
    The modifier key count is maintained by the XKB layer and
    increased/decreased for all modifiers that set state.
    
    Test case, MD/SD modifier key count in comment:
    1. keyboard 1: press and hold Shift_L    # SD:1     MD:1
    2. keyboard 2: press and release Shift_L # SD:1,0   MD:1,0
    <class copy happens>                     # SD:1     MD:1
    3. keyboard 1: release Shift_L           # SD:0     MD:1
    4. keyboard 1: press and release Shift_L # SD:1,0   MD:2,1
    
    The modifier is now logically down on the MD but not on keyboard 1 or
    keyboard 2.
    
    XKB is layered in before the DIX, it increases/decreases the modifier key
    count accordingly. In the above example, during (2), the MD gets the key
    release and thus clears the modifier bit. (3) doesn't forward the release to
    the MD because it is already cleared. The copy of modifierKeysDown when the
    lastSlave changes however increases the counter for the held key. On (4),
    the press and release are both forwarded to the MD, causing a offset by 1
    and thus do not clear the logical modifier state.
    
    X.Org Bug 25480 <http://bugs.freedesktop.org/show_bug.cgi?id=25480>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit dc614484f93b67e8b62dbb1bb2fd247fe5a4c850)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e680f6f..566b0ef 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -196,16 +196,12 @@ void
 CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
 {
     KeyClassPtr mk = master->key;
-    KeyClassPtr dk = device->key;
-    int i;
 
     if (device == master)
         return;
 
     mk->sourceid = device->id;
 
-    for (i = 0; i < 8; i++)
-        mk->modifierKeyCount[i] = dk->modifierKeyCount[i];
 
     if (!XkbCopyDeviceKeymap(master, device))
         FatalError("Couldn't pivot keymap from device to core!\n");
commit 6892697640701563921630295597be7f168cf55e
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jun 21 10:05:08 2010 +1000

    rotation: fix cursor and overlap of one pixel.
    
    Commit 77c7a64e8885696665556c9fbcb3cffb552e367a was introduced to fix
    a cursor off by one on Intel hw, however it also move the whole crtc
    into an off by one position and you could see gnom-eshell overlapping.
    
    This commit reverts that and instead fixes the cursor hotspot
    translation to work like pixman does. We add 0.5 to the cursor vector
    before translating, and floor the value afterwards.
    
    Thanks to Soeren (ssp) for pointing out where the real problem was
    after explaning how pixman translates points.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 80d1a548d6ce73c2ff097536c1bc7044bf74965d)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index d6e747f..f7250f4 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -327,10 +327,13 @@ xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 						  xf86CursorScreenKey);
 	struct pict_f_vector   v;
 
-	v.v[0] = x + ScreenPriv->HotX; v.v[1] = y + ScreenPriv->HotY; v.v[2] = 1;
+	v.v[0] = (x + ScreenPriv->HotX) + 0.5;
+	v.v[1] = (y + ScreenPriv->HotY) + 0.5;
+	v.v[2] = 1;
 	pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
-	x = floor (v.v[0] + 0.5);
-	y = floor (v.v[1] + 0.5);
+	/* cursor will have 0.5 added to it already so floor is sufficent */
+	x = floor (v.v[0]);
+	y = floor (v.v[1]);
 	/*
 	 * Transform position of cursor upper left corner
 	 */
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 06f6298..53de3b8 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -185,21 +185,21 @@ RRTransformCompute (int			    x,
 	    break;
 	case RR_Rotate_90:
 	    f_rot_cos = 0;	    f_rot_sin = 1;
-	    f_rot_dx  = height-1;   f_rot_dy  = 0;
+	    f_rot_dx  = height;	    f_rot_dy  = 0;
 	    rot_cos = F ( 0);	    rot_sin = F ( 1);
-	    rot_dx =  F (height-1); rot_dy  = F (0);
+	    rot_dx =  F ( height);  rot_dy  = F (0);
 	    break;
 	case RR_Rotate_180:
 	    f_rot_cos = -1;	    f_rot_sin = 0;
-	    f_rot_dx  = width - 1;  f_rot_dy  = height - 1;
+	    f_rot_dx  = width;	    f_rot_dy  = height;
 	    rot_cos = F (-1);	    rot_sin = F ( 0);
-	    rot_dx  = F (width-1);  rot_dy  = F ( height-1);
+	    rot_dx  = F (width);   rot_dy  = F ( height);
 	    break;
 	case RR_Rotate_270:
 	    f_rot_cos = 0;	    f_rot_sin = -1;
-	    f_rot_dx  = 0;	    f_rot_dy  = width-1;
+	    f_rot_dx  = 0;	    f_rot_dy  = width;
 	    rot_cos = F ( 0);	    rot_sin = F (-1);
-	    rot_dx  = F ( 0);	    rot_dy  = F ( width-1);
+	    rot_dx  = F ( 0);	    rot_dy  = F ( width);
 	    break;
 	}
 	
@@ -222,11 +222,11 @@ RRTransformCompute (int			    x,
 	    f_scale_x = -1;
 	    scale_x = F(-1);
 	    if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
-		f_scale_dx = width-1;
-		scale_dx = F(width-1);
+		f_scale_dx = width;
+		scale_dx = F(width);
 	    } else {
-		f_scale_dx = height-1;
-		scale_dx = F(height-1);
+		f_scale_dx = height;
+		scale_dx = F(height);
 	    }
 	}
 	if (rotation & RR_Reflect_Y)
@@ -234,11 +234,11 @@ RRTransformCompute (int			    x,
 	    f_scale_y = -1;
 	    scale_y = F(-1);
 	    if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
-		f_scale_dy = height-1;
-		scale_dy = F(height-1);
+		f_scale_dy = height;
+		scale_dy = F(height);
 	    } else {
-		f_scale_dy = width-1;
-		scale_dy = F(width-1);
+		f_scale_dy = width;
+		scale_dy = F(width);
 	    }
 	}
 	
commit 06fda4d3c8d0fdf1c533dcb91b60592a75f4ee3f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jun 24 12:52:53 2010 +1000

    Revert "dix: use the event mask of the grab for TryClientEvents."
    
    Behaviour of earlier X servers was to deliver the ButtonPress event
    unconditionally, regardless of the actual event mask being set. This is
    documented in the protocol:
    "This request establishes a passive grab.  In the future, the pointer is
    actively grabbed as described in GrabPointer, the last-pointer-grab time is
    set to the time at which the button was pressed (as transmitted in the
    ButtonPress event), and the ButtonPress event is reported if all of the
    following conditions are true:
        <list of conditions, event mask is not one of them>"
    
    Thus, a GrabButton event will always deliver the button press event, a
    GrabKey always the key press event, etc. Same goes for XI and XI2.
    
    Reproducible with a simple client requesting a button grab in the form of:
        XGrabButton(dpy, AnyButton, AnyModifier, win, True, ButtonReleaseMask,
                    GrabModeAsync, GrabModeAsync, None, None);
    
    On servers before MPX/XI2, the client will receive a button press and
    release event. On current servers, the client receives only the release.
    Clients that expect the press event to be delivered unconditionally.
    
    XTS Xlib13 XGrabButton 5/39 now passes.
    
    This reverts commit 48585bd1e3e98db0f3df1ecc68022510216e00cc.
    Effectively reverts commit 1c612acca8568fcdf9761d23f112adaf4d496f1b as well,
    the code introduced with 1c612 is not needed anymore.
    
    Conflicts:
    
    	dix/events.c
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 1884db430a5680e37e94726dff46686e2218d525)

diff --git a/dix/events.c b/dix/events.c
index 44c4624..9d35b22 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3440,7 +3440,6 @@ CheckPassiveGrabsOnWindow(
     {
 	DeviceIntPtr	gdev;
 	XkbSrvInfoPtr	xkbi = NULL;
-	Mask		mask = 0;
 
 	gdev= grab->modifierDevice;
         if (grab->grabtype == GRABTYPE_CORE)
@@ -3555,9 +3554,6 @@ CheckPassiveGrabsOnWindow(
                 }
                 xE = &core;
                 count = 1;
-                mask = grab->eventMask;
-                if (grab->ownerEvents)
-                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3569,34 +3565,6 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 count = 1;
-
-                /* FIXME: EventToXI2 returns NULL for enter events, so
-                 * dereferencing the event is bad. Internal event types are
-                 * aligned with core events, so the else clause is valid.
-                 * long-term we should use internal events for enter/focus
-                 * as well */
-                if (xE)
-                    mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
-                else if (event->type == XI_Enter || event->type == XI_FocusIn)
-                    mask = grab->xi2mask[device->id][event->type/8];
-
-                if (grab->ownerEvents && wOtherInputMasks(grab->window))
-                {
-                    InputClientsPtr icp =
-                        wOtherInputMasks(grab->window)->inputClients;
-
-                    while(icp)
-                    {
-                        if (rClient(icp) == rClient(grab))
-                        {
-                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
-                            mask |= icp->xi2mask[device->id][evtype/8];
-                            break;
-                        }
-
-                        icp = icp->next;
-                    }
-                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3607,23 +3575,6 @@ CheckPassiveGrabsOnWindow(
                                 "(%d, %d).\n", device->name, event->type, rc);
                     continue;
                 }
-                mask = grab->eventMask;
-                if (grab->ownerEvents && wOtherInputMasks(grab->window))
-                {
-                    InputClientsPtr icp =
-                        wOtherInputMasks(grab->window)->inputClients;
-
-                    while(icp)
-                    {
-                        if (rClient(icp) == rClient(grab))
-                        {
-                            mask |= icp->mask[device->id];
-                            break;
-                        }
-
-                        icp = icp->next;
-                    }
-                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -3632,7 +3583,8 @@ CheckPassiveGrabsOnWindow(
             {
                 FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
 
-                TryClientEvents(rClient(grab), device, xE, count, mask,
+                TryClientEvents(rClient(grab), device, xE, count,
+                                       GetEventFilter(device, xE),
                                        GetEventFilter(device, xE), grab);
             }
 
commit 2fce4783f41b7fb1106b2945cc98bfc8da39501d
Author: Joe Shaw <joeshaw at litl.com>
Date:   Thu Oct 14 15:09:20 2010 -0400

    fix a sign problem with valuator data.
    
    Without this patch, any negative valuator value is wrong when returned
    from XQueryDeviceState().  This is a regression from at least xserver
    1.4.
    
    Valuator data is set in dix/getevents.c:set_valuators() by copying
    signed int values into an unsigned int field
    DeviceEvent.valuators.data.
    
    That data is converted into a double with an implicit cast by
    assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().
    
    That double is converted back to a signed int in
    queryst.c:ProcXQueryDeviceState().  If the original value in
    set_valuators() is negative, the double value will be > 2^31 and the
    conversion back to a signed int is undefined.  (Although I
    consistently see the value -2^31.)
    
    Fix this by changing the definition of DeviceEvent.valuators.data from
    uint32_t to int32_t.
    
    Signed-off-by: Joe Shaw <joeshaw at litl.com>
    Reviewed-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>
    (cherry picked from commit e354ccac36a8ee3a23bdc845833c16a5646cc200)

diff --git a/dix/getevents.c b/dix/getevents.c
index 82bb77b..531595e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -177,7 +177,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, int first_valuator,
     }
 
     memcpy(&event->valuators.data[first_valuator],
-           valuators, num_valuators * sizeof(uint32_t));
+           valuators, num_valuators * sizeof(int32_t));
 
 }
 
diff --git a/include/eventstr.h b/include/eventstr.h
index 433227e..377cceb 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -99,7 +99,7 @@ struct _DeviceEvent
     struct {
         uint8_t  mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
         uint8_t  mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
-        uint32_t data[MAX_VALUATORS];         /**< Valuator data */
+        int32_t  data[MAX_VALUATORS];         /**< Valuator data */
         int32_t  data_frac[MAX_VALUATORS];    /**< Fractional part for data */
     } valuators;
     struct {
commit 9d939ea0f42954f40bbc8388b7c7f62470cdf338
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Feb 15 16:54:35 2010 -0500

    dix: Default DPMS timeout values to match screensaver values
    
    These have the same default, but if you specify something different with
    -s on the command line, only the screensaver time is changed.  As DPMS
    is usually what's desired, change it to match.
    
    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>
    (cherry picked from commit 2a763c9023b8bc978b32eaa56d2c625b6f2badee)

diff --git a/dix/main.c b/dix/main.c
index f96245a..df6963f 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -159,9 +159,7 @@ int main(int argc, char *argv[], char *envp[])
 	ScreenSaverBlanking = defaultScreenSaverBlanking;
 	ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
 #ifdef DPMSExtension
-	DPMSStandbyTime = DEFAULT_SCREEN_SAVER_TIME;
-	DPMSSuspendTime = DEFAULT_SCREEN_SAVER_TIME;
-	DPMSOffTime = DEFAULT_SCREEN_SAVER_TIME;
+	DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
 	DPMSEnabled = TRUE;
 	DPMSPowerLevel = 0;
 #endif


More information about the xorg-commit mailing list