saveset.c revision 4642e01f
105b261ecSmrg/*
205b261ecSmrg * Copyright © 2002 Keith Packard
305b261ecSmrg *
405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
605b261ecSmrg * the above copyright notice appear in all copies and that both that
705b261ecSmrg * copyright notice and this permission notice appear in supporting
805b261ecSmrg * documentation, and that the name of Keith Packard not be used in
905b261ecSmrg * advertising or publicity pertaining to distribution of the software without
1005b261ecSmrg * specific, written prior permission.  Keith Packard makes no
1105b261ecSmrg * representations about the suitability of this software for any purpose.  It
1205b261ecSmrg * is provided "as is" without express or implied warranty.
1305b261ecSmrg *
1405b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1605b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2005b261ecSmrg * PERFORMANCE OF THIS SOFTWARE.
2105b261ecSmrg */
2205b261ecSmrg
2305b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
2405b261ecSmrg#include <dix-config.h>
2505b261ecSmrg#endif
2605b261ecSmrg
2705b261ecSmrg#include "xfixesint.h"
2805b261ecSmrg
2905b261ecSmrgint
3005b261ecSmrgProcXFixesChangeSaveSet(ClientPtr client)
3105b261ecSmrg{
324642e01fSmrg    Bool	toRoot, map;
3305b261ecSmrg    int		result;
3405b261ecSmrg    WindowPtr	pWin;
3505b261ecSmrg    REQUEST(xXFixesChangeSaveSetReq);
3605b261ecSmrg
3705b261ecSmrg    REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
384642e01fSmrg    result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
3905b261ecSmrg    if (result != Success)
4005b261ecSmrg        return result;
4105b261ecSmrg    if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
4205b261ecSmrg        return BadMatch;
4305b261ecSmrg    if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))
4405b261ecSmrg    {
4505b261ecSmrg	client->errorValue = stuff->mode;
4605b261ecSmrg	return( BadValue );
4705b261ecSmrg    }
4805b261ecSmrg    if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot))
4905b261ecSmrg    {
5005b261ecSmrg	client->errorValue = stuff->target;
5105b261ecSmrg	return( BadValue );
5205b261ecSmrg    }
5305b261ecSmrg    if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap))
5405b261ecSmrg    {
5505b261ecSmrg	client->errorValue = stuff->map;
5605b261ecSmrg	return( BadValue );
5705b261ecSmrg    }
5805b261ecSmrg    toRoot = (stuff->target == SaveSetRoot);
594642e01fSmrg    map = (stuff->map == SaveSetMap);
604642e01fSmrg    result = AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, map);
6105b261ecSmrg    if (client->noClientException != Success)
6205b261ecSmrg	return(client->noClientException);
6305b261ecSmrg    else
6405b261ecSmrg	return(result);
6505b261ecSmrg}
6605b261ecSmrg
6705b261ecSmrgint
6805b261ecSmrgSProcXFixesChangeSaveSet(ClientPtr client)
6905b261ecSmrg{
7005b261ecSmrg    register int n;
7105b261ecSmrg    REQUEST(xXFixesChangeSaveSetReq);
7205b261ecSmrg
7305b261ecSmrg    swaps(&stuff->length, n);
7405b261ecSmrg    swapl(&stuff->window, n);
754642e01fSmrg    return (*ProcXFixesVector[stuff->xfixesReqType])(client);
7605b261ecSmrg}
77