Makefile.am                  |    4 -
 Xext/xselinux.c              |  159 ++++++++++++++++++++++++++++---------------
 Xext/xtest.c                 |   14 ++-
 Xi/xiproperty.c              |  129 ++++++++++++++++++++++++++++++++++
 configure.ac                 |    8 +-
 glx/Makefile.am              |    1 
 glx/glxcmds.c                |   44 ++++++++---
 glx/glxdrawable.h            |    5 -
 glx/glxdri.c                 |    2 
 glx/glxdri2.c                |    2 
 glx/glxdriswrast.c           |    2 
 glx/glxext.c                 |   42 ++++++++---
 glx/glxext.h                 |    1 
 glx/glxutil.h                |    9 --
 hw/xfree86/modes/xf86Crtc.c  |    4 -
 include/dix-config.h.in      |    2 
 include/exevents.h           |   12 +++
 include/xserver-properties.h |    4 +
 randr/rrdispatch.c           |    2 
 xkb/xkbUtils.c               |    4 -
 20 files changed, 347 insertions(+), 103 deletions(-)

New commits:
commit cd321badf0c185854b3e0c038f3851a3ac7864ea
Author: Adam Jackson <a...@redhat.com>
Date:   Tue Apr 14 16:08:11 2009 -0400

    xserver 1.6.1

diff --git a/configure.ac b/configure.ac
index 1318d06..4c4c797 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,12 +26,12 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.6.0, 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.6.1, 
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
 
-RELEASE_DATE="2009-2-25"
+RELEASE_DATE="2009-4-14"
 
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.

commit fcffa3a178683ede0d15656c432fccf23ebca5ef
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Wed Mar 25 15:51:43 2009 +1000

    Xext: set POINTER_SCREEN flag in XTestFakeInput if necessary. (RH #490984)
    
    The POINTER_SCREEN flag must be set explicitly for XTest core events to 
avoid
    out-of-range events when the lastSlave was an SD with an explicit axis 
range.
    Device events sent through XTest don't need this flag, they are expected to 
be
    in the valuator range of the device anyway.
    
    Red Hat Bug 490984 <https://bugzilla.redhat.com/show_bug.cgi?id=490984>
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
    (cherry picked from commit 603db34337a61754e0c5f71525011d10eab78411)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index a7f3830..3ff02ed 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -161,6 +161,7 @@ ProcXTestFakeInput(client)
     int nevents;
     int i;
     int base = 0;
+    int flags = 0;
 
     nev = (stuff->length << 2) - sizeof(xReq);
     if ((nev % sizeof(xEvent)) || !nev)
@@ -211,8 +212,14 @@ ProcXTestFakeInput(client)
                 client->errorValue = ev->u.u.type;
                 return BadValue;
             }
+
+            if (ev->u.u.detail == xFalse)
+                flags |= POINTER_ABSOLUTE;
         } else
