2006-11-26 11:13:41 -07:00
|
|
|
/*
|
2011-11-05 07:32:40 -06:00
|
|
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
2010-07-27 13:02:24 -06:00
|
|
|
* 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:
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
2010-07-27 13:02:24 -06:00
|
|
|
* 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.
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
|
|
|
* Copyright © 2003 Keith Packard
|
|
|
|
*
|
|
|
|
* 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 Keith Packard not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL KEITH PACKARD 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "compint.h"
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "xace.h"
|
2010-07-27 13:02:24 -06:00
|
|
|
#include "protocol-versions.h"
|
2013-06-07 11:28:45 -06:00
|
|
|
#include "extinit.h"
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static CARD8 CompositeReqCode;
|
2010-12-05 08:36:02 -07:00
|
|
|
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
|
2012-06-10 07:21:05 -06:00
|
|
|
RESTYPE CompositeClientWindowType;
|
|
|
|
RESTYPE CompositeClientSubwindowsType;
|
|
|
|
RESTYPE CompositeClientOverlayType;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
typedef struct _CompositeClient {
|
2012-06-10 07:21:05 -06:00
|
|
|
int major_version;
|
|
|
|
int minor_version;
|
2006-11-26 11:13:41 -07:00
|
|
|
} CompositeClientRec, *CompositeClientPtr;
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define GetCompositeClient(pClient) ((CompositeClientPtr) \
|
|
|
|
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
FreeCompositeClientWindow(void *value, XID ccwid)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin = value;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
compFreeClientWindow(pWin, ccwid);
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
FreeCompositeClientSubwindows(void *value, XID ccwid)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin = value;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
compFreeClientSubwindows(pWin, ccwid);
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
FreeCompositeClientOverlay(void *value, XID ccwid)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
compFreeOverlayClient(pOc);
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CompositeClientPtr pCompositeClient = GetCompositeClient(client);
|
2013-06-07 11:28:45 -06:00
|
|
|
xCompositeQueryVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeQueryVersionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
|
2012-06-10 07:21:05 -06:00
|
|
|
rep.majorVersion = stuff->majorVersion;
|
|
|
|
rep.minorVersion = stuff->minorVersion;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
|
2010-07-27 13:02:24 -06:00
|
|
|
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
pCompositeClient->major_version = rep.majorVersion;
|
|
|
|
pCompositeClient->minor_version = rep.minorVersion;
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.majorVersion);
|
|
|
|
swapl(&rep.minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xCompositeQueryVersionReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define VERIFY_WINDOW(pWindow, wid, client, mode) \
|
|
|
|
do { \
|
|
|
|
int err; \
|
2014-09-27 11:52:59 -06:00
|
|
|
err = dixLookupResourceByType((void **) &pWindow, wid, \
|
2010-07-27 13:02:24 -06:00
|
|
|
RT_WINDOW, client, mode); \
|
2010-12-05 08:36:02 -07:00
|
|
|
if (err != Success) { \
|
2010-07-27 13:02:24 -06:00
|
|
|
client->errorValue = wid; \
|
|
|
|
return err; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeRedirectWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeRedirectWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return compRedirectWindow(client, pWin, stuff->update);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeRedirectSubwindows(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return compRedirectSubwindows(client, pWin, stuff->update);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeUnredirectWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeUnredirectWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return compUnredirectWindow(client, pWin, stuff->update);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixSetAttrAccess | DixManageAccess | DixBlendAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return compUnredirectSubwindows(client, pWin, stuff->update);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeCreateRegionFromBorderClip(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
CompWindowPtr cw;
|
|
|
|
RegionPtr pBorderClip, pRegion;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
2012-06-10 07:21:05 -06:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
|
|
|
|
|
|
|
cw = GetCompWindow(pWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (cw)
|
2012-06-10 07:21:05 -06:00
|
|
|
pBorderClip = &cw->borderClip;
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
pBorderClip = &pWin->borderClip;
|
|
|
|
pRegion = XFixesRegionCopy(pBorderClip);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pRegion)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeNameWindowPixmap(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
CompWindowPtr cw;
|
|
|
|
PixmapPtr pPixmap;
|
2014-09-27 11:52:59 -06:00
|
|
|
ScreenPtr pScreen;
|
2008-11-02 08:26:08 -07:00
|
|
|
int rc;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCompositeNameWindowPixmapReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
2007-03-03 04:09:19 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
|
2007-03-03 04:09:19 -07:00
|
|
|
if (!pWin->viewable)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2007-03-03 04:09:19 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->pixmap, client);
|
|
|
|
|
|
|
|
cw = GetCompWindow(pWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!cw)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pPixmap)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
/* security creation/labeling check */
|
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,
|
2012-06-10 07:21:05 -06:00
|
|
|
pPixmap, RT_WINDOW, pWin, DixCreateAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
++pPixmap->refcnt;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (pScreen->NameWindowPixmap) {
|
|
|
|
rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
|
|
|
|
if (rc != Success) {
|
|
|
|
FreeResource(stuff->pixmap, RT_NONE);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeGetOverlayWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xCompositeGetOverlayWindowReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
xCompositeGetOverlayWindowReply rep;
|
|
|
|
WindowPtr pWin;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
CompScreenPtr cs;
|
|
|
|
CompOverlayClientPtr pOc;
|
2008-11-02 08:26:08 -07:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2009-09-06 13:44:18 -06:00
|
|
|
* Create an OverlayClient structure to mark this client's
|
|
|
|
* interest in the overlay window
|
|
|
|
*/
|
|
|
|
pOc = compCreateOverlayClient(pScreen, client);
|
|
|
|
if (pOc == NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure the overlay window exists
|
|
|
|
*/
|
2006-11-26 11:13:41 -07:00
|
|
|
cs = GetCompScreen(pScreen);
|
2009-09-06 13:44:18 -06:00
|
|
|
if (cs->pOverlayWin == NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!compCreateOverlayWindow(pScreen)) {
|
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2008-11-02 08:26:08 -07:00
|
|
|
|
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
|
2012-06-10 07:21:05 -06:00
|
|
|
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xCompositeGetOverlayWindowReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.overlayWin = cs->pOverlayWin->drawable.id
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.overlayWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeReleaseOverlayWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xCompositeReleaseOverlayWindowReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
WindowPtr pWin;
|
|
|
|
CompOverlayClientPtr pOc;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Has client queried a reference to the overlay window
|
|
|
|
* on this screen? If not, generate an error.
|
|
|
|
*/
|
2012-06-10 07:21:05 -06:00
|
|
|
pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
|
2009-09-06 13:44:18 -06:00
|
|
|
if (pOc == NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* The delete function will free the client structure */
|
2012-06-10 07:21:05 -06:00
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static int (*ProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
|
|
|
|
ProcCompositeQueryVersion,
|
|
|
|
ProcCompositeRedirectWindow,
|
|
|
|
ProcCompositeRedirectSubwindows,
|
|
|
|
ProcCompositeUnredirectWindow,
|
|
|
|
ProcCompositeUnredirectSubwindows,
|
|
|
|
ProcCompositeCreateRegionFromBorderClip,
|
|
|
|
ProcCompositeNameWindowPixmap,
|
|
|
|
ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (stuff->data < CompositeNumberRequests)
|
2012-06-10 07:21:05 -06:00
|
|
|
return (*ProcCompositeVector[stuff->data]) (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeQueryVersionReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->majorVersion);
|
|
|
|
swapl(&stuff->minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeRedirectWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeRedirectWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeRedirectSubwindows(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeUnredirectWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeUnredirectWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeUnredirectSubwindows(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeCreateRegionFromBorderClip(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeNameWindowPixmap(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeNameWindowPixmapReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
|
|
|
swapl(&stuff->pixmap);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeGetOverlayWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeGetOverlayWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeReleaseOverlayWindow(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeReleaseOverlayWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static int (*SProcCompositeVector[CompositeNumberRequests]) (ClientPtr) = {
|
|
|
|
SProcCompositeQueryVersion,
|
|
|
|
SProcCompositeRedirectWindow,
|
|
|
|
SProcCompositeRedirectSubwindows,
|
|
|
|
SProcCompositeUnredirectWindow,
|
|
|
|
SProcCompositeUnredirectSubwindows,
|
|
|
|
SProcCompositeCreateRegionFromBorderClip,
|
|
|
|
SProcCompositeNameWindowPixmap,
|
|
|
|
SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcCompositeDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (stuff->data < CompositeNumberRequests)
|
2012-06-10 07:21:05 -06:00
|
|
|
return (*SProcCompositeVector[stuff->data]) (client);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
/** @see GetDefaultBytes */
|
2017-12-08 08:01:59 -07:00
|
|
|
static SizeType coreGetWindowBytes;
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
static void
|
2017-12-08 08:01:59 -07:00
|
|
|
GetCompositeWindowBytes(void *value, XID id, ResourceSizePtr size)
|
2013-06-07 11:28:45 -06:00
|
|
|
{
|
|
|
|
WindowPtr window = value;
|
|
|
|
|
2017-12-08 08:01:59 -07:00
|
|
|
/* call down */
|
|
|
|
coreGetWindowBytes(value, id, size);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
2017-12-08 08:01:59 -07:00
|
|
|
/* account for redirection */
|
2013-06-07 11:28:45 -06:00
|
|
|
if (window->redirectDraw != RedirectDrawNone)
|
|
|
|
{
|
|
|
|
SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP);
|
|
|
|
ResourceSizeRec pixmapSize = { 0, 0 };
|
|
|
|
ScreenPtr screen = window->drawable.pScreen;
|
|
|
|
PixmapPtr pixmap = screen->GetWindowPixmap(window);
|
|
|
|
pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize);
|
|
|
|
size->pixmapRefSize += pixmapSize.pixmapRefSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
CompositeExtensionInit(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ExtensionEntry *extEntry;
|
|
|
|
int s;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2007-12-13 14:06:02 -07:00
|
|
|
/* Assume initialization is going to fail */
|
|
|
|
noCompositeExtension = TRUE;
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
for (s = 0; s < screenInfo.numScreens; s++) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[s];
|
|
|
|
VisualPtr vis;
|
|
|
|
|
|
|
|
/* Composite on 8bpp pseudocolor root windows appears to fail, so
|
|
|
|
* just disable it on anything pseudocolor for safety.
|
|
|
|
*/
|
|
|
|
for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++);
|
|
|
|
if ((vis->class | DynamicClass) == PseudoColor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Ensure that Render is initialized, which is required for automatic
|
|
|
|
* compositing.
|
|
|
|
*/
|
|
|
|
if (GetPictureScreenIfSet(pScreen) == NULL)
|
|
|
|
return;
|
2007-11-24 10:55:21 -07:00
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
CompositeClientWindowType = CreateNewResourceType
|
2012-06-10 07:21:05 -06:00
|
|
|
(FreeCompositeClientWindow, "CompositeClientWindow");
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!CompositeClientWindowType)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2017-12-08 08:01:59 -07:00
|
|
|
coreGetWindowBytes = GetResourceTypeSizeFunc(RT_WINDOW);
|
|
|
|
SetResourceTypeSizeFunc(RT_WINDOW, GetCompositeWindowBytes);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
CompositeClientSubwindowsType = CreateNewResourceType
|
2012-06-10 07:21:05 -06:00
|
|
|
(FreeCompositeClientSubwindows, "CompositeClientSubwindows");
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!CompositeClientSubwindowsType)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
CompositeClientOverlayType = CreateNewResourceType
|
2012-06-10 07:21:05 -06:00
|
|
|
(FreeCompositeClientOverlay, "CompositeClientOverlay");
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!CompositeClientOverlayType)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if (!dixRegisterPrivateKey(&CompositeClientPrivateKeyRec, PRIVATE_CLIENT,
|
2012-06-10 07:21:05 -06:00
|
|
|
sizeof(CompositeClientRec)))
|
|
|
|
return;
|
2010-07-27 13:02:24 -06:00
|
|
|
|
|
|
|
for (s = 0; s < screenInfo.numScreens; s++)
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!compScreenInit(screenInfo.screens[s]))
|
|
|
|
return;
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
extEntry = AddExtension(COMPOSITE_NAME, 0, 0,
|
|
|
|
ProcCompositeDispatch, SProcCompositeDispatch,
|
|
|
|
NULL, StandardMinorOpcode);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!extEntry)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
CompositeReqCode = (CARD8) extEntry->base;
|
|
|
|
|
2007-12-13 14:06:02 -07:00
|
|
|
/* Initialization succeeded */
|
|
|
|
noCompositeExtension = FALSE;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
#include "panoramiXsrv.h"
|
|
|
|
|
|
|
|
int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr);
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeRedirectWindow(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
int rc = 0, j;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST(xCompositeRedirectWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
if (rc != Success)
|
|
|
|
break;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeRedirectSubwindows(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
int rc = 0, j;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
if (rc != Success)
|
|
|
|
break;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeUnredirectWindow(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
int rc = 0, j;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST(xCompositeUnredirectWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
if (rc != Success)
|
|
|
|
break;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeUnredirectSubwindows(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
int rc = 0, j;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
|
|
|
if (rc != Success)
|
|
|
|
break;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeNameWindowPixmap(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
CompWindowPtr cw;
|
|
|
|
PixmapPtr pPixmap;
|
2011-11-05 07:32:40 -06:00
|
|
|
int rc;
|
|
|
|
PanoramiXRes *win, *newPix;
|
|
|
|
int i;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST(xCompositeNameWindowPixmapReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->pixmap, client);
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!(newPix = malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
newPix->type = XRT_PIXMAP;
|
|
|
|
newPix->u.pix.shared = FALSE;
|
|
|
|
panoramix_setup_ids(newPix, client, stuff->pixmap);
|
|
|
|
|
|
|
|
FOR_NSCREENS(i) {
|
2012-06-10 07:21:05 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
|
|
|
RT_WINDOW, client, DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
free(newPix);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pWin->viewable) {
|
|
|
|
free(newPix);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
cw = GetCompWindow(pWin);
|
|
|
|
if (!cw) {
|
|
|
|
free(newPix);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
|
|
|
|
if (!pPixmap) {
|
|
|
|
free(newPix);
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
++pPixmap->refcnt;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(stuff->pixmap, XRT_PIXMAP, (void *) newPix))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeGetOverlayWindowReq);
|
|
|
|
xCompositeGetOverlayWindowReply rep;
|
|
|
|
WindowPtr pWin;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
CompScreenPtr cs;
|
|
|
|
CompOverlayClientPtr pOc;
|
|
|
|
int rc;
|
|
|
|
PanoramiXRes *win, *overlayWin = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
cs = GetCompScreen(screenInfo.screens[0]);
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!cs->pOverlayWin) {
|
|
|
|
if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
|
|
|
|
return BadAlloc;
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
overlayWin->type = XRT_WINDOW;
|
|
|
|
overlayWin->u.win.root = FALSE;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(i) {
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
2012-06-10 07:21:05 -06:00
|
|
|
RT_WINDOW, client, DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->window;
|
2014-05-02 13:27:46 -06:00
|
|
|
free(overlayWin);
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create an OverlayClient structure to mark this client's
|
|
|
|
* interest in the overlay window
|
|
|
|
*/
|
|
|
|
pOc = compCreateOverlayClient(pScreen, client);
|
2014-05-02 13:27:46 -06:00
|
|
|
if (pOc == NULL) {
|
|
|
|
free(overlayWin);
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2014-05-02 13:27:46 -06:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure the overlay window exists
|
|
|
|
*/
|
|
|
|
cs = GetCompScreen(pScreen);
|
|
|
|
if (cs->pOverlayWin == NULL)
|
|
|
|
if (!compCreateOverlayWindow(pScreen)) {
|
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
2014-05-02 13:27:46 -06:00
|
|
|
free(overlayWin);
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client,
|
|
|
|
cs->pOverlayWin->drawable.id,
|
|
|
|
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
|
|
|
|
DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
2014-05-02 13:27:46 -06:00
|
|
|
free(overlayWin);
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
|
|
|
}
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (overlayWin) {
|
|
|
|
FOR_NSCREENS(i) {
|
|
|
|
cs = GetCompScreen(screenInfo.screens[i]);
|
|
|
|
overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
|
|
|
|
}
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
cs = GetCompScreen(screenInfo.screens[0]);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xCompositeGetOverlayWindowReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.overlayWin = cs->pOverlayWin->drawable.id
|
|
|
|
};
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.overlayWin);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep);
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeReleaseOverlayWindow(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
REQUEST(xCompositeReleaseOverlayWindowReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
CompOverlayClientPtr pOc;
|
|
|
|
PanoramiXRes *win;
|
|
|
|
int i, rc;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW,
|
|
|
|
client, DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(i) {
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
|
|
|
XRT_WINDOW, client,
|
|
|
|
DixUnknownAccess))) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Has client queried a reference to the overlay window
|
|
|
|
* on this screen? If not, generate an error.
|
|
|
|
*/
|
|
|
|
pOc = compFindOverlayClient(pWin->drawable.pScreen, client);
|
|
|
|
if (pOc == NULL)
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
/* The delete function will free the client structure */
|
|
|
|
FreeResource(pOc->resource, RT_NONE);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeInit(void)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < CompositeNumberRequests; i++)
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i];
|
2011-11-05 07:32:40 -06:00
|
|
|
/*
|
|
|
|
* Stuff in Xinerama aware request processing hooks
|
|
|
|
*/
|
|
|
|
ProcCompositeVector[X_CompositeRedirectWindow] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeRedirectWindow;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeRedirectSubwindows] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeRedirectSubwindows;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeUnredirectWindow] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeUnredirectWindow;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeUnredirectSubwindows] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeUnredirectSubwindows;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeNameWindowPixmap] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeNameWindowPixmap;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeGetOverlayWindow] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeGetOverlayWindow;
|
2011-11-05 07:32:40 -06:00
|
|
|
ProcCompositeVector[X_CompositeReleaseOverlayWindow] =
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeReleaseOverlayWindow;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXCompositeReset(void)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < CompositeNumberRequests; i++)
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i];
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|