From bac1c5f1be4588b2b1eb646ee98a5442e1b767d5 Mon Sep 17 00:00:00 2001 From: Dirk Wallenstein Date: Sat, 17 Apr 2010 21:36:23 +0200 Subject: [PATCH 1/4] 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 Reviewed-by: Daniel Stone Signed-off-by: Peter Hutterer --- xkb/xkbUtils.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index e28799759..6d0901a36 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); From af170a4ab76d33254dd4e54a33bb410fa1624739 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 21 Apr 2010 15:51:20 +1000 Subject: [PATCH 2/4] Xext: only update the sprite on pointer events. A call to miPointerUpdateSprite for the XTEST keyboard may result in a NULL pointer dereference in miDCPutUpCursor() when the save buffer is NULL. XTS test case: Xlib 11 KeymapNotify Signed-off-by: Peter Hutterer --- Xext/xtest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Xext/xtest.c b/Xext/xtest.c index a1aacc4cd..99b6711f2 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -184,6 +184,7 @@ ProcXTestFakeInput(ClientPtr client) int i; int base = 0; int flags = 0; + int need_ptr_update = 1; nev = (stuff->length << 2) - sizeof(xReq); if ((nev % sizeof(xEvent)) || !nev) @@ -388,6 +389,8 @@ ProcXTestFakeInput(ClientPtr client) client->errorValue = ev->u.u.detail; return BadValue; } + + need_ptr_update = 0; break; case MotionNotify: if (!dev->valuator) @@ -452,7 +455,8 @@ ProcXTestFakeInput(ClientPtr client) for (i = 0; i < nevents; i++) mieqProcessDeviceEvent(dev, (InternalEvent*)(xtest_evlist+i)->event, NULL); - miPointerUpdateSprite(dev); + if (need_ptr_update) + miPointerUpdateSprite(dev); return client->noClientException; } From 262c2c9031ea60cbe738ed80ddb7faa1b888d137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rami=20Ylim=C3=A4ki?= Date: Tue, 27 Apr 2010 14:04:47 +0300 Subject: [PATCH 3/4] test: Fix linking of wrapped functions in XI2 tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running "make check" will lead to build problems in scratchbox. Building the first test that wraps dixLookupWindow fails because symbol __real_dixLookupWindow can't be resolved. Defining wrapping options as linker options instead of compiler options makes everything build nicely in scratchbox. Signed-off-by: Rami Ylimäki Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- test/xi2/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am index 0e2de6b47..d8dc7e9ce 100644 --- a/test/xi2/Makefile.am +++ b/test/xi2/Makefile.am @@ -31,14 +31,14 @@ protocol_xiquerypointer_LDADD=$(TEST_LDADD) protocol_xiwarppointer_LDADD=$(TEST_LDADD) protocol_eventconvert_LDADD=$(TEST_LDADD) -protocol_xiqueryversion_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -protocol_xiquerydevice_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -protocol_xiselectevents_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wrap,XISetEventMask -protocol_xigetselectedevents_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource -protocol_xisetclientpointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,dixLookupClient -protocol_xigetclientpointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient -protocol_xiquerypointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -protocol_xiwarppointer_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow +protocol_xiqueryversion_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xiquerydevice_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient +protocol_xiselectevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupWindow -Wl,-wrap,XISetEventMask +protocol_xigetselectedevents_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow -Wl,-wrap,AddResource +protocol_xisetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,dixLookupClient +protocol_xigetclientpointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupClient +protocol_xiquerypointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow +protocol_xiwarppointer_LDFLAGS=$(AM_LDFLAGS) -Wl,-wrap,WriteToClient -Wl,-wrap,dixLookupWindow protocol_xiqueryversion_SOURCES=$(COMMON_SOURCES) protocol-xiqueryversion.c protocol_xiquerydevice_SOURCES=$(COMMON_SOURCES) protocol-xiquerydevice.c From 02e86221b851e5423a95782aa7e297ea051022ca Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 Apr 2010 09:48:37 +1000 Subject: [PATCH 4/4] xfree86: a missing input driver is not an error. We call NIDR on all devices that make it through the config backend. Including some that have no driver assigned to them (/dev/input/mouse0 for example). Those ones then simply get ignored by NIDR, but this should not be noted as an error in the log file. X_INFO is sufficient, and it may just prevent some bugreports. Signed-off-by: Peter Hutterer Acked-by: Julien Cristau Reviewed-by: Dan Nicholson --- hw/xfree86/common/xf86Xinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index dba3370f3..a1a5527f4 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -825,7 +825,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs, } if (!idev->driver || !idev->identifier) { - xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n"); + xf86Msg(X_INFO, "No input driver/identifier specified (ignoring)\n"); rval = BadRequest; goto unwind; }