+        {
             firstValuator = 0;
+            flags |= POINTER_ABSOLUTE;
+        }
 
         if (nev == 1 && type == XI_DeviceMotionNotify && !dev->valuator)
         {
@@ -281,6 +288,8 @@ ProcXTestFakeInput(client)
                 valuators[1] = ev->u.keyButtonPointer.rootY;
                 numValuators = 2;
                 firstValuator = 0;
+                if (ev->u.u.detail == xFalse)
+                    flags = POINTER_ABSOLUTE | POINTER_SCREEN;
                 break;
             default:
                 client->errorValue = ev->u.u.type;
@@ -378,14 +387,13 @@ ProcXTestFakeInput(client)
     GetEventList(&events);
     switch(type) {
         case MotionNotify:
-            nevents = GetPointerEvents(events, dev, type, 0,
-                            (ev->u.u.detail == xFalse) ?  POINTER_ABSOLUTE : 0,
+            nevents = GetPointerEvents(events, dev, type, 0, flags,
                             firstValuator, numValuators, valuators);
             break;
         case ButtonPress:
         case ButtonRelease:
             nevents = GetPointerEvents(events, dev, type, ev->u.u.detail,
-                                       POINTER_ABSOLUTE, firstValuator,
+                                       flags, firstValuator,
                                        numValuators, valuators);
             break;
         case KeyPress:

commit 6ff60c626141771b365d557fe64bc93f200d1c9c
Author: Kristian Høgsberg <k...@redhat.com>
Date:   Thu Apr 9 13:16:37 2009 -0400

    glx: Fix drawable private leak on destroy
    
    When a drawable goes away, we don't destroy the GLX drawable in full,
    since it may be current for a context.  This means that when the drawable
    is destroyed in full later, the backend doesn't get a chance to
    destroy resources associated with the drawable (the DRI2Drawable).
    
    With this patch, we destroy the GLX drawable in full when it goes away
    and then track down all contexts that reference it and NULL their
    pointers.
    
    (cherry picked from commit 7b6400a1b8d2f228fcbedf17c30a7e3924e4dd2a)

diff --git a/glx/Makefile.am b/glx/Makefile.am
index bec35bf..6facc20 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -79,7 +79,6 @@ libglx_la_SOURCES = \
         glxscreens.c \
         glxscreens.h \
         glxserver.h \
-        glxutil.c \
         glxutil.h \
         render2.c \
         render2swap.c \
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index ab2d91b..24ef893 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -142,16 +142,9 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig 
*config,
 void
 __glXContextDestroy(__GLXcontext *context)
 {
-    if (!context->isDirect) {
-       if (context->drawPriv)
-           __glXUnrefDrawable(context->drawPriv);
-       if (context->readPriv)
-           __glXUnrefDrawable(context->readPriv);
-    }
     __glXFlushContextCache();
 }
 
-
 static void __glXdirectContextDestroy(__GLXcontext *context)
 {
     __glXContextDestroy(context);
@@ -267,6 +260,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
     glxc->isDirect = isDirect;
     glxc->renderMode = GL_RENDER;
 
+    __glXAddToContextList(glxc);
+
     return Success;
 }
 
@@ -618,10 +613,8 @@ DoMakeCurrent(__GLXclientState *cl,
        }
        __glXFlushContextCache();
        if (!prevglxc->isDirect) {
-           if (prevglxc->drawPriv)
-               __glXUnrefDrawable(prevglxc->drawPriv);
-           if (prevglxc->readPriv)
-               __glXUnrefDrawable(prevglxc->readPriv);
+           prevglxc->drawPriv = NULL;
+           prevglxc->readPriv = NULL;
        }
     }
        
@@ -639,8 +632,6 @@ DoMakeCurrent(__GLXclientState *cl,
        }
 
        glxc->isCurrent = GL_TRUE;
-       __glXRefDrawable(glxc->drawPriv);
-       __glXRefDrawable(glxc->readPriv);
     }
 
     if (prevglxc) {
@@ -1064,6 +1055,33 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, 
GLbyte *pc)
     return DoGetFBConfigs(cl, req->screen);
 }
 
+GLboolean
+__glXDrawableInit(__GLXdrawable *drawable,
+                 __GLXscreen *screen, DrawablePtr pDraw, int type,
+                 XID drawId, __GLXconfig *config)
+{
+    drawable->pDraw = pDraw;
+    drawable->type = type;
+    drawable->drawId = drawId;
+    drawable->config = config;
+    drawable->eventMask = 0;
+
+    return GL_TRUE;
+}
+
+void
+__glXDrawableRelease(__GLXdrawable *drawable)
+{
+    ScreenPtr pScreen = drawable->pDraw->pScreen;
+
+    switch (drawable->type) {
+    case GLX_DRAWABLE_PIXMAP:
+    case GLX_DRAWABLE_PBUFFER:
+       (*pScreen->DestroyPixmap)((PixmapPtr) drawable->pDraw);
+       break;
+    }
+}
+
 static int 
 DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig 
*config,
                    DrawablePtr pDraw, XID glxDrawableId, int type)
