2006-11-26 11:13:41 -07:00
|
|
|
/*****************************************************************
|
|
|
|
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
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.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice 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
|
|
|
|
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
|
|
|
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of Digital Equipment Corporation
|
|
|
|
shall not be used in advertising or otherwise to promote the sale, use or other
|
|
|
|
dealings in this Software without prior written authorization from Digital
|
|
|
|
Equipment Corporation.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "dixfontstr.h"
|
|
|
|
#include "gcstruct.h"
|
|
|
|
#include "colormapst.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "opaque.h"
|
|
|
|
#include "inputstr.h"
|
|
|
|
#include "migc.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "panoramiX.h"
|
|
|
|
#include "panoramiXsrv.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "panoramiXh.h"
|
|
|
|
|
|
|
|
#define XINERAMA_IMAGE_BUFSIZE (256*1024)
|
|
|
|
#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
|
|
|
|
CWDontPropagate | CWOverrideRedirect | CWCursor )
|
|
|
|
|
|
|
|
int PanoramiXCreateWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *parent, *newWin;
|
|
|
|
PanoramiXRes *backPix = NULL;
|
|
|
|
PanoramiXRes *bordPix = NULL;
|
|
|
|
PanoramiXRes *cmap = NULL;
|
|
|
|
REQUEST(xCreateWindowReq);
|
|
|
|
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, len, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
int orig_x, orig_y;
|
|
|
|
XID orig_visual, tmp;
|
|
|
|
Bool parentIsRoot;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (Ones(stuff->mask) != len)
|
|
|
|
return BadLength;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(stuff->class == CopyFromParent)
|
|
|
|
stuff->class = parent->u.win.class;
|
|
|
|
|
|
|
|
if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK)))
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
if ((Mask)stuff->mask & CWBackPixmap) {
|
|
|
|
pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + pback_offset);
|
|
|
|
if ((tmp != None) && (tmp != ParentRelative)) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&backPix, tmp,
|
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & CWBorderPixmap) {
|
|
|
|
pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
|
|
|
|
if (tmp != CopyFromParent) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&bordPix, tmp,
|
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & CWColormap) {
|
|
|
|
cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
|
|
|
if ((tmp != CopyFromParent) && (tmp != None)) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, tmp,
|
|
|
|
XRT_COLORMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(newWin = malloc(sizeof(PanoramiXRes))))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
newWin->type = XRT_WINDOW;
|
|
|
|
newWin->u.win.visibility = VisibilityNotViewable;
|
|
|
|
newWin->u.win.class = stuff->class;
|
|
|
|
newWin->u.win.root = FALSE;
|
|
|
|
newWin->info[0].id = stuff->wid;
|
|
|
|
for(j = 1; j < PanoramiXNumScreens; j++)
|
|
|
|
newWin->info[j].id = FakeClientID(client->index);
|
|
|
|
|
|
|
|
if (stuff->class == InputOnly)
|
|
|
|
stuff->visual = CopyFromParent;
|
|
|
|
orig_visual = stuff->visual;
|
|
|
|
orig_x = stuff->x;
|
|
|
|
orig_y = stuff->y;
|
2010-12-05 08:36:02 -07:00
|
|
|
parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
|
|
|
|
(stuff->parent == screenInfo.screens[0]->screensaver.wid);
|
2006-11-26 11:13:41 -07:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->wid = newWin->info[j].id;
|
|
|
|
stuff->parent = parent->info[j].id;
|
|
|
|
if (parentIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (backPix)
|
|
|
|
*((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
|
|
|
|
if (bordPix)
|
|
|
|
*((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
|
|
|
|
if (cmap)
|
|
|
|
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
|
|
|
|
if ( orig_visual != CopyFromParent )
|
2008-11-02 08:26:08 -07:00
|
|
|
stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
|
2006-11-26 11:13:41 -07:00
|
|
|
result = (*SavedProcVector[X_CreateWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
|
|
|
AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
|
|
|
|
else
|
2010-12-05 08:36:02 -07:00
|
|
|
free(newWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXChangeWindowAttributes(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
PanoramiXRes *backPix = NULL;
|
|
|
|
PanoramiXRes *bordPix = NULL;
|
|
|
|
PanoramiXRes *cmap = NULL;
|
|
|
|
REQUEST(xChangeWindowAttributesReq);
|
|
|
|
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, len, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
XID tmp;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xChangeWindowAttributesReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (Ones(stuff->valueMask) != len)
|
|
|
|
return BadLength;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if((win->u.win.class == InputOnly) &&
|
|
|
|
(stuff->valueMask & (~INPUTONLY_LEGAL_MASK)))
|
|
|
|
return BadMatch;
|
|
|
|
|
|
|
|
if ((Mask)stuff->valueMask & CWBackPixmap) {
|
|
|
|
pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + pback_offset);
|
|
|
|
if ((tmp != None) && (tmp != ParentRelative)) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&backPix, tmp,
|
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->valueMask & CWBorderPixmap) {
|
|
|
|
pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
|
|
|
|
if (tmp != CopyFromParent) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&bordPix, tmp,
|
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->valueMask & CWColormap) {
|
|
|
|
cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1));
|
|
|
|
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
|
|
|
if ((tmp != CopyFromParent) && (tmp != None)) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, tmp,
|
|
|
|
XRT_COLORMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
if (backPix)
|
|
|
|
*((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
|
|
|
|
if (bordPix)
|
|
|
|
*((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
|
|
|
|
if (cmap)
|
|
|
|
*((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXDestroyWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
|
|
|
|
client, DixDestroyAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_DestroyWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Since ProcDestroyWindow is using FreeResource, it will free
|
|
|
|
our resource for us on the last pass through the loop above */
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXDestroySubwindows(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
|
|
|
|
client, DixDestroyAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_DestroySubwindows])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DestroySubwindows is using FreeResource which will free
|
|
|
|
our resources for us on the last pass through the loop above */
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXChangeSaveSet(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xChangeSaveSetReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_ChangeSaveSet])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXReparentWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win, *parent;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
int x, y;
|
|
|
|
Bool parentIsRoot;
|
|
|
|
REQUEST(xReparentWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xReparentWindowReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
x = stuff->x;
|
|
|
|
y = stuff->y;
|
2010-12-05 08:36:02 -07:00
|
|
|
parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
|
|
|
|
(stuff->parent == screenInfo.screens[0]->screensaver.wid);
|
2006-11-26 11:13:41 -07:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
stuff->parent = parent->info[j].id;
|
|
|
|
if(parentIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_ReparentWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXMapWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_MapWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXMapSubwindows(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_MapSubwindows])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXUnmapWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_UnmapWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXUnmapSubwindows(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->id,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->id = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_UnmapSubwindows])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXConfigureWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
|
|
|
PanoramiXRes *sib = NULL;
|
|
|
|
WindowPtr pWin;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j, len, sib_offset = 0, x = 0, y = 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
int x_offset = -1;
|
|
|
|
int y_offset = -1;
|
|
|
|
REQUEST(xConfigureWindowReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xConfigureWindowReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (Ones(stuff->mask) != len)
|
|
|
|
return BadLength;
|
|
|
|
|
|
|
|
/* because we need the parent */
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&pWin, stuff->window,
|
|
|
|
RT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if ((Mask)stuff->mask & CWSibling) {
|
|
|
|
XID tmp;
|
|
|
|
sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
|
|
|
|
(pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid)))
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
if ((Mask)stuff->mask & CWX) {
|
|
|
|
x_offset = 0;
|
|
|
|
x = *((CARD32 *)&stuff[1]);
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & CWY) {
|
|
|
|
y_offset = (x_offset == -1) ? 0 : 1;
|
|
|
|
y = *((CARD32 *) &stuff[1] + y_offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* have to go forward or you get expose events before
|
|
|
|
ConfigureNotify events */
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
if(sib)
|
|
|
|
*((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id;
|
|
|
|
if(x_offset >= 0)
|
2010-12-05 08:36:02 -07:00
|
|
|
*((CARD32 *) &stuff[1] + x_offset) = x - screenInfo.screens[j]->x;
|
2006-11-26 11:13:41 -07:00
|
|
|
if(y_offset >= 0)
|
2010-12-05 08:36:02 -07:00
|
|
|
*((CARD32 *) &stuff[1] + y_offset) = y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
result = (*SavedProcVector[X_ConfigureWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXCirculateWindow(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCirculateWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCirculateWindowReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_CirculateWindow])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXGetGeometry(ClientPtr client)
|
|
|
|
{
|
|
|
|
xGetGeometryReply rep;
|
|
|
|
DrawablePtr pDraw;
|
2007-11-24 10:55:21 -07:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2010-12-05 08:36:02 -07:00
|
|
|
rep.root = screenInfo.screens[0]->root->drawable.id;
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.depth = pDraw->depth;
|
|
|
|
rep.width = pDraw->width;
|
|
|
|
rep.height = pDraw->height;
|
|
|
|
rep.x = rep.y = rep.borderWidth = 0;
|
|
|
|
|
|
|
|
if (stuff->id == rep.root) {
|
|
|
|
xWindowRoot *root = (xWindowRoot *)
|
|
|
|
(ConnectionInfo + connBlockScreenStart);
|
|
|
|
|
|
|
|
rep.width = root->pixWidth;
|
|
|
|
rep.height = root->pixHeight;
|
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
if (WindowDrawable(pDraw->type))
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
WindowPtr pWin = (WindowPtr)pDraw;
|
|
|
|
rep.x = pWin->origin.x - wBorderWidth (pWin);
|
|
|
|
rep.y = pWin->origin.y - wBorderWidth (pWin);
|
2010-12-05 08:36:02 -07:00
|
|
|
if((pWin->parent == screenInfo.screens[0]->root) ||
|
|
|
|
(pWin->parent->drawable.id == screenInfo.screens[0]->screensaver.wid))
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2010-12-05 08:36:02 -07:00
|
|
|
rep.x += screenInfo.screens[0]->x;
|
|
|
|
rep.y += screenInfo.screens[0]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
rep.borderWidth = pWin->borderWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int PanoramiXTranslateCoords(ClientPtr client)
|
|
|
|
{
|
|
|
|
INT16 x, y;
|
|
|
|
REQUEST(xTranslateCoordsReq);
|
2007-11-24 10:55:21 -07:00
|
|
|
int rc;
|
|
|
|
WindowPtr pWin, pDst;
|
2006-11-26 11:13:41 -07:00
|
|
|
xTranslateCoordsReply rep;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
|
2007-11-24 10:55:21 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.sameScreen = xTrue;
|
|
|
|
rep.child = None;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if((pWin == screenInfo.screens[0]->root) ||
|
|
|
|
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid))
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2010-12-05 08:36:02 -07:00
|
|
|
x = stuff->srcX - screenInfo.screens[0]->x;
|
|
|
|
y = stuff->srcY - screenInfo.screens[0]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else {
|
|
|
|
x = pWin->drawable.x + stuff->srcX;
|
|
|
|
y = pWin->drawable.y + stuff->srcY;
|
|
|
|
}
|
|
|
|
pWin = pDst->firstChild;
|
|
|
|
while (pWin) {
|
|
|
|
BoxRec box;
|
|
|
|
if ((pWin->mapped) &&
|
|
|
|
(x >= pWin->drawable.x - wBorderWidth (pWin)) &&
|
|
|
|
(x < pWin->drawable.x + (int)pWin->drawable.width +
|
|
|
|
wBorderWidth (pWin)) &&
|
|
|
|
(y >= pWin->drawable.y - wBorderWidth (pWin)) &&
|
|
|
|
(y < pWin->drawable.y + (int)pWin->drawable.height +
|
|
|
|
wBorderWidth (pWin))
|
|
|
|
/* When a window is shaped, a further check
|
|
|
|
* is made to see if the point is inside
|
|
|
|
* borderSize
|
|
|
|
*/
|
|
|
|
&& (!wBoundingShape(pWin) ||
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionContainsPoint(wBoundingShape(pWin),
|
2006-11-26 11:13:41 -07:00
|
|
|
x - pWin->drawable.x,
|
|
|
|
y - pWin->drawable.y, &box))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
rep.child = pWin->drawable.id;
|
|
|
|
pWin = (WindowPtr) NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pWin = pWin->nextSib;
|
|
|
|
}
|
|
|
|
rep.dstX = x - pDst->drawable.x;
|
|
|
|
rep.dstY = y - pDst->drawable.y;
|
2010-12-05 08:36:02 -07:00
|
|
|
if((pDst == screenInfo.screens[0]->root) ||
|
2010-12-21 13:10:44 -07:00
|
|
|
(pDst->drawable.id == screenInfo.screens[0]->screensaver.wid))
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2010-12-05 08:36:02 -07:00
|
|
|
rep.dstX += screenInfo.screens[0]->x;
|
|
|
|
rep.dstY += screenInfo.screens[0]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int PanoramiXCreatePixmap(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *refDraw, *newPix;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCreatePixmapReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCreatePixmapReq);
|
|
|
|
client->errorValue = stuff->pid;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(newPix = malloc(sizeof(PanoramiXRes))))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
newPix->type = XRT_PIXMAP;
|
|
|
|
newPix->u.pix.shared = FALSE;
|
|
|
|
newPix->info[0].id = stuff->pid;
|
|
|
|
for(j = 1; j < PanoramiXNumScreens; j++)
|
|
|
|
newPix->info[j].id = FakeClientID(client->index);
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->pid = newPix->info[j].id;
|
|
|
|
stuff->drawable = refDraw->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_CreatePixmap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
|
|
|
AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
|
|
|
|
else
|
2010-12-05 08:36:02 -07:00
|
|
|
free(newPix);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXFreePixmap(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *pix;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->id;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP,
|
|
|
|
client, DixDestroyAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = pix->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_FreePixmap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Since ProcFreePixmap is using FreeResource, it will free
|
|
|
|
our resource for us on the last pass through the loop above */
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXCreateGC(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *refDraw;
|
|
|
|
PanoramiXRes *newGC;
|
|
|
|
PanoramiXRes *stip = NULL;
|
|
|
|
PanoramiXRes *tile = NULL;
|
|
|
|
PanoramiXRes *clip = NULL;
|
|
|
|
REQUEST(xCreateGCReq);
|
|
|
|
int tile_offset = 0, stip_offset = 0, clip_offset = 0;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, len, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
XID tmp;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->gc;
|
2010-07-27 13:02:24 -06:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (Ones(stuff->mask) != len)
|
|
|
|
return BadLength;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if ((Mask)stuff->mask & GCTile) {
|
|
|
|
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & GCStipple) {
|
|
|
|
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & GCClipMask) {
|
|
|
|
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(newGC = malloc(sizeof(PanoramiXRes))))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
newGC->type = XRT_GC;
|
|
|
|
newGC->info[0].id = stuff->gc;
|
|
|
|
for(j = 1; j < PanoramiXNumScreens; j++)
|
|
|
|
newGC->info[j].id = FakeClientID(client->index);
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = newGC->info[j].id;
|
|
|
|
stuff->drawable = refDraw->info[j].id;
|
|
|
|
if (tile)
|
|
|
|
*((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
|
|
|
|
if (stip)
|
|
|
|
*((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
|
|
|
|
if (clip)
|
|
|
|
*((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_CreateGC])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
|
|
|
AddResource(newGC->info[0].id, XRT_GC, newGC);
|
|
|
|
else
|
2010-12-05 08:36:02 -07:00
|
|
|
free(newGC);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int PanoramiXChangeGC(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc;
|
|
|
|
PanoramiXRes *stip = NULL;
|
|
|
|
PanoramiXRes *tile = NULL;
|
|
|
|
PanoramiXRes *clip = NULL;
|
|
|
|
REQUEST(xChangeGCReq);
|
|
|
|
int tile_offset = 0, stip_offset = 0, clip_offset = 0;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, len, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
XID tmp;
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
len = client->req_len - bytes_to_int32(sizeof(xChangeGCReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (Ones(stuff->mask) != len)
|
|
|
|
return BadLength;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if ((Mask)stuff->mask & GCTile) {
|
|
|
|
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & GCStipple) {
|
|
|
|
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((Mask)stuff->mask & GCClipMask) {
|
|
|
|
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
|
|
|
|
if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (tile)
|
|
|
|
*((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
|
|
|
|
if (stip)
|
|
|
|
*((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
|
|
|
|
if (clip)
|
|
|
|
*((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_ChangeGC])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXCopyGC(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *srcGC, *dstGC;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCopyGCReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCopyGCReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&srcGC, stuff->srcGC, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
stuff->srcGC = srcGC->info[j].id;
|
|
|
|
stuff->dstGC = dstGC->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_CopyGC])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXSetDashes(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xSetDashesReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_SetDashes])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXSetClipRectangles(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xSetClipRectanglesReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_SetClipRectangles])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXFreeGC(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC,
|
|
|
|
client, DixDestroyAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = gc->info[j].id;
|
|
|
|
result = (*SavedProcVector[X_FreeGC])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Since ProcFreeGC is using FreeResource, it will free
|
|
|
|
our resource for us on the last pass through the loop above */
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXClearToBackground(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j, x, y;
|
2006-11-26 11:13:41 -07:00
|
|
|
Bool isRoot;
|
|
|
|
REQUEST(xClearAreaReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xClearAreaReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
x = stuff->x;
|
|
|
|
y = stuff->y;
|
|
|
|
isRoot = win->u.win.root;
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->window = win->info[j].id;
|
|
|
|
if(isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_ClearArea])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
For Window to Pixmap copies you're screwed since each screen's
|
|
|
|
pixmap will look like what it sees on its screen. Unless the
|
|
|
|
screens overlap and the window lies on each, the two copies
|
|
|
|
will be out of sync. To remedy this we do a GetImage and PutImage
|
|
|
|
in place of the copy. Doing this as a single Image isn't quite
|
|
|
|
correct since it will include the obscured areas but we will
|
|
|
|
have to fix this later. (MArk).
|
|
|
|
*/
|
|
|
|
|
|
|
|
int PanoramiXCopyArea(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int j, result, srcx, srcy, dstx, dsty;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *src, *dst;
|
|
|
|
Bool srcIsRoot = FALSE;
|
|
|
|
Bool dstIsRoot = FALSE;
|
|
|
|
Bool srcShared, dstShared;
|
|
|
|
REQUEST(xCopyAreaReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCopyAreaReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&src, stuff->srcDrawable,
|
|
|
|
XRC_DRAWABLE, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
srcShared = IS_SHARED_PIXMAP(src);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&dst, stuff->dstDrawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
dstShared = IS_SHARED_PIXMAP(dst);
|
|
|
|
|
|
|
|
if(dstShared && srcShared)
|
|
|
|
return (* SavedProcVector[X_CopyArea])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if((dst->type == XRT_WINDOW) && dst->u.win.root)
|
|
|
|
dstIsRoot = TRUE;
|
|
|
|
if((src->type == XRT_WINDOW) && src->u.win.root)
|
|
|
|
srcIsRoot = TRUE;
|
|
|
|
|
|
|
|
srcx = stuff->srcX; srcy = stuff->srcY;
|
|
|
|
dstx = stuff->dstX; dsty = stuff->dstY;
|
|
|
|
if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
|
|
|
|
DrawablePtr drawables[MAXSCREENS];
|
|
|
|
DrawablePtr pDst;
|
|
|
|
GCPtr pGC;
|
|
|
|
char *data;
|
2007-11-24 10:55:21 -07:00
|
|
|
int pitch, rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
|
2008-11-02 08:26:08 -07:00
|
|
|
DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(data = calloc(1, stuff->height * pitch)))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
XineramaGetImageData(drawables, srcx, srcy,
|
|
|
|
stuff->width, stuff->height, ZPixmap, ~0, data, pitch,
|
|
|
|
srcIsRoot);
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = gc->info[j].id;
|
2008-11-02 08:26:08 -07:00
|
|
|
VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
if(drawables[0]->depth != pDst->depth) {
|
|
|
|
client->errorValue = stuff->dstDrawable;
|
2010-12-05 08:36:02 -07:00
|
|
|
free(data);
|
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
(*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
|
|
|
|
stuff->width, stuff->height,
|
|
|
|
0, ZPixmap, data);
|
|
|
|
|
|
|
|
if(dstShared) break;
|
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
free(data);
|
2006-11-26 11:13:41 -07:00
|
|
|
} else {
|
|
|
|
DrawablePtr pDst = NULL, pSrc = NULL;
|
|
|
|
GCPtr pGC = NULL;
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionRec totalReg;
|
2007-11-24 10:55:21 -07:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionNull(&totalReg);
|
2006-11-26 11:13:41 -07:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionPtr pRgn;
|
2006-11-26 11:13:41 -07:00
|
|
|
stuff->dstDrawable = dst->info[j].id;
|
|
|
|
stuff->srcDrawable = src->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (srcIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->srcX = srcx - screenInfo.screens[j]->x;
|
|
|
|
stuff->srcY = srcy - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (dstIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->dstX = dstx - screenInfo.screens[j]->x;
|
|
|
|
stuff->dstY = dsty - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (stuff->dstDrawable != stuff->srcDrawable) {
|
2007-11-24 10:55:21 -07:00
|
|
|
rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
|
|
|
|
DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if ((pDst->pScreen != pSrc->pScreen) ||
|
|
|
|
(pDst->depth != pSrc->depth)) {
|
|
|
|
client->errorValue = stuff->dstDrawable;
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
pSrc = pDst;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
|
2006-11-26 11:13:41 -07:00
|
|
|
stuff->srcX, stuff->srcY,
|
|
|
|
stuff->width, stuff->height,
|
|
|
|
stuff->dstX, stuff->dstY);
|
2010-12-05 08:36:02 -07:00
|
|
|
if(pGC->graphicsExposures && pRgn) {
|
|
|
|
if(srcIsRoot) {
|
|
|
|
RegionTranslate(pRgn,
|
|
|
|
screenInfo.screens[j]->x, screenInfo.screens[j]->y);
|
|
|
|
}
|
|
|
|
RegionAppend(&totalReg, pRgn);
|
|
|
|
RegionDestroy(pRgn);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(dstShared)
|
2006-11-26 11:13:41 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(pGC->graphicsExposures) {
|
|
|
|
Bool overlap;
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionValidate(&totalReg, &overlap);
|
|
|
|
(*pDst->pScreen->SendGraphicsExpose)(
|
2006-11-26 11:13:41 -07:00
|
|
|
client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionUninit(&totalReg);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXCopyPlane(ClientPtr client)
|
|
|
|
{
|
2007-11-24 10:55:21 -07:00
|
|
|
int j, srcx, srcy, dstx, dsty, rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *src, *dst;
|
|
|
|
Bool srcIsRoot = FALSE;
|
|
|
|
Bool dstIsRoot = FALSE;
|
|
|
|
Bool srcShared, dstShared;
|
|
|
|
DrawablePtr psrcDraw, pdstDraw = NULL;
|
|
|
|
GCPtr pGC = NULL;
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionRec totalReg;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCopyPlaneReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCopyPlaneReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
rc = dixLookupResourceByClass((pointer *)&src, stuff->srcDrawable,
|
|
|
|
XRC_DRAWABLE, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return (rc == BadValue) ? BadDrawable : rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
srcShared = IS_SHARED_PIXMAP(src);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
rc = dixLookupResourceByClass((pointer *)&dst, stuff->dstDrawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return (rc == BadValue) ? BadDrawable : rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
dstShared = IS_SHARED_PIXMAP(dst);
|
|
|
|
|
|
|
|
if(dstShared && srcShared)
|
|
|
|
return (* SavedProcVector[X_CopyPlane])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if((dst->type == XRT_WINDOW) && dst->u.win.root)
|
|
|
|
dstIsRoot = TRUE;
|
|
|
|
if((src->type == XRT_WINDOW) && src->u.win.root)
|
|
|
|
srcIsRoot = TRUE;
|
|
|
|
|
|
|
|
srcx = stuff->srcX; srcy = stuff->srcY;
|
|
|
|
dstx = stuff->dstX; dsty = stuff->dstY;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionNull(&totalReg);
|
2006-11-26 11:13:41 -07:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionPtr pRgn;
|
2006-11-26 11:13:41 -07:00
|
|
|
stuff->dstDrawable = dst->info[j].id;
|
|
|
|
stuff->srcDrawable = src->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (srcIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->srcX = srcx - screenInfo.screens[j]->x;
|
|
|
|
stuff->srcY = srcy - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (dstIsRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->dstX = dstx - screenInfo.screens[j]->x;
|
|
|
|
stuff->dstY = dsty - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (stuff->dstDrawable != stuff->srcDrawable) {
|
2007-11-24 10:55:21 -07:00
|
|
|
rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
|
|
|
|
DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (pdstDraw->pScreen != psrcDraw->pScreen) {
|
|
|
|
client->errorValue = stuff->dstDrawable;
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
psrcDraw = pdstDraw;
|
|
|
|
|
|
|
|
if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
|
|
|
|
(stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
|
|
|
|
client->errorValue = stuff->bitPlane;
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
|
2006-11-26 11:13:41 -07:00
|
|
|
stuff->srcX, stuff->srcY,
|
|
|
|
stuff->width, stuff->height,
|
|
|
|
stuff->dstX, stuff->dstY, stuff->bitPlane);
|
2010-12-05 08:36:02 -07:00
|
|
|
if(pGC->graphicsExposures && pRgn) {
|
|
|
|
RegionAppend(&totalReg, pRgn);
|
|
|
|
RegionDestroy(pRgn);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(dstShared)
|
2006-11-26 11:13:41 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(pGC->graphicsExposures) {
|
|
|
|
Bool overlap;
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionValidate(&totalReg, &overlap);
|
|
|
|
(*pdstDraw->pScreen->SendGraphicsExpose)(
|
2006-11-26 11:13:41 -07:00
|
|
|
client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionUninit(&totalReg);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyPoint(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, npoint, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
xPoint *origPts;
|
|
|
|
Bool isRoot;
|
|
|
|
REQUEST(xPolyPointReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyPoint])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
2010-07-27 13:02:24 -06:00
|
|
|
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (npoint > 0) {
|
2010-12-05 08:36:02 -07:00
|
|
|
origPts = malloc(npoint * sizeof(xPoint));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xPoint *pnts = (xPoint*)&stuff[1];
|
|
|
|
int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
|
|
|
|
|
|
|
|
while(i--) {
|
|
|
|
pnts->x -= x_off;
|
|
|
|
pnts->y -= y_off;
|
|
|
|
pnts++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyPoint])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origPts);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyLine(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, npoint, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
xPoint *origPts;
|
|
|
|
Bool isRoot;
|
|
|
|
REQUEST(xPolyLineReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyLine])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
2010-07-27 13:02:24 -06:00
|
|
|
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (npoint > 0){
|
2010-12-05 08:36:02 -07:00
|
|
|
origPts = malloc(npoint * sizeof(xPoint));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xPoint *pnts = (xPoint*)&stuff[1];
|
|
|
|
int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
|
|
|
|
|
|
|
|
while(i--) {
|
|
|
|
pnts->x -= x_off;
|
|
|
|
pnts->y -= y_off;
|
|
|
|
pnts++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyLine])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origPts);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolySegment(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, nsegs, i, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
xSegment *origSegs;
|
|
|
|
Bool isRoot;
|
|
|
|
REQUEST(xPolySegmentReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolySegment])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
|
|
|
|
if(nsegs & 4) return BadLength;
|
|
|
|
nsegs >>= 3;
|
|
|
|
if (nsegs > 0) {
|
2010-12-05 08:36:02 -07:00
|
|
|
origSegs = malloc(nsegs * sizeof(xSegment));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xSegment *segs = (xSegment*)&stuff[1];
|
|
|
|
|
|
|
|
for (i = nsegs; i--; segs++) {
|
|
|
|
segs->x1 -= x_off;
|
|
|
|
segs->x2 -= x_off;
|
|
|
|
segs->y1 -= y_off;
|
|
|
|
segs->y2 -= y_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolySegment])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origSegs);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyRectangle(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, nrects, i, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
xRectangle *origRecs;
|
|
|
|
REQUEST(xPolyRectangleReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyRectangle])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
|
|
|
|
if(nrects & 4) return BadLength;
|
|
|
|
nrects >>= 3;
|
|
|
|
if (nrects > 0){
|
2010-12-05 08:36:02 -07:00
|
|
|
origRecs = malloc(nrects * sizeof(xRectangle));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xRectangle *rects = (xRectangle *) &stuff[1];
|
|
|
|
|
|
|
|
for (i = nrects; i--; rects++) {
|
|
|
|
rects->x -= x_off;
|
|
|
|
rects->y -= y_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyRectangle])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origRecs);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyArc(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, narcs, i, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
xArc *origArcs;
|
|
|
|
REQUEST(xPolyArcReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyArc])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
|
|
|
|
if(narcs % sizeof(xArc)) return BadLength;
|
|
|
|
narcs /= sizeof(xArc);
|
|
|
|
if (narcs > 0){
|
2010-12-05 08:36:02 -07:00
|
|
|
origArcs = malloc(narcs * sizeof(xArc));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xArc *arcs = (xArc *) &stuff[1];
|
|
|
|
|
|
|
|
for (i = narcs; i--; arcs++) {
|
|
|
|
arcs->x -= x_off;
|
|
|
|
arcs->y -= y_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyArc])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origArcs);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXFillPoly(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, count, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
DDXPointPtr locPts;
|
|
|
|
REQUEST(xFillPolyReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_FillPoly])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (count > 0){
|
2010-12-05 08:36:02 -07:00
|
|
|
locPts = malloc(count * sizeof(DDXPointRec));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
DDXPointPtr pnts = (DDXPointPtr)&stuff[1];
|
|
|
|
int i = (stuff->coordMode==CoordModePrevious) ? 1 : count;
|
|
|
|
|
|
|
|
while(i--) {
|
|
|
|
pnts->x -= x_off;
|
|
|
|
pnts->y -= y_off;
|
|
|
|
pnts++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_FillPoly])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(locPts);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyFillRectangle(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, things, i, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
xRectangle *origRects;
|
|
|
|
REQUEST(xPolyFillRectangleReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyFillRectangle])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
|
|
|
|
if(things & 4) return BadLength;
|
|
|
|
things >>= 3;
|
|
|
|
if (things > 0){
|
2010-12-05 08:36:02 -07:00
|
|
|
origRects = malloc(things * sizeof(xRectangle));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xRectangle *rects = (xRectangle *) &stuff[1];
|
|
|
|
|
|
|
|
for (i = things; i--; rects++) {
|
|
|
|
rects->x -= x_off;
|
|
|
|
rects->y -= y_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyFillRectangle])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origRects);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPolyFillArc(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, narcs, i, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
xArc *origArcs;
|
|
|
|
REQUEST(xPolyFillArcReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyFillArc])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
|
2010-12-05 08:36:02 -07:00
|
|
|
if (narcs % sizeof(xArc)) return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
narcs /= sizeof(xArc);
|
|
|
|
if (narcs > 0) {
|
2010-12-05 08:36:02 -07:00
|
|
|
origArcs = malloc(narcs * sizeof(xArc));
|
2006-11-26 11:13:41 -07:00
|
|
|
memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
|
|
|
|
FOR_NSCREENS_FORWARD(j){
|
|
|
|
|
|
|
|
if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
|
|
|
|
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
int x_off = screenInfo.screens[j]->x;
|
|
|
|
int y_off = screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(x_off || y_off) {
|
|
|
|
xArc *arcs = (xArc *) &stuff[1];
|
|
|
|
|
|
|
|
for (i = narcs; i--; arcs++) {
|
|
|
|
arcs->x -= x_off;
|
|
|
|
arcs->y -= y_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PolyFillArc])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(origArcs);
|
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXPutImage(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
2010-07-27 13:02:24 -06:00
|
|
|
int j, result, orig_x, orig_y;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xPutImageReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPutImageReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PutImage])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
orig_x = stuff->dstX;
|
|
|
|
orig_y = stuff->dstY;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->dstX = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->dstY = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_PutImage])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXGetImage(ClientPtr client)
|
|
|
|
{
|
|
|
|
DrawablePtr drawables[MAXSCREENS];
|
|
|
|
DrawablePtr pDraw;
|
|
|
|
PanoramiXRes *draw;
|
|
|
|
xGetImageReply xgi;
|
|
|
|
Bool isRoot;
|
|
|
|
char *pBuf;
|
2007-11-24 10:55:21 -07:00
|
|
|
int i, x, y, w, h, format, rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
Mask plane = 0, planemask;
|
|
|
|
int linesDone, nlines, linesPerBuf;
|
|
|
|
long widthBytesLine, length;
|
|
|
|
|
|
|
|
REQUEST(xGetImageReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xGetImageReq);
|
|
|
|
|
|
|
|
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
|
|
|
|
client->errorValue = stuff->format;
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return (rc == BadValue) ? BadDrawable : rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(draw->type == XRT_PIXMAP)
|
|
|
|
return (*SavedProcVector[X_GetImage])(client);
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
2008-11-02 08:26:08 -07:00
|
|
|
DixReadAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(!((WindowPtr)pDraw)->realized)
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
x = stuff->x;
|
|
|
|
y = stuff->y;
|
|
|
|
w = stuff->width;
|
|
|
|
h = stuff->height;
|
|
|
|
format = stuff->format;
|
|
|
|
planemask = stuff->planeMask;
|
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
if(isRoot) {
|
|
|
|
if( /* check for being onscreen */
|
|
|
|
x < 0 || x + w > PanoramiXPixWidth ||
|
|
|
|
y < 0 || y + h > PanoramiXPixHeight )
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
} else {
|
|
|
|
if( /* check for being onscreen */
|
2010-12-05 08:36:02 -07:00
|
|
|
screenInfo.screens[0]->x + pDraw->x + x < 0 ||
|
|
|
|
screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
|
|
|
|
screenInfo.screens[0]->y + pDraw->y + y < 0 ||
|
|
|
|
screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
|
2006-11-26 11:13:41 -07:00
|
|
|
/* check for being inside of border */
|
|
|
|
x < - wBorderWidth((WindowPtr)pDraw) ||
|
|
|
|
x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
|
|
|
|
y < -wBorderWidth((WindowPtr)pDraw) ||
|
|
|
|
y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
|
2010-12-05 08:36:02 -07:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
drawables[0] = pDraw;
|
2007-11-24 10:55:21 -07:00
|
|
|
for(i = 1; i < PanoramiXNumScreens; i++) {
|
|
|
|
rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
|
2008-11-02 08:26:08 -07:00
|
|
|
DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
xgi.visual = wVisual (((WindowPtr) pDraw));
|
|
|
|
xgi.type = X_Reply;
|
|
|
|
xgi.sequenceNumber = client->sequence;
|
|
|
|
xgi.depth = pDraw->depth;
|
|
|
|
if(format == ZPixmap) {
|
|
|
|
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
|
|
|
length = widthBytesLine * h;
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
widthBytesLine = BitmapBytePad(w);
|
|
|
|
plane = ((Mask)1) << (pDraw->depth - 1);
|
|
|
|
/* only planes asked for */
|
|
|
|
length = widthBytesLine * h *
|
|
|
|
Ones(planemask & (plane | (plane - 1)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
xgi.length = bytes_to_int32(length);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (widthBytesLine == 0 || h == 0)
|
|
|
|
linesPerBuf = 0;
|
|
|
|
else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE)
|
|
|
|
linesPerBuf = 1;
|
|
|
|
else {
|
|
|
|
linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine;
|
|
|
|
if (linesPerBuf > h)
|
|
|
|
linesPerBuf = h;
|
|
|
|
}
|
|
|
|
length = linesPerBuf * widthBytesLine;
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(pBuf = malloc(length)))
|
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
|
|
|
|
|
|
|
|
if (linesPerBuf == 0) {
|
|
|
|
/* nothing to do */
|
|
|
|
}
|
|
|
|
else if (format == ZPixmap) {
|
|
|
|
linesDone = 0;
|
|
|
|
while (h - linesDone > 0) {
|
|
|
|
nlines = min(linesPerBuf, h - linesDone);
|
|
|
|
|
|
|
|
if(pDraw->depth == 1)
|
2010-12-05 08:36:02 -07:00
|
|
|
memset(pBuf, 0, nlines * widthBytesLine);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
|
|
|
|
format, planemask, pBuf, widthBytesLine, isRoot);
|
|
|
|
|
|
|
|
(void)WriteToClient(client,
|
|
|
|
(int)(nlines * widthBytesLine),
|
|
|
|
pBuf);
|
|
|
|
linesDone += nlines;
|
|
|
|
}
|
|
|
|
} else { /* XYPixmap */
|
|
|
|
for (; plane; plane >>= 1) {
|
|
|
|
if (planemask & plane) {
|
|
|
|
linesDone = 0;
|
|
|
|
while (h - linesDone > 0) {
|
|
|
|
nlines = min(linesPerBuf, h - linesDone);
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
memset(pBuf, 0, nlines * widthBytesLine);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
XineramaGetImageData(drawables, x, y + linesDone, w,
|
|
|
|
nlines, format, plane, pBuf,
|
|
|
|
widthBytesLine, isRoot);
|
|
|
|
|
|
|
|
(void)WriteToClient(client,
|
|
|
|
(int)(nlines * widthBytesLine),
|
|
|
|
pBuf);
|
|
|
|
|
|
|
|
linesDone += nlines;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
free(pBuf);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The text stuff should be rewritten so that duplication happens
|
|
|
|
at the GlyphBlt level. That is, loading the font and getting
|
|
|
|
the glyphs should only happen once */
|
|
|
|
|
|
|
|
int
|
|
|
|
PanoramiXPolyText8(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
int orig_x, orig_y;
|
|
|
|
REQUEST(xPolyTextReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyText8])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
orig_x = stuff->x;
|
|
|
|
orig_y = stuff->y;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_PolyText8])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
PanoramiXPolyText16(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
int orig_x, orig_y;
|
|
|
|
REQUEST(xPolyTextReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_PolyText16])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
orig_x = stuff->x;
|
|
|
|
orig_y = stuff->y;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_PolyText16])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXImageText8(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
int orig_x, orig_y;
|
|
|
|
REQUEST(xImageTextReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_ImageText8])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
orig_x = stuff->x;
|
|
|
|
orig_y = stuff->y;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_ImageText8])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXImageText16(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *gc, *draw;
|
|
|
|
Bool isRoot;
|
|
|
|
int orig_x, orig_y;
|
|
|
|
REQUEST(xImageTextReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
|
|
|
XRC_DRAWABLE, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return (result == BadValue) ? BadDrawable : result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if(IS_SHARED_PIXMAP(draw))
|
|
|
|
return (*SavedProcVector[X_ImageText16])(client);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
|
|
|
|
|
|
|
orig_x = stuff->x;
|
|
|
|
orig_y = stuff->y;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->drawable = draw->info[j].id;
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
if (isRoot) {
|
2010-12-05 08:36:02 -07:00
|
|
|
stuff->x = orig_x - screenInfo.screens[j]->x;
|
|
|
|
stuff->y = orig_y - screenInfo.screens[j]->y;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
result = (*SavedProcVector[X_ImageText16])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXCreateColormap(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *win, *newCmap;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j, orig_visual;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCreateColormapReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCreateColormapReq);
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->window,
|
|
|
|
XRT_WINDOW, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
newCmap->type = XRT_COLORMAP;
|
|
|
|
newCmap->info[0].id = stuff->mid;
|
|
|
|
for(j = 1; j < PanoramiXNumScreens; j++)
|
|
|
|
newCmap->info[j].id = FakeClientID(client->index);
|
|
|
|
|
|
|
|
orig_visual = stuff->visual;
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->mid = newCmap->info[j].id;
|
|
|
|
stuff->window = win->info[j].id;
|
2008-11-02 08:26:08 -07:00
|
|
|
stuff->visual = PanoramiXTranslateVisualID(j, orig_visual);
|
2006-11-26 11:13:41 -07:00
|
|
|
result = (* SavedProcVector[X_CreateColormap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
|
|
|
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
|
|
|
|
else
|
2010-12-05 08:36:02 -07:00
|
|
|
free(newCmap);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXFreeColormap(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *cmap;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->id;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
|
|
|
|
client, DixDestroyAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_FreeColormap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Since ProcFreeColormap is using FreeResource, it will free
|
|
|
|
our resource for us on the last pass through the loop above */
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
PanoramiXCopyColormapAndFree(ClientPtr client)
|
|
|
|
{
|
|
|
|
PanoramiXRes *cmap, *newCmap;
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xCopyColormapAndFreeReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->srcCmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->srcCmap,
|
|
|
|
XRT_COLORMAP, client,
|
|
|
|
DixReadAccess | DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
if(!(newCmap = malloc(sizeof(PanoramiXRes))))
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
newCmap->type = XRT_COLORMAP;
|
|
|
|
newCmap->info[0].id = stuff->mid;
|
|
|
|
for(j = 1; j < PanoramiXNumScreens; j++)
|
|
|
|
newCmap->info[j].id = FakeClientID(client->index);
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->srcCmap = cmap->info[j].id;
|
|
|
|
stuff->mid = newCmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_CopyColormapAndFree])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == Success)
|
|
|
|
AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
|
|
|
|
else
|
2010-12-05 08:36:02 -07:00
|
|
|
free(newCmap);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXInstallColormap(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xResourceReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->id;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->id = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_InstallColormap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXUninstallColormap(ClientPtr client)
|
|
|
|
{
|
|
|
|
REQUEST(xResourceReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->id;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->id = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_UninstallColormap])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXAllocColor(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xAllocColorReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xAllocColorReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_AllocColor])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXAllocNamedColor(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xAllocNamedColorReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_AllocNamedColor])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXAllocColorCells(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xAllocColorCellsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_AllocColorCells])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXAllocColorPlanes(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xAllocColorPlanesReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_AllocColorPlanes])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXFreeColors(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xFreeColorsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_FreeColors])(client);
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXStoreColors(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xStoreColorsReq);
|
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_StoreColors])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PanoramiXStoreNamedColor(ClientPtr client)
|
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
int result, j;
|
2006-11-26 11:13:41 -07:00
|
|
|
PanoramiXRes *cmap;
|
|
|
|
REQUEST(xStoreNamedColorReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
|
|
|
|
|
|
|
|
client->errorValue = stuff->cmap;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
|
|
|
|
XRT_COLORMAP, client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j){
|
|
|
|
stuff->cmap = cmap->info[j].id;
|
|
|
|
result = (* SavedProcVector[X_StoreNamedColor])(client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|