diff options
author | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-06 18:48:27 +0000 |
commit | a915739887477b28d924ecc8417ee107d125bd6c (patch) | |
tree | c02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/composite/compext.c | |
parent | 6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff) | |
download | vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2 vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip |
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/composite/compext.c')
-rw-r--r-- | xorg-server/composite/compext.c | 136 |
1 files changed, 59 insertions, 77 deletions
diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c index 4fff20efa..56b4f2784 100644 --- a/xorg-server/composite/compext.c +++ b/xorg-server/composite/compext.c @@ -1,23 +1,30 @@ /* - * Copyright © 2006 Sun Microsystems + * Copyright © 2006 Sun Microsystems, Inc. All rights reserved. * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Sun Microsystems not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Sun Microsystems makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. + * 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, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. * - * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS 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 + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL + * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. * * Copyright © 2003 Keith Packard * @@ -136,21 +143,30 @@ ProcCompositeQueryVersion (ClientPtr client) return(client->noClientException); } +#define VERIFY_WINDOW(pWindow, wid, client, mode) \ + do { \ + int err; \ + err = dixLookupResourceByType((pointer *) &pWindow, wid, \ + RT_WINDOW, client, mode); \ + if (err == BadValue) { \ + client->errorValue = wid; \ + return BadWindow; \ + } else if (err != Success) { \ + client->errorValue = wid; \ + return err; \ + } \ + } while (0) + static int ProcCompositeRedirectWindow (ClientPtr client) { WindowPtr pWin; - int rc; REQUEST(xCompositeRedirectWindowReq); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); - rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, - DixSetAttrAccess|DixManageAccess|DixBlendAccess); - if (rc != Success) - { - client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; - } + VERIFY_WINDOW(pWin, stuff->window, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + return compRedirectWindow (client, pWin, stuff->update); } @@ -158,17 +174,12 @@ static int ProcCompositeRedirectSubwindows (ClientPtr client) { WindowPtr pWin; - int rc; REQUEST(xCompositeRedirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); - rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, - DixSetAttrAccess|DixManageAccess|DixBlendAccess); - if (rc != Success) - { - client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; - } + VERIFY_WINDOW(pWin, stuff->window, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + return compRedirectSubwindows (client, pWin, stuff->update); } @@ -179,12 +190,9 @@ ProcCompositeUnredirectWindow (ClientPtr client) REQUEST(xCompositeUnredirectWindowReq); REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { - client->errorValue = stuff->window; - return BadWindow; - } + VERIFY_WINDOW(pWin, stuff->window, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + return compUnredirectWindow (client, pWin, stuff->update); } @@ -195,12 +203,9 @@ ProcCompositeUnredirectSubwindows (ClientPtr client) REQUEST(xCompositeUnredirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { - client->errorValue = stuff->window; - return BadWindow; - } + VERIFY_WINDOW(pWin, stuff->window, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + return compUnredirectSubwindows (client, pWin, stuff->update); } @@ -210,18 +215,10 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client) WindowPtr pWin; CompWindowPtr cw; RegionPtr pBorderClip, pRegion; - int rc; REQUEST(xCompositeCreateRegionFromBorderClipReq); REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq); - rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, - DixGetAttrAccess); - if (rc != Success) - { - client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; - } - + VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); LEGAL_NEW_RESOURCE (stuff->region, client); cw = GetCompWindow (pWin); @@ -250,13 +247,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client) REQUEST(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); - rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, - DixGetAttrAccess); - if (rc != Success) - { - client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; - } + VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); if (!pWin->viewable) return BadMatch; @@ -298,13 +289,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client) int rc; REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); - rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, - DixGetAttrAccess); - if (rc != Success) - { - client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; - } + VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); pScreen = pWin->drawable.pScreen; /* @@ -360,12 +345,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) CompOverlayClientPtr pOc; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { - client->errorValue = stuff->window; - return BadWindow; - } + VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); pScreen = pWin->drawable.pScreen; /* @@ -589,9 +569,14 @@ CompositeExtensionInit (void) if (!dixRequestPrivate(CompositeClientPrivateKey, sizeof(CompositeClientRec))) return; + if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0)) return; + for (s = 0; s < screenInfo.numScreens; s++) + if (!compScreenInit (screenInfo.screens[s])) + return; + extEntry = AddExtension (COMPOSITE_NAME, 0, 0, ProcCompositeDispatch, SProcCompositeDispatch, NULL, StandardMinorOpcode); @@ -599,9 +584,6 @@ CompositeExtensionInit (void) return; CompositeReqCode = (CARD8) extEntry->base; - for (s = 0; s < screenInfo.numScreens; s++) - if (!compScreenInit (screenInfo.screens[s])) - return; miRegisterRedirectBorderClipProc (compSetRedirectBorderClip, compGetRedirectBorderClip); |