diff --git a/glx/glxdrawable.h b/glx/glxdrawable.h
index 45000bf..60aacd7 100644
--- a/glx/glxdrawable.h
+++ b/glx/glxdrawable.h
@@ -64,11 +64,6 @@ struct __GLXdrawable {
     */
     __GLXconfig *config;
 
-    /*
-    ** reference count
-    */
-    int refCount;
-
     GLenum target;
 
     /*
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 223b06e..8d614d0 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -238,6 +238,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
        __glXleaveServer(GL_FALSE);
     }
 
+    __glXDrawableRelease(drawable);
+
     xfree(private);
 }
 
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 4e76c71..4544a2c 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -107,6 +107,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
     if (drawable->pDraw != NULL)
        DRI2DestroyDrawable(drawable->pDraw);
 
+    __glXDrawableRelease(drawable);
+
     xfree(private);
 }
 
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index b425012..f8c441e 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -95,6 +95,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
     FreeScratchGC(private->gc);
     FreeScratchGC(private->swapgc);
 
+    __glXDrawableRelease(drawable);
+
     xfree(private);
 }
 
diff --git a/glx/glxext.c b/glx/glxext.c
index c882372..fe99e4e 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -51,6 +51,7 @@
 ** from the server's perspective.
 */
 __GLXcontext *__glXLastContext;
+__GLXcontext *__glXContextList;
 
 /*
 ** X resources.
@@ -112,31 +113,46 @@ static int ContextGone(__GLXcontext* cx, XID id)
     return True;
 }
 
+static __GLXcontext *glxPendingDestroyContexts;
+static __GLXcontext *glxAllContexts;
+static int glxServerLeaveCount;
+static int glxBlockClients;
+
 /*
 ** Destroy routine that gets called when a drawable is freed.  A drawable
 ** contains the ancillary buffers needed for rendering.
 */
 static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 {
-    ScreenPtr pScreen = glxPriv->pDraw->pScreen;
+    __GLXcontext *c;
 
-    switch (glxPriv->type) {
-       case GLX_DRAWABLE_PIXMAP:
-       case GLX_DRAWABLE_PBUFFER:
-           (*pScreen->DestroyPixmap)((PixmapPtr) glxPriv->pDraw);
-           break;
+    for (c = glxAllContexts; c; c = c->next) {
+       if (c->drawPriv == glxPriv)
+           c->drawPriv = NULL;
+       if (c->readPriv == glxPriv)
+           c->readPriv = NULL;
     }
 
-    glxPriv->pDraw = NULL;
-    glxPriv->drawId = 0;
-    __glXUnrefDrawable(glxPriv);
+    glxPriv->destroy(glxPriv);
 
     return True;
 }
 
-static __GLXcontext *glxPendingDestroyContexts;
-static int glxServerLeaveCount;
-static int glxBlockClients;
+void __glXAddToContextList(__GLXcontext *cx)
+{
+    cx->next = glxAllContexts;
+    glxAllContexts = cx;
+}
+
+void __glXRemoveFromContextList(__GLXcontext *cx)
+{
+    __GLXcontext *c, **prev;
+
+    prev = &glxAllContexts;
+    for (c = glxAllContexts; c; c = c->next)
+       if (c == cx)
+           *prev = c->next;
+}
 
 /*
 ** Free a context.
@@ -151,6 +167,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
        __glXFlushContextCache();
     }
 
+    __glXRemoveFromContextList(cx);
+
     /* We can get here through both regular dispatching from
      * __glXDispatch() or as a callback from the resource manager.  In
      * the latter case we need to lift the DRI lock manually. */
diff --git a/glx/glxext.h b/glx/glxext.h
index 72092f3..7008c47 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,6 +38,7 @@
 extern GLboolean __glXFreeContext(__GLXcontext *glxc);
 extern void __glXFlushContextCache(void);
 
+extern void __glXAddToContextList(__GLXcontext *cx);
 extern void __glXErrorCallBack(GLenum code);
 extern void __glXClearErrorOccured(void);
 extern GLboolean __glXErrorOccured(void);
diff --git a/glx/glxutil.h b/glx/glxutil.h
index baa4905..d1a715b 100644
--- a/glx/glxutil.h
+++ b/glx/glxutil.h
@@ -35,18 +35,11 @@
  * Silicon Graphics, Inc.
  */
 
-/* relate contexts with drawables */
-extern void __glXAssociateContext(__GLXcontext *glxc);
-extern void __glXDeassociateContext(__GLXcontext *glxc);
-
-/* drawable management */
-extern void __glXRefDrawable(__GLXdrawable *glxPriv);
-extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
-
 extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
                                   __GLXscreen *screen,
                                   DrawablePtr pDraw, int type, XID drawID,
                                   __GLXconfig *config);
+extern void __glXDrawableRelease(__GLXdrawable *drawable);
 
 /* context helper routines */
 extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);

commit 50894e13545538ed93f20823f7ba81d1ab8906bb
Author: Eamon Walsh <ewa...@tycho.nsa.gov>
Date:   Thu Apr 9 02:48:04 2009 -0400

    xselinux: Don't BadAlloc in List* requests if there are no items to list.
    (cherry picked from commit 682d7b55699cacbb2dbcd84a5e816bf6e2d2f02a)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index a175c2c..2a32bb8 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1570,7 +1570,7 @@ SELinuxSendItemsToClient(ClientPtr client, 
SELinuxListItemRec *items,
     CARD32 *buf;
 
     buf = xcalloc(size, sizeof(CARD32));
-    if (!buf) {
+    if (size && !buf) {
        rc = BadAlloc;
        goto out;
     }
@@ -1642,7 +1642,7 @@ ProcSELinuxListProperties(ClientPtr client)
     for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
        count++;
     items = xcalloc(count, sizeof(SELinuxListItemRec));
-    if (!items)
+    if (count && !items)
        return BadAlloc;
 
     /* Fill in the items and calculate size */
@@ -1676,7 +1676,7 @@ ProcSELinuxListSelections(ClientPtr client)
     for (pSel = CurrentSelections; pSel; pSel = pSel->next)
        count++;
     items = xcalloc(count, sizeof(SELinuxListItemRec));
-    if (!items)
+    if (count && !items)
        return BadAlloc;
 
     /* Fill in the items and calculate size */

commit feb01d7d6e98fa77f9069b08aaa9727368ef3aaf
Author: Eamon Walsh <ewa...@tycho.nsa.gov>
Date:   Wed Apr 8 15:10:16 2009 -0400

    xselinux: Don't require incoming context strings to be null-terminated.
    (cherry picked from commit e8b324102f6e21ae2b8292a6f50d016dd6254dd6)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 226a4b4..a175c2c 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1261,6 +1261,17 @@ typedef struct {
     CARD32 id;
 } SELinuxListItemRec;
 
+static security_context_t
+SELinuxCopyContext(char *ptr, unsigned len)
+{
+    security_context_t copy = xalloc(len + 1);
+    if (!copy)
+       return NULL;
+    strncpy(copy, ptr, len);
+    copy[len] = '\0';
+    return copy;
+}
+
 static int
 ProcSELinuxQueryVersion(ClientPtr client)
 {
@@ -1318,29 +1329,34 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned 
offset)
 {
     PrivateRec **privPtr = &client->devPrivates;
     security_id_t *pSid;
-    security_context_t ctx;
+    security_context_t ctx = NULL;
     char *ptr;
+    int rc;
 
     REQUEST(SELinuxSetCreateContextReq);
     REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len);
 
-    ctx = (char *)(stuff + 1);
-    if (stuff->context_len > 0 && ctx[stuff->context_len - 1])
-       return BadLength;
+    if (stuff->context_len > 0) {
+       ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
+       if (!ctx)
+           return BadAlloc;
+    }
 
     if (offset == CTX_DEV) {
        /* Device create context currently requires manage permission */
-       int rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
+       rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
        if (rc != Success)
-           return rc;
+           goto out;
        privPtr = &serverClient->devPrivates;
     }
     else if (offset == USE_SEL) {
        /* Selection use context currently requires no selections owned */
        Selection *pSel;
        for (pSel = CurrentSelections; pSel; pSel = pSel->next)
-           if (pSel->client == client)
-               return BadMatch;
+           if (pSel->client == client) {
+               rc = BadMatch;
+               goto out;
+           }
     }
 
     ptr = dixLookupPrivate(privPtr, subjectKey);
@@ -1348,13 +1364,15 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned 
offset)
     sidput(*pSid);
     *pSid = NULL;
 
+    rc = Success;
     if (stuff->context_len > 0) {
-       if (security_check_context_raw(ctx) < 0)
-           return BadValue;
-       if (avc_context_to_sid_raw(ctx, pSid) < 0)
-           return BadValue;
+       if (security_check_context_raw(ctx) < 0 ||
+           avc_context_to_sid_raw(ctx, pSid) < 0)
+           rc = BadValue;
     }
-    return Success;
+out:
+    xfree(ctx);
+    return rc;
 }
 
 static int
@@ -1387,18 +1405,21 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
     REQUEST(SELinuxSetContextReq);
     REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len);
 
-    ctx = (char *)(stuff + 1);
-    if (stuff->context_len < 1 || ctx[stuff->context_len - 1])
+    if (stuff->context_len < 1)
        return BadLength;
+    ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
+    if (!ctx)
+       return BadAlloc;
 
     rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess);
     if (rc != Success)
-       return rc;
+       goto out;
 
-    if (security_check_context_raw(ctx) < 0)
-       return BadValue;
-    if (avc_context_to_sid_raw(ctx, &sid) < 0)
-       return BadValue;
+    if (security_check_context_raw(ctx) < 0 ||
+       avc_context_to_sid_raw(ctx, &sid) < 0) {
+       rc = BadValue;
+       goto out;
+    }
 
     subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
     sidput(subj->sid);
@@ -1407,7 +1428,10 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
     sidput(obj->sid);
     sidget(obj->sid = sid);
 
-    return Success;
+    rc = Success;
+out:
+    xfree(ctx);
+    return rc;
 }
 
 static int

commit b7dc7374bbcb708eee6eec26ff141619f914d8eb
Author: Eamon Walsh <ewa...@tycho.nsa.gov>
Date:   Mon Mar 9 17:28:40 2009 -0400

    Correct access mode in call to dixLookupWindow() within RRSelectInput.
    
    Reported by Alan Coopersmith.
    (cherry picked from commit 6544490700051b3b5e88ac1890d71b35634c9100)

diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 5a2ea71..0925875 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -76,7 +76,7 @@ ProcRRSelectInput (ClientPtr client)
     int                rc;
 
     REQUEST_SIZE_MATCH(xRRSelectInputReq);
-    rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+    rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
     if (rc != Success)
        return rc;
     pHead = (RREventPtr *)SecurityLookupIDByType(client,

commit 38b0f9edca80e43b4c8c364cfebc25c835d24cbd
Author: Adam Jackson <a...@redhat.com>
Date:   Fri Mar 27 16:49:45 2009 -0400

    Fix distcheck with dolt

diff --git a/Makefile.am b/Makefile.am
index cd22ca1..c605e87 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,6 +50,8 @@ EXTRA_DIST = xorg-server.pc.in xorg-server.m4 ChangeLog 
autogen.sh
 
 MAINTAINERCLEANFILES=ChangeLog
 
+DISTCLEANFILES = doltlibtool doltcompile
+
 .PHONY: ChangeLog
 
 ChangeLog:

commit 509986d6f0255588f37446173ea76640895c9886
Author: Adam Jackson <a...@redhat.com>
Date:   Fri Mar 27 16:28:26 2009 -0400

    Fix Changelog generation

diff --git a/Makefile.am b/Makefile.am
index aa9c8b6..cd22ca1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,7 +53,7 @@ MAINTAINERCLEANFILES=ChangeLog
 .PHONY: ChangeLog
 
 ChangeLog:
-       (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv 
.changelog.tmp ChangeLog; rm -f .changelog.tmp) || \
+       (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv 
.changelog.tmp ChangeLog; rm -f .changelog.tmp) || \
        (touch ChangeLog; echo 'git directory not found: installing possibly 
empty changelog.' >&2)
 
 dist-hook: ChangeLog

commit 0f9fd02dacf4363c0efd69825bc804bfb55599bf
Author: Adam Jackson <a...@redhat.com>
Date:   Mon Mar 16 13:24:48 2009 -0400

    selinux: Add support for avc_acquire_netlink_fd()
    
    Requires libselinux 2.0.79 or newer.  Without this, libselinux will
    check for policy updates on the netlink socket on basically every policy
    lookup.  Statistically speaking, they never happen, and the check
    translates to at least one more syscall on basically every operation.
    
    Instead, take control of the fd from the library, and check it in
    WakeupHandler if it polls readable.
    (cherry picked from commit 3992dd38caf33b343affd8d732c94880d1099dcf)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index a1ffd28..226a4b4 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1889,6 +1889,22 @@ SProcSELinuxDispatch(ClientPtr client)
     }
 }
 
+#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
+static int netlink_fd;
+
+static void
+SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
+{
+}
+
+static void
+SELinuxWakeupHandler(void *data, int err, void *read_mask)
+{
+    if (FD_ISSET(netlink_fd, (fd_set *)read_mask))
+        avc_netlink_check_nb();
+}
+#endif
+
 
 /*
  * Extension Setup / Teardown
@@ -1919,6 +1935,12 @@ SELinuxResetProc(ExtensionEntry *extEntry)
     label_hnd = NULL;
 
     audit_close(audit_fd);
+#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
+    avc_netlink_release_fd();
+    RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
+                                 NULL);
+    RemoveGeneralSocket(netlink_fd);
+#endif
 
     avc_destroy();
     avc_active = 0;
@@ -2015,6 +2037,13 @@ SELinuxExtensionInit(INITARGS)
     if (atom_client_ctx == BAD_RESOURCE)
        FatalError("SELinux: Failed to create atom\n");
 
+#ifdef HAVE_AVC_NETLINK_ACQUIRE_FD
+    netlink_fd = avc_netlink_acquire_fd();
+    AddGeneralSocket(netlink_fd);
+    RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
+                                   NULL);
+#endif
+
     /* Register callbacks */
     ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL);
     ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL);
diff --git a/configure.ac b/configure.ac
index f2718b8..1318d06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -921,6 +921,10 @@ if test "x$XSELINUX" = xyes; then
        AC_CHECK_LIB(selinux, avc_init, [], AC_MSG_ERROR([SELinux library not 
found])) 
        AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension 
requires audit system headers]))
        AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension 
requires audit system library]))
+        AC_CHECK_DECL(avc_netlink_acquire_fd,
+                      [AC_DEFINE(HAVE_AVC_NETLINK_ACQUIRE_FD, 1, "Have 
avc_netlink_acquire_fd")],
+                      [],
+                      [#include <selinux/avc.h>])
        AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
        SELINUX_LIB="-lselinux -laudit"
 fi
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 2515d83..db491ed 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -434,4 +434,6 @@
 #include "dix-config-apple-verbatim.h"
 #endif
 
+#undef HAVE_AVC_NETLINK_ACQUIRE_FD
+
 #endif /* _DIX_CONFIG_H_ */

commit b3484c848040ae29b8ca1327d3b142db30c38387
Author: Adam Jackson <a...@redhat.com>
Date:   Sat Feb 21 19:56:20 2009 -0500

    selinux: Don't bother relabeling resources that are being destroyed
    
    Makes window destroy about 40x faster in Xvfb.
    (cherry picked from commit b030f858f2f1ce1fd27a73ebf7f9ec5db541a668)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index becece6..a1ffd28 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1150,6 +1150,8 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer 
unused, pointer calldata)
 
     if (rec->type != RT_WINDOW)
        return;
+    if (rec->state != ResourceStateAdding)
+       return;
 
     pWin = (WindowPtr)rec->value;
     subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);

commit 08ac9140f6042ce3faa618613fc8443c92924a21
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Feb 13 09:56:22 2009 +1000

    xkb: Fix wrong colour reference in XKB geometry copying. #20081
    
    base_color and label_color need to reference the color in the destination, 
not
    in the source.
    
    X.Org Bug 20081 <http://bugs.freedesktop.org/show_bug.cgi?id=20081>
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
    Signed-off-by: Daniel Stone <dan...@fooishbar.org>
    (cherry picked from commit f5bf1fdaf36163d5c2f1b9b51df96326ebbb0e9c)

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index aafc1ab..71b0f66 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2016,9 +2016,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
 
             strcpy(dst->geom->label_font, src->geom->label_font);
             i = XkbGeomColorIndex(src->geom, src->geom->label_color);
-            dst->geom->label_color = &(src->geom->colors[i]);
+            dst->geom->label_color = &(dst->geom->colors[i]);
             i = XkbGeomColorIndex(src->geom, src->geom->base_color);
-            dst->geom->base_color = &(src->geom->colors[i]);
+            dst->geom->base_color = &(dst->geom->colors[i]);
         }
         else {
             if (dst->geom->label_font) {

commit 124da1da5cd3ac85edd7f0e30f61ee842d49a6a4
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Mon Mar 9 08:59:01 2009 +1000

    Xi: don't crash on a NULL property name, just return None.
    
    strcmp doesn't like NULL-pointers.
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
    (cherry picked from commit 0d9a42dc0380d1583889b6b6521bd5a2451735d4)

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 5aec6f8..26af3fc 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -58,11 +58,17 @@ static long XIPropHandlerID = 1;
 /**
  * Return the type assigned to the specified atom or 0 if the atom isn't known
  * to the DIX.
+ *
+ * If name is NULL, None is returned.
  */
 _X_EXPORT Atom
 XIGetKnownProperty(char *name)
 {
     int i;
+
+    if (!name)
+        return None;
+
     for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); 
i++)
     {
         if (strcmp(name, dev_properties[i].name) == 0)

commit ea9f51fd42ae0285aed707b7efa44c558dad4e4b
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Dec 5 16:24:57 2008 +1000

    Xi: add XATOM_FLOAT to server-defined properties.
    
    This property is used to denote type float for input properties. Such
    properties can be accessed easily through the XIPropToFloat() function.
    
    Code originally written by Simon Thum.
    
    Signed-off-by: Peter Hutterer <peter.hutte...@redhat.com>
    (cherry picked from commit a48c81dcdf569a3f634ac23e08d2491354de6a36)

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 0c2475b..5aec6f8 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -49,7 +49,8 @@ static struct dev_properties
     Atom type;
     char *name;
 } dev_properties[] = {
-    {0, XI_PROP_ENABLED}
+    {0, XI_PROP_ENABLED},
+    {0, XATOM_FLOAT}
 };
 
 static long XIPropHandlerID = 1;
@@ -137,6 +138,58 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int 
**buf_return)
     return Success;
 }
 
+/**
+ * Convert the given property's value(s) into @nelem_return float values and
+ * store them in @buf_return. If @nelem_return is larger than the number of
+ * values in the property, @nelem_return is set to the number of values in the
+ * property.
+ *
+ * If *...@buf_return is NULL and @nelem_return is 0, memory is allocated
+ * automatically and must be freed by the caller.
+ *
+ * Possible errors returned:
+ * Success
+ * BadMatch ... Wrong atom type, atom is not XA_FLOAT
+ * BadValue ... Wrong format, format is not 32
+ * BadAlloc ... NULL passed as buffer and allocation failed.
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
+ *
+ * @param val The property value
+ * @param nelem_return The maximum number of elements to return.
+ * @param buf_return Pointer to an array of at least @nelem_return values.
+ * @return Success or the error code if an error occured.
+ */
+_X_EXPORT int
+XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
+{
+    int i;
+    float *buf;
+
+    if (!val->type || val->type != XIGetKnownProperty(XATOM_FLOAT))
+        return BadMatch;
+
+    if (val->format != 32)
+        return BadValue;
+    if (!*buf_return && *nelem_return)
+        return BadLength;
+
+    buf = *buf_return;
+
+    if (!buf && !(*nelem_return))
+    {
+        buf = xcalloc(val->size, sizeof(float));
+        if (!buf)
+            return BadAlloc;
+        *buf_return = buf;
+        *nelem_return = val->size;
+    } else if (val->size < *nelem_return)
+        *nelem_return = val->size;
+
+    for (i = 0; i < val->size && i < *nelem_return; i++)
+           buf[i] = ((float*)val->data)[i];
+
+    return Success;
+}
 
 /**
  * Init those properties that are allocated by the server and most likely used
diff --git a/include/exevents.h b/include/exevents.h
index b13bf27..971afc2 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -257,4 +257,10 @@ extern _X_EXPORT int XIPropToInt(
         int **buf_return
 );
 
+extern _X_EXPORT int XIPropToFloat(
+        XIPropertyValuePtr val,
+        int *nelem_return,
+        float **buf_return
+);
+
 #endif /* EXEVENTS_H */
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
index 4d602b5..f8aeab6 100644
--- a/include/xserver-properties.h
+++ b/include/xserver-properties.h
@@ -26,6 +26,10 @@
 #ifndef _XSERVER_PROPERTIES_H_
 #define _XSERVER_PROPERTIES_H_
 
+/* Type for a 4 byte float. Storage format IEEE 754 in client's default
+ * byte-ordering. */
+#define XATOM_FLOAT "FLOAT"
+
 /* BOOL. 0 - device disabled, 1 - device enabled */
 #define XI_PROP_ENABLED      "Device Enabled"
 

commit 6ad6b6f900e9c3a55e4ee509bdc9ff0ddec9a59a
Author: Peter Hutterer <peter.hutte...@redhat.com>
Date:   Wed Nov 19 15:50:57 2008 +1000

    Xi: add XIPropToInt() auxiliary function.
    
    Converts an XIPropertyValuePtr to an integer, provided that type and format 
is
    right.
    
    Code originally written by Simon Thum.
    
    Signed-off-by: Peter Hutterer <peter.hutte...@redhat.com>
    (cherry picked from commit 669f6810af9a89187d6149841925fe765f3988ff)

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 01db856..0c2475b 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -32,6 +32,7 @@
 #include "dix.h"
 #include "inputstr.h"
 #include <X11/extensions/XI.h>
+#include <X11/Xatom.h>
 #include <X11/extensions/XIproto.h>
 #include "exglobals.h"
 #include "exevents.h"
@@ -71,6 +72,73 @@ XIGetKnownProperty(char *name)
 }
 
 /**
+ * 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
+ * values in the property, @nelem_return is set to the number of values in the
+ * property.
+ *
+ * If *...@buf_return is NULL and @nelem_return is 0, memory is allocated
+ * automatically and must be freed by the caller.
+ *
+ * Possible return codes.
+ * Success ... No error.
+ * BadMatch ... Wrong atom type, atom is not XA_INTEGER
+ * BadAlloc ... NULL passed as buffer and allocation failed.
+ * BadLength ... @buff is NULL but @nelem_return is non-zero.
+ *
+ * @param val The property value
+ * @param nelem_return The maximum number of elements to return.
+ * @param buf_return Pointer to an array of at least @nelem_return values.
+ * @return Success or the error code if an error occured.
+ */
+_X_EXPORT int
+XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
+{
+    int i;
+    int *buf;


-- 
To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to