1 /*****************************************************************
2 Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
3 Permission is hereby granted, free of charge, to any person obtaining a copy
4 of this software and associated documentation files (the "Software"), to deal
5 in the Software without restriction, including without limitation the rights
6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 copies of the Software.
9 The above copyright notice and this permission notice shall be included in
10 all copies or substantial portions of the Software.
12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
16 BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
18 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 Except as contained in this notice, the name of Digital Equipment Corporation
21 shall not be used in advertising or otherwise to promote the sale, use or other
22 dealings in this Software without prior written authorization from Digital
23 Equipment Corporation.
24 ******************************************************************/
26 /* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
28 #ifdef HAVE_DIX_CONFIG_H
29 #include <dix-config.h>
34 #include <X11/Xproto.h>
35 #include "windowstr.h"
36 #include "dixfontstr.h"
38 #include "colormapst.h"
39 #include "scrnintstr.h"
44 #include "dixstruct.h"
45 #include "panoramiX.h"
46 #include "panoramiXsrv.h"
48 #include "panoramiXh.h"
50 #define XINERAMA_IMAGE_BUFSIZE (256*1024)
51 #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
52 CWDontPropagate | CWOverrideRedirect | CWCursor )
55 PanoramiXCreateWindow(ClientPtr client
)
57 PanoramiXRes
*parent
, *newWin
;
58 PanoramiXRes
*backPix
= NULL
;
59 PanoramiXRes
*bordPix
= NULL
;
60 PanoramiXRes
*cmap
= NULL
;
62 REQUEST(xCreateWindowReq
);
63 int pback_offset
= 0, pbord_offset
= 0, cmap_offset
= 0;
69 REQUEST_AT_LEAST_SIZE(xCreateWindowReq
);
71 len
= client
->req_len
- bytes_to_int32(sizeof(xCreateWindowReq
));
72 if (Ones(stuff
->mask
) != len
)
75 result
= dixLookupResourceByType((pointer
*) &parent
, stuff
->parent
,
76 XRT_WINDOW
, client
, DixWriteAccess
);
77 if (result
!= Success
)
80 if (stuff
->class == CopyFromParent
)
81 stuff
->class = parent
->u
.win
.class;
83 if ((stuff
->class == InputOnly
) && (stuff
->mask
& (~INPUTONLY_LEGAL_MASK
)))
86 if ((Mask
) stuff
->mask
& CWBackPixmap
) {
87 pback_offset
= Ones((Mask
) stuff
->mask
& (CWBackPixmap
- 1));
88 tmp
= *((CARD32
*) &stuff
[1] + pback_offset
);
89 if ((tmp
!= None
) && (tmp
!= ParentRelative
)) {
90 result
= dixLookupResourceByType((pointer
*) &backPix
, tmp
,
91 XRT_PIXMAP
, client
, DixReadAccess
);
92 if (result
!= Success
)
96 if ((Mask
) stuff
->mask
& CWBorderPixmap
) {
97 pbord_offset
= Ones((Mask
) stuff
->mask
& (CWBorderPixmap
- 1));
98 tmp
= *((CARD32
*) &stuff
[1] + pbord_offset
);
99 if (tmp
!= CopyFromParent
) {
100 result
= dixLookupResourceByType((pointer
*) &bordPix
, tmp
,
101 XRT_PIXMAP
, client
, DixReadAccess
);
102 if (result
!= Success
)
106 if ((Mask
) stuff
->mask
& CWColormap
) {
107 cmap_offset
= Ones((Mask
) stuff
->mask
& (CWColormap
- 1));
108 tmp
= *((CARD32
*) &stuff
[1] + cmap_offset
);
109 if ((tmp
!= CopyFromParent
) && (tmp
!= None
)) {
110 result
= dixLookupResourceByType((pointer
*) &cmap
, tmp
,
111 XRT_COLORMAP
, client
,
113 if (result
!= Success
)
118 if (!(newWin
= malloc(sizeof(PanoramiXRes
))))
121 newWin
->type
= XRT_WINDOW
;
122 newWin
->u
.win
.visibility
= VisibilityNotViewable
;
123 newWin
->u
.win
.class = stuff
->class;
124 newWin
->u
.win
.root
= FALSE
;
125 panoramix_setup_ids(newWin
, client
, stuff
->wid
);
127 if (stuff
->class == InputOnly
)
128 stuff
->visual
= CopyFromParent
;
129 orig_visual
= stuff
->visual
;
132 parentIsRoot
= (stuff
->parent
== screenInfo
.screens
[0]->root
->drawable
.id
)
133 || (stuff
->parent
== screenInfo
.screens
[0]->screensaver
.wid
);
134 FOR_NSCREENS_BACKWARD(j
) {
135 stuff
->wid
= newWin
->info
[j
].id
;
136 stuff
->parent
= parent
->info
[j
].id
;
138 stuff
->x
= orig_x
- screenInfo
.screens
[j
]->x
;
139 stuff
->y
= orig_y
- screenInfo
.screens
[j
]->y
;
142 *((CARD32
*) &stuff
[1] + pback_offset
) = backPix
->info
[j
].id
;
144 *((CARD32
*) &stuff
[1] + pbord_offset
) = bordPix
->info
[j
].id
;
146 *((CARD32
*) &stuff
[1] + cmap_offset
) = cmap
->info
[j
].id
;
147 if (orig_visual
!= CopyFromParent
)
148 stuff
->visual
= PanoramiXTranslateVisualID(j
, orig_visual
);
149 result
= (*SavedProcVector
[X_CreateWindow
]) (client
);
150 if (result
!= Success
)
154 if (result
== Success
)
155 AddResource(newWin
->info
[0].id
, XRT_WINDOW
, newWin
);
163 PanoramiXChangeWindowAttributes(ClientPtr client
)
166 PanoramiXRes
*backPix
= NULL
;
167 PanoramiXRes
*bordPix
= NULL
;
168 PanoramiXRes
*cmap
= NULL
;
170 REQUEST(xChangeWindowAttributesReq
);
171 int pback_offset
= 0, pbord_offset
= 0, cmap_offset
= 0;
175 REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq
);
177 len
= client
->req_len
- bytes_to_int32(sizeof(xChangeWindowAttributesReq
));
178 if (Ones(stuff
->valueMask
) != len
)
181 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
182 XRT_WINDOW
, client
, DixWriteAccess
);
183 if (result
!= Success
)
186 if ((win
->u
.win
.class == InputOnly
) &&
187 (stuff
->valueMask
& (~INPUTONLY_LEGAL_MASK
)))
190 if ((Mask
) stuff
->valueMask
& CWBackPixmap
) {
191 pback_offset
= Ones((Mask
) stuff
->valueMask
& (CWBackPixmap
- 1));
192 tmp
= *((CARD32
*) &stuff
[1] + pback_offset
);
193 if ((tmp
!= None
) && (tmp
!= ParentRelative
)) {
194 result
= dixLookupResourceByType((pointer
*) &backPix
, tmp
,
195 XRT_PIXMAP
, client
, DixReadAccess
);
196 if (result
!= Success
)
200 if ((Mask
) stuff
->valueMask
& CWBorderPixmap
) {
201 pbord_offset
= Ones((Mask
) stuff
->valueMask
& (CWBorderPixmap
- 1));
202 tmp
= *((CARD32
*) &stuff
[1] + pbord_offset
);
203 if (tmp
!= CopyFromParent
) {
204 result
= dixLookupResourceByType((pointer
*) &bordPix
, tmp
,
205 XRT_PIXMAP
, client
, DixReadAccess
);
206 if (result
!= Success
)
210 if ((Mask
) stuff
->valueMask
& CWColormap
) {
211 cmap_offset
= Ones((Mask
) stuff
->valueMask
& (CWColormap
- 1));
212 tmp
= *((CARD32
*) &stuff
[1] + cmap_offset
);
213 if ((tmp
!= CopyFromParent
) && (tmp
!= None
)) {
214 result
= dixLookupResourceByType((pointer
*) &cmap
, tmp
,
215 XRT_COLORMAP
, client
,
217 if (result
!= Success
)
222 FOR_NSCREENS_BACKWARD(j
) {
223 stuff
->window
= win
->info
[j
].id
;
225 *((CARD32
*) &stuff
[1] + pback_offset
) = backPix
->info
[j
].id
;
227 *((CARD32
*) &stuff
[1] + pbord_offset
) = bordPix
->info
[j
].id
;
229 *((CARD32
*) &stuff
[1] + cmap_offset
) = cmap
->info
[j
].id
;
230 result
= (*SavedProcVector
[X_ChangeWindowAttributes
]) (client
);
237 PanoramiXDestroyWindow(ClientPtr client
)
242 REQUEST(xResourceReq
);
244 REQUEST_SIZE_MATCH(xResourceReq
);
246 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
, XRT_WINDOW
,
247 client
, DixDestroyAccess
);
248 if (result
!= Success
)
251 FOR_NSCREENS_BACKWARD(j
) {
252 stuff
->id
= win
->info
[j
].id
;
253 result
= (*SavedProcVector
[X_DestroyWindow
]) (client
);
254 if (result
!= Success
)
258 /* Since ProcDestroyWindow is using FreeResource, it will free
259 our resource for us on the last pass through the loop above */
265 PanoramiXDestroySubwindows(ClientPtr client
)
270 REQUEST(xResourceReq
);
272 REQUEST_SIZE_MATCH(xResourceReq
);
274 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
, XRT_WINDOW
,
275 client
, DixDestroyAccess
);
276 if (result
!= Success
)
279 FOR_NSCREENS_BACKWARD(j
) {
280 stuff
->id
= win
->info
[j
].id
;
281 result
= (*SavedProcVector
[X_DestroySubwindows
]) (client
);
282 if (result
!= Success
)
286 /* DestroySubwindows is using FreeResource which will free
287 our resources for us on the last pass through the loop above */
293 PanoramiXChangeSaveSet(ClientPtr client
)
298 REQUEST(xChangeSaveSetReq
);
300 REQUEST_SIZE_MATCH(xChangeSaveSetReq
);
302 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
303 XRT_WINDOW
, client
, DixReadAccess
);
304 if (result
!= Success
)
307 FOR_NSCREENS_BACKWARD(j
) {
308 stuff
->window
= win
->info
[j
].id
;
309 result
= (*SavedProcVector
[X_ChangeSaveSet
]) (client
);
310 if (result
!= Success
)
318 PanoramiXReparentWindow(ClientPtr client
)
320 PanoramiXRes
*win
, *parent
;
325 REQUEST(xReparentWindowReq
);
327 REQUEST_SIZE_MATCH(xReparentWindowReq
);
329 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
330 XRT_WINDOW
, client
, DixWriteAccess
);
331 if (result
!= Success
)
334 result
= dixLookupResourceByType((pointer
*) &parent
, stuff
->parent
,
335 XRT_WINDOW
, client
, DixWriteAccess
);
336 if (result
!= Success
)
341 parentIsRoot
= (stuff
->parent
== screenInfo
.screens
[0]->root
->drawable
.id
)
342 || (stuff
->parent
== screenInfo
.screens
[0]->screensaver
.wid
);
343 FOR_NSCREENS_BACKWARD(j
) {
344 stuff
->window
= win
->info
[j
].id
;
345 stuff
->parent
= parent
->info
[j
].id
;
347 stuff
->x
= x
- screenInfo
.screens
[j
]->x
;
348 stuff
->y
= y
- screenInfo
.screens
[j
]->y
;
350 result
= (*SavedProcVector
[X_ReparentWindow
]) (client
);
351 if (result
!= Success
)
359 PanoramiXMapWindow(ClientPtr client
)
364 REQUEST(xResourceReq
);
366 REQUEST_SIZE_MATCH(xResourceReq
);
368 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
,
369 XRT_WINDOW
, client
, DixReadAccess
);
370 if (result
!= Success
)
373 FOR_NSCREENS_FORWARD(j
) {
374 stuff
->id
= win
->info
[j
].id
;
375 result
= (*SavedProcVector
[X_MapWindow
]) (client
);
376 if (result
!= Success
)
384 PanoramiXMapSubwindows(ClientPtr client
)
389 REQUEST(xResourceReq
);
391 REQUEST_SIZE_MATCH(xResourceReq
);
393 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
,
394 XRT_WINDOW
, client
, DixReadAccess
);
395 if (result
!= Success
)
398 FOR_NSCREENS_FORWARD(j
) {
399 stuff
->id
= win
->info
[j
].id
;
400 result
= (*SavedProcVector
[X_MapSubwindows
]) (client
);
401 if (result
!= Success
)
409 PanoramiXUnmapWindow(ClientPtr client
)
414 REQUEST(xResourceReq
);
416 REQUEST_SIZE_MATCH(xResourceReq
);
418 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
,
419 XRT_WINDOW
, client
, DixReadAccess
);
420 if (result
!= Success
)
423 FOR_NSCREENS_FORWARD(j
) {
424 stuff
->id
= win
->info
[j
].id
;
425 result
= (*SavedProcVector
[X_UnmapWindow
]) (client
);
426 if (result
!= Success
)
434 PanoramiXUnmapSubwindows(ClientPtr client
)
439 REQUEST(xResourceReq
);
441 REQUEST_SIZE_MATCH(xResourceReq
);
443 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->id
,
444 XRT_WINDOW
, client
, DixReadAccess
);
445 if (result
!= Success
)
448 FOR_NSCREENS_FORWARD(j
) {
449 stuff
->id
= win
->info
[j
].id
;
450 result
= (*SavedProcVector
[X_UnmapSubwindows
]) (client
);
451 if (result
!= Success
)
459 PanoramiXConfigureWindow(ClientPtr client
)
462 PanoramiXRes
*sib
= NULL
;
464 int result
, j
, len
, sib_offset
= 0, x
= 0, y
= 0;
468 REQUEST(xConfigureWindowReq
);
470 REQUEST_AT_LEAST_SIZE(xConfigureWindowReq
);
472 len
= client
->req_len
- bytes_to_int32(sizeof(xConfigureWindowReq
));
473 if (Ones(stuff
->mask
) != len
)
476 /* because we need the parent */
477 result
= dixLookupResourceByType((pointer
*) &pWin
, stuff
->window
,
478 RT_WINDOW
, client
, DixWriteAccess
);
479 if (result
!= Success
)
482 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
483 XRT_WINDOW
, client
, DixWriteAccess
);
484 if (result
!= Success
)
487 if ((Mask
) stuff
->mask
& CWSibling
) {
490 sib_offset
= Ones((Mask
) stuff
->mask
& (CWSibling
- 1));
491 if ((tmp
= *((CARD32
*) &stuff
[1] + sib_offset
))) {
492 result
= dixLookupResourceByType((pointer
*) &sib
, tmp
, XRT_WINDOW
,
493 client
, DixReadAccess
);
494 if (result
!= Success
)
499 if (pWin
->parent
&& ((pWin
->parent
== screenInfo
.screens
[0]->root
) ||
500 (pWin
->parent
->drawable
.id
==
501 screenInfo
.screens
[0]->screensaver
.wid
))) {
502 if ((Mask
) stuff
->mask
& CWX
) {
504 x
= *((CARD32
*) &stuff
[1]);
506 if ((Mask
) stuff
->mask
& CWY
) {
507 y_offset
= (x_offset
== -1) ? 0 : 1;
508 y
= *((CARD32
*) &stuff
[1] + y_offset
);
512 /* have to go forward or you get expose events before
513 ConfigureNotify events */
514 FOR_NSCREENS_FORWARD(j
) {
515 stuff
->window
= win
->info
[j
].id
;
517 *((CARD32
*) &stuff
[1] + sib_offset
) = sib
->info
[j
].id
;
519 *((CARD32
*) &stuff
[1] + x_offset
) = x
- screenInfo
.screens
[j
]->x
;
521 *((CARD32
*) &stuff
[1] + y_offset
) = y
- screenInfo
.screens
[j
]->y
;
522 result
= (*SavedProcVector
[X_ConfigureWindow
]) (client
);
523 if (result
!= Success
)
531 PanoramiXCirculateWindow(ClientPtr client
)
536 REQUEST(xCirculateWindowReq
);
538 REQUEST_SIZE_MATCH(xCirculateWindowReq
);
540 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
541 XRT_WINDOW
, client
, DixWriteAccess
);
542 if (result
!= Success
)
545 FOR_NSCREENS_FORWARD(j
) {
546 stuff
->window
= win
->info
[j
].id
;
547 result
= (*SavedProcVector
[X_CirculateWindow
]) (client
);
548 if (result
!= Success
)
556 PanoramiXGetGeometry(ClientPtr client
)
558 xGetGeometryReply rep
;
562 REQUEST(xResourceReq
);
564 REQUEST_SIZE_MATCH(xResourceReq
);
565 rc
= dixLookupDrawable(&pDraw
, stuff
->id
, client
, M_ANY
, DixGetAttrAccess
);
569 rep
= (xGetGeometryReply
) {
571 .sequenceNumber
= client
->sequence
,
573 .root
= screenInfo
.screens
[0]->root
->drawable
.id
,
574 .depth
= pDraw
->depth
,
575 .width
= pDraw
->width
,
576 .height
= pDraw
->height
,
582 if (stuff
->id
== rep
.root
) {
583 xWindowRoot
*root
= (xWindowRoot
*)
584 (ConnectionInfo
+ connBlockScreenStart
);
586 rep
.width
= root
->pixWidth
;
587 rep
.height
= root
->pixHeight
;
589 else if (WindowDrawable(pDraw
->type
)) {
590 WindowPtr pWin
= (WindowPtr
) pDraw
;
592 rep
.x
= pWin
->origin
.x
- wBorderWidth(pWin
);
593 rep
.y
= pWin
->origin
.y
- wBorderWidth(pWin
);
594 if ((pWin
->parent
== screenInfo
.screens
[0]->root
) ||
595 (pWin
->parent
->drawable
.id
==
596 screenInfo
.screens
[0]->screensaver
.wid
)) {
597 rep
.x
+= screenInfo
.screens
[0]->x
;
598 rep
.y
+= screenInfo
.screens
[0]->y
;
600 rep
.borderWidth
= pWin
->borderWidth
;
603 WriteReplyToClient(client
, sizeof(xGetGeometryReply
), &rep
);
608 PanoramiXTranslateCoords(ClientPtr client
)
612 REQUEST(xTranslateCoordsReq
);
614 WindowPtr pWin
, pDst
;
615 xTranslateCoordsReply rep
;
617 REQUEST_SIZE_MATCH(xTranslateCoordsReq
);
618 rc
= dixLookupWindow(&pWin
, stuff
->srcWid
, client
, DixReadAccess
);
621 rc
= dixLookupWindow(&pDst
, stuff
->dstWid
, client
, DixReadAccess
);
624 rep
= (xTranslateCoordsReply
) {
626 .sequenceNumber
= client
->sequence
,
632 if ((pWin
== screenInfo
.screens
[0]->root
) ||
633 (pWin
->drawable
.id
== screenInfo
.screens
[0]->screensaver
.wid
)) {
634 x
= stuff
->srcX
- screenInfo
.screens
[0]->x
;
635 y
= stuff
->srcY
- screenInfo
.screens
[0]->y
;
638 x
= pWin
->drawable
.x
+ stuff
->srcX
;
639 y
= pWin
->drawable
.y
+ stuff
->srcY
;
641 pWin
= pDst
->firstChild
;
645 if ((pWin
->mapped
) &&
646 (x
>= pWin
->drawable
.x
- wBorderWidth(pWin
)) &&
647 (x
< pWin
->drawable
.x
+ (int) pWin
->drawable
.width
+
648 wBorderWidth(pWin
)) &&
649 (y
>= pWin
->drawable
.y
- wBorderWidth(pWin
)) &&
650 (y
< pWin
->drawable
.y
+ (int) pWin
->drawable
.height
+
652 /* When a window is shaped, a further check
653 * is made to see if the point is inside
656 && (!wBoundingShape(pWin
) ||
657 RegionContainsPoint(wBoundingShape(pWin
),
658 x
- pWin
->drawable
.x
,
659 y
- pWin
->drawable
.y
, &box
))
661 rep
.child
= pWin
->drawable
.id
;
662 pWin
= (WindowPtr
) NULL
;
665 pWin
= pWin
->nextSib
;
667 rep
.dstX
= x
- pDst
->drawable
.x
;
668 rep
.dstY
= y
- pDst
->drawable
.y
;
669 if ((pDst
== screenInfo
.screens
[0]->root
) ||
670 (pDst
->drawable
.id
== screenInfo
.screens
[0]->screensaver
.wid
)) {
671 rep
.dstX
+= screenInfo
.screens
[0]->x
;
672 rep
.dstY
+= screenInfo
.screens
[0]->y
;
675 WriteReplyToClient(client
, sizeof(xTranslateCoordsReply
), &rep
);
680 PanoramiXCreatePixmap(ClientPtr client
)
682 PanoramiXRes
*refDraw
, *newPix
;
685 REQUEST(xCreatePixmapReq
);
687 REQUEST_SIZE_MATCH(xCreatePixmapReq
);
688 client
->errorValue
= stuff
->pid
;
690 result
= dixLookupResourceByClass((pointer
*) &refDraw
, stuff
->drawable
,
691 XRC_DRAWABLE
, client
, DixReadAccess
);
692 if (result
!= Success
)
693 return (result
== BadValue
) ? BadDrawable
: result
;
695 if (!(newPix
= malloc(sizeof(PanoramiXRes
))))
698 newPix
->type
= XRT_PIXMAP
;
699 newPix
->u
.pix
.shared
= FALSE
;
700 panoramix_setup_ids(newPix
, client
, stuff
->pid
);
702 FOR_NSCREENS_BACKWARD(j
) {
703 stuff
->pid
= newPix
->info
[j
].id
;
704 stuff
->drawable
= refDraw
->info
[j
].id
;
705 result
= (*SavedProcVector
[X_CreatePixmap
]) (client
);
706 if (result
!= Success
)
710 if (result
== Success
)
711 AddResource(newPix
->info
[0].id
, XRT_PIXMAP
, newPix
);
719 PanoramiXFreePixmap(ClientPtr client
)
724 REQUEST(xResourceReq
);
726 REQUEST_SIZE_MATCH(xResourceReq
);
728 client
->errorValue
= stuff
->id
;
730 result
= dixLookupResourceByType((pointer
*) &pix
, stuff
->id
, XRT_PIXMAP
,
731 client
, DixDestroyAccess
);
732 if (result
!= Success
)
735 FOR_NSCREENS_BACKWARD(j
) {
736 stuff
->id
= pix
->info
[j
].id
;
737 result
= (*SavedProcVector
[X_FreePixmap
]) (client
);
738 if (result
!= Success
)
742 /* Since ProcFreePixmap is using FreeResource, it will free
743 our resource for us on the last pass through the loop above */
749 PanoramiXCreateGC(ClientPtr client
)
751 PanoramiXRes
*refDraw
;
753 PanoramiXRes
*stip
= NULL
;
754 PanoramiXRes
*tile
= NULL
;
755 PanoramiXRes
*clip
= NULL
;
757 REQUEST(xCreateGCReq
);
758 int tile_offset
= 0, stip_offset
= 0, clip_offset
= 0;
762 REQUEST_AT_LEAST_SIZE(xCreateGCReq
);
764 client
->errorValue
= stuff
->gc
;
765 len
= client
->req_len
- bytes_to_int32(sizeof(xCreateGCReq
));
766 if (Ones(stuff
->mask
) != len
)
769 result
= dixLookupResourceByClass((pointer
*) &refDraw
, stuff
->drawable
,
770 XRC_DRAWABLE
, client
, DixReadAccess
);
771 if (result
!= Success
)
772 return (result
== BadValue
) ? BadDrawable
: result
;
774 if ((Mask
) stuff
->mask
& GCTile
) {
775 tile_offset
= Ones((Mask
) stuff
->mask
& (GCTile
- 1));
776 if ((tmp
= *((CARD32
*) &stuff
[1] + tile_offset
))) {
777 result
= dixLookupResourceByType((pointer
*) &tile
, tmp
, XRT_PIXMAP
,
778 client
, DixReadAccess
);
779 if (result
!= Success
)
783 if ((Mask
) stuff
->mask
& GCStipple
) {
784 stip_offset
= Ones((Mask
) stuff
->mask
& (GCStipple
- 1));
785 if ((tmp
= *((CARD32
*) &stuff
[1] + stip_offset
))) {
786 result
= dixLookupResourceByType((pointer
*) &stip
, tmp
, XRT_PIXMAP
,
787 client
, DixReadAccess
);
788 if (result
!= Success
)
792 if ((Mask
) stuff
->mask
& GCClipMask
) {
793 clip_offset
= Ones((Mask
) stuff
->mask
& (GCClipMask
- 1));
794 if ((tmp
= *((CARD32
*) &stuff
[1] + clip_offset
))) {
795 result
= dixLookupResourceByType((pointer
*) &clip
, tmp
, XRT_PIXMAP
,
796 client
, DixReadAccess
);
797 if (result
!= Success
)
802 if (!(newGC
= malloc(sizeof(PanoramiXRes
))))
805 newGC
->type
= XRT_GC
;
806 panoramix_setup_ids(newGC
, client
, stuff
->gc
);
808 FOR_NSCREENS_BACKWARD(j
) {
809 stuff
->gc
= newGC
->info
[j
].id
;
810 stuff
->drawable
= refDraw
->info
[j
].id
;
812 *((CARD32
*) &stuff
[1] + tile_offset
) = tile
->info
[j
].id
;
814 *((CARD32
*) &stuff
[1] + stip_offset
) = stip
->info
[j
].id
;
816 *((CARD32
*) &stuff
[1] + clip_offset
) = clip
->info
[j
].id
;
817 result
= (*SavedProcVector
[X_CreateGC
]) (client
);
818 if (result
!= Success
)
822 if (result
== Success
)
823 AddResource(newGC
->info
[0].id
, XRT_GC
, newGC
);
831 PanoramiXChangeGC(ClientPtr client
)
834 PanoramiXRes
*stip
= NULL
;
835 PanoramiXRes
*tile
= NULL
;
836 PanoramiXRes
*clip
= NULL
;
838 REQUEST(xChangeGCReq
);
839 int tile_offset
= 0, stip_offset
= 0, clip_offset
= 0;
843 REQUEST_AT_LEAST_SIZE(xChangeGCReq
);
845 len
= client
->req_len
- bytes_to_int32(sizeof(xChangeGCReq
));
846 if (Ones(stuff
->mask
) != len
)
849 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
850 client
, DixReadAccess
);
851 if (result
!= Success
)
854 if ((Mask
) stuff
->mask
& GCTile
) {
855 tile_offset
= Ones((Mask
) stuff
->mask
& (GCTile
- 1));
856 if ((tmp
= *((CARD32
*) &stuff
[1] + tile_offset
))) {
857 result
= dixLookupResourceByType((pointer
*) &tile
, tmp
, XRT_PIXMAP
,
858 client
, DixReadAccess
);
859 if (result
!= Success
)
863 if ((Mask
) stuff
->mask
& GCStipple
) {
864 stip_offset
= Ones((Mask
) stuff
->mask
& (GCStipple
- 1));
865 if ((tmp
= *((CARD32
*) &stuff
[1] + stip_offset
))) {
866 result
= dixLookupResourceByType((pointer
*) &stip
, tmp
, XRT_PIXMAP
,
867 client
, DixReadAccess
);
868 if (result
!= Success
)
872 if ((Mask
) stuff
->mask
& GCClipMask
) {
873 clip_offset
= Ones((Mask
) stuff
->mask
& (GCClipMask
- 1));
874 if ((tmp
= *((CARD32
*) &stuff
[1] + clip_offset
))) {
875 result
= dixLookupResourceByType((pointer
*) &clip
, tmp
, XRT_PIXMAP
,
876 client
, DixReadAccess
);
877 if (result
!= Success
)
882 FOR_NSCREENS_BACKWARD(j
) {
883 stuff
->gc
= gc
->info
[j
].id
;
885 *((CARD32
*) &stuff
[1] + tile_offset
) = tile
->info
[j
].id
;
887 *((CARD32
*) &stuff
[1] + stip_offset
) = stip
->info
[j
].id
;
889 *((CARD32
*) &stuff
[1] + clip_offset
) = clip
->info
[j
].id
;
890 result
= (*SavedProcVector
[X_ChangeGC
]) (client
);
891 if (result
!= Success
)
899 PanoramiXCopyGC(ClientPtr client
)
901 PanoramiXRes
*srcGC
, *dstGC
;
906 REQUEST_SIZE_MATCH(xCopyGCReq
);
908 result
= dixLookupResourceByType((pointer
*) &srcGC
, stuff
->srcGC
, XRT_GC
,
909 client
, DixReadAccess
);
910 if (result
!= Success
)
913 result
= dixLookupResourceByType((pointer
*) &dstGC
, stuff
->dstGC
, XRT_GC
,
914 client
, DixWriteAccess
);
915 if (result
!= Success
)
919 stuff
->srcGC
= srcGC
->info
[j
].id
;
920 stuff
->dstGC
= dstGC
->info
[j
].id
;
921 result
= (*SavedProcVector
[X_CopyGC
]) (client
);
922 if (result
!= Success
)
930 PanoramiXSetDashes(ClientPtr client
)
935 REQUEST(xSetDashesReq
);
937 REQUEST_FIXED_SIZE(xSetDashesReq
, stuff
->nDashes
);
939 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
940 client
, DixWriteAccess
);
941 if (result
!= Success
)
944 FOR_NSCREENS_BACKWARD(j
) {
945 stuff
->gc
= gc
->info
[j
].id
;
946 result
= (*SavedProcVector
[X_SetDashes
]) (client
);
947 if (result
!= Success
)
955 PanoramiXSetClipRectangles(ClientPtr client
)
960 REQUEST(xSetClipRectanglesReq
);
962 REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq
);
964 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
965 client
, DixWriteAccess
);
966 if (result
!= Success
)
969 FOR_NSCREENS_BACKWARD(j
) {
970 stuff
->gc
= gc
->info
[j
].id
;
971 result
= (*SavedProcVector
[X_SetClipRectangles
]) (client
);
972 if (result
!= Success
)
980 PanoramiXFreeGC(ClientPtr client
)
985 REQUEST(xResourceReq
);
987 REQUEST_SIZE_MATCH(xResourceReq
);
989 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->id
, XRT_GC
,
990 client
, DixDestroyAccess
);
991 if (result
!= Success
)
994 FOR_NSCREENS_BACKWARD(j
) {
995 stuff
->id
= gc
->info
[j
].id
;
996 result
= (*SavedProcVector
[X_FreeGC
]) (client
);
997 if (result
!= Success
)
1001 /* Since ProcFreeGC is using FreeResource, it will free
1002 our resource for us on the last pass through the loop above */
1008 PanoramiXClearToBackground(ClientPtr client
)
1011 int result
, j
, x
, y
;
1014 REQUEST(xClearAreaReq
);
1016 REQUEST_SIZE_MATCH(xClearAreaReq
);
1018 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
1019 XRT_WINDOW
, client
, DixWriteAccess
);
1020 if (result
!= Success
)
1025 isRoot
= win
->u
.win
.root
;
1026 FOR_NSCREENS_BACKWARD(j
) {
1027 stuff
->window
= win
->info
[j
].id
;
1029 stuff
->x
= x
- screenInfo
.screens
[j
]->x
;
1030 stuff
->y
= y
- screenInfo
.screens
[j
]->y
;
1032 result
= (*SavedProcVector
[X_ClearArea
]) (client
);
1033 if (result
!= Success
)
1041 For Window to Pixmap copies you're screwed since each screen's
1042 pixmap will look like what it sees on its screen. Unless the
1043 screens overlap and the window lies on each, the two copies
1044 will be out of sync. To remedy this we do a GetImage and PutImage
1045 in place of the copy. Doing this as a single Image isn't quite
1046 correct since it will include the obscured areas but we will
1047 have to fix this later. (MArk).
1051 PanoramiXCopyArea(ClientPtr client
)
1053 int j
, result
, srcx
, srcy
, dstx
, dsty
;
1054 PanoramiXRes
*gc
, *src
, *dst
;
1055 Bool srcIsRoot
= FALSE
;
1056 Bool dstIsRoot
= FALSE
;
1057 Bool srcShared
, dstShared
;
1059 REQUEST(xCopyAreaReq
);
1061 REQUEST_SIZE_MATCH(xCopyAreaReq
);
1063 result
= dixLookupResourceByClass((pointer
*) &src
, stuff
->srcDrawable
,
1064 XRC_DRAWABLE
, client
, DixReadAccess
);
1065 if (result
!= Success
)
1066 return (result
== BadValue
) ? BadDrawable
: result
;
1068 srcShared
= IS_SHARED_PIXMAP(src
);
1070 result
= dixLookupResourceByClass((pointer
*) &dst
, stuff
->dstDrawable
,
1071 XRC_DRAWABLE
, client
, DixWriteAccess
);
1072 if (result
!= Success
)
1073 return (result
== BadValue
) ? BadDrawable
: result
;
1075 dstShared
= IS_SHARED_PIXMAP(dst
);
1077 if (dstShared
&& srcShared
)
1078 return (*SavedProcVector
[X_CopyArea
]) (client
);
1080 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1081 client
, DixReadAccess
);
1082 if (result
!= Success
)
1085 if ((dst
->type
== XRT_WINDOW
) && dst
->u
.win
.root
)
1087 if ((src
->type
== XRT_WINDOW
) && src
->u
.win
.root
)
1094 if ((dst
->type
== XRT_PIXMAP
) && (src
->type
== XRT_WINDOW
)) {
1095 DrawablePtr drawables
[MAXSCREENS
];
1102 rc
= dixLookupDrawable(drawables
+ j
, src
->info
[j
].id
, client
, 0,
1108 pitch
= PixmapBytePad(stuff
->width
, drawables
[0]->depth
);
1109 if (!(data
= calloc(1, stuff
->height
* pitch
)))
1112 XineramaGetImageData(drawables
, srcx
, srcy
,
1113 stuff
->width
, stuff
->height
, ZPixmap
, ~0, data
,
1116 FOR_NSCREENS_BACKWARD(j
) {
1117 stuff
->gc
= gc
->info
[j
].id
;
1118 VALIDATE_DRAWABLE_AND_GC(dst
->info
[j
].id
, pDst
, DixWriteAccess
);
1119 if (drawables
[0]->depth
!= pDst
->depth
) {
1120 client
->errorValue
= stuff
->dstDrawable
;
1125 (*pGC
->ops
->PutImage
) (pDst
, pGC
, pDst
->depth
, dstx
, dsty
,
1126 stuff
->width
, stuff
->height
,
1136 DrawablePtr pDst
= NULL
, pSrc
= NULL
;
1141 RegionNull(&totalReg
);
1142 FOR_NSCREENS_BACKWARD(j
) {
1145 stuff
->dstDrawable
= dst
->info
[j
].id
;
1146 stuff
->srcDrawable
= src
->info
[j
].id
;
1147 stuff
->gc
= gc
->info
[j
].id
;
1149 stuff
->srcX
= srcx
- screenInfo
.screens
[j
]->x
;
1150 stuff
->srcY
= srcy
- screenInfo
.screens
[j
]->y
;
1153 stuff
->dstX
= dstx
- screenInfo
.screens
[j
]->x
;
1154 stuff
->dstY
= dsty
- screenInfo
.screens
[j
]->y
;
1157 VALIDATE_DRAWABLE_AND_GC(stuff
->dstDrawable
, pDst
, DixWriteAccess
);
1159 if (stuff
->dstDrawable
!= stuff
->srcDrawable
) {
1160 rc
= dixLookupDrawable(&pSrc
, stuff
->srcDrawable
, client
, 0,
1165 if ((pDst
->pScreen
!= pSrc
->pScreen
) ||
1166 (pDst
->depth
!= pSrc
->depth
)) {
1167 client
->errorValue
= stuff
->dstDrawable
;
1174 pRgn
= (*pGC
->ops
->CopyArea
) (pSrc
, pDst
, pGC
,
1175 stuff
->srcX
, stuff
->srcY
,
1176 stuff
->width
, stuff
->height
,
1177 stuff
->dstX
, stuff
->dstY
);
1178 if (pGC
->graphicsExposures
&& pRgn
) {
1180 RegionTranslate(pRgn
,
1181 screenInfo
.screens
[j
]->x
,
1182 screenInfo
.screens
[j
]->y
);
1184 RegionAppend(&totalReg
, pRgn
);
1185 RegionDestroy(pRgn
);
1192 if (pGC
->graphicsExposures
) {
1195 RegionValidate(&totalReg
, &overlap
);
1196 (*pDst
->pScreen
->SendGraphicsExpose
) (client
, &totalReg
,
1199 RegionUninit(&totalReg
);
1207 PanoramiXCopyPlane(ClientPtr client
)
1209 int j
, srcx
, srcy
, dstx
, dsty
, rc
;
1210 PanoramiXRes
*gc
, *src
, *dst
;
1211 Bool srcIsRoot
= FALSE
;
1212 Bool dstIsRoot
= FALSE
;
1213 Bool srcShared
, dstShared
;
1214 DrawablePtr psrcDraw
, pdstDraw
= NULL
;
1218 REQUEST(xCopyPlaneReq
);
1220 REQUEST_SIZE_MATCH(xCopyPlaneReq
);
1222 rc
= dixLookupResourceByClass((pointer
*) &src
, stuff
->srcDrawable
,
1223 XRC_DRAWABLE
, client
, DixReadAccess
);
1225 return (rc
== BadValue
) ? BadDrawable
: rc
;
1227 srcShared
= IS_SHARED_PIXMAP(src
);
1229 rc
= dixLookupResourceByClass((pointer
*) &dst
, stuff
->dstDrawable
,
1230 XRC_DRAWABLE
, client
, DixWriteAccess
);
1232 return (rc
== BadValue
) ? BadDrawable
: rc
;
1234 dstShared
= IS_SHARED_PIXMAP(dst
);
1236 if (dstShared
&& srcShared
)
1237 return (*SavedProcVector
[X_CopyPlane
]) (client
);
1239 rc
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1240 client
, DixReadAccess
);
1244 if ((dst
->type
== XRT_WINDOW
) && dst
->u
.win
.root
)
1246 if ((src
->type
== XRT_WINDOW
) && src
->u
.win
.root
)
1254 RegionNull(&totalReg
);
1255 FOR_NSCREENS_BACKWARD(j
) {
1258 stuff
->dstDrawable
= dst
->info
[j
].id
;
1259 stuff
->srcDrawable
= src
->info
[j
].id
;
1260 stuff
->gc
= gc
->info
[j
].id
;
1262 stuff
->srcX
= srcx
- screenInfo
.screens
[j
]->x
;
1263 stuff
->srcY
= srcy
- screenInfo
.screens
[j
]->y
;
1266 stuff
->dstX
= dstx
- screenInfo
.screens
[j
]->x
;
1267 stuff
->dstY
= dsty
- screenInfo
.screens
[j
]->y
;
1270 VALIDATE_DRAWABLE_AND_GC(stuff
->dstDrawable
, pdstDraw
, DixWriteAccess
);
1271 if (stuff
->dstDrawable
!= stuff
->srcDrawable
) {
1272 rc
= dixLookupDrawable(&psrcDraw
, stuff
->srcDrawable
, client
, 0,
1277 if (pdstDraw
->pScreen
!= psrcDraw
->pScreen
) {
1278 client
->errorValue
= stuff
->dstDrawable
;
1283 psrcDraw
= pdstDraw
;
1285 if (stuff
->bitPlane
== 0 || (stuff
->bitPlane
& (stuff
->bitPlane
- 1)) ||
1286 (stuff
->bitPlane
> (1L << (psrcDraw
->depth
- 1)))) {
1287 client
->errorValue
= stuff
->bitPlane
;
1291 pRgn
= (*pGC
->ops
->CopyPlane
) (psrcDraw
, pdstDraw
, pGC
,
1292 stuff
->srcX
, stuff
->srcY
,
1293 stuff
->width
, stuff
->height
,
1294 stuff
->dstX
, stuff
->dstY
,
1296 if (pGC
->graphicsExposures
&& pRgn
) {
1297 RegionAppend(&totalReg
, pRgn
);
1298 RegionDestroy(pRgn
);
1305 if (pGC
->graphicsExposures
) {
1308 RegionValidate(&totalReg
, &overlap
);
1309 (*pdstDraw
->pScreen
->SendGraphicsExpose
) (client
, &totalReg
,
1312 RegionUninit(&totalReg
);
1319 PanoramiXPolyPoint(ClientPtr client
)
1321 PanoramiXRes
*gc
, *draw
;
1322 int result
, npoint
, j
;
1326 REQUEST(xPolyPointReq
);
1328 REQUEST_AT_LEAST_SIZE(xPolyPointReq
);
1330 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1331 XRC_DRAWABLE
, client
, DixWriteAccess
);
1332 if (result
!= Success
)
1333 return (result
== BadValue
) ? BadDrawable
: result
;
1335 if (IS_SHARED_PIXMAP(draw
))
1336 return (*SavedProcVector
[X_PolyPoint
]) (client
);
1338 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1339 client
, DixReadAccess
);
1340 if (result
!= Success
)
1343 isRoot
= (draw
->type
== XRT_WINDOW
) && draw
->u
.win
.root
;
1344 npoint
= bytes_to_int32((client
->req_len
<< 2) - sizeof(xPolyPointReq
));
1346 origPts
= malloc(npoint
* sizeof(xPoint
));
1347 memcpy((char *) origPts
, (char *) &stuff
[1], npoint
* sizeof(xPoint
));
1348 FOR_NSCREENS_FORWARD(j
) {
1351 memcpy(&stuff
[1], origPts
, npoint
* sizeof(xPoint
));
1354 int x_off
= screenInfo
.screens
[j
]->x
;
1355 int y_off
= screenInfo
.screens
[j
]->y
;
1357 if (x_off
|| y_off
) {
1358 xPoint
*pnts
= (xPoint
*) &stuff
[1];
1360 (stuff
->coordMode
== CoordModePrevious
) ? 1 : npoint
;
1370 stuff
->drawable
= draw
->info
[j
].id
;
1371 stuff
->gc
= gc
->info
[j
].id
;
1372 result
= (*SavedProcVector
[X_PolyPoint
]) (client
);
1373 if (result
!= Success
)
1384 PanoramiXPolyLine(ClientPtr client
)
1386 PanoramiXRes
*gc
, *draw
;
1387 int result
, npoint
, j
;
1391 REQUEST(xPolyLineReq
);
1393 REQUEST_AT_LEAST_SIZE(xPolyLineReq
);
1395 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1396 XRC_DRAWABLE
, client
, DixWriteAccess
);
1397 if (result
!= Success
)
1398 return (result
== BadValue
) ? BadDrawable
: result
;
1400 if (IS_SHARED_PIXMAP(draw
))
1401 return (*SavedProcVector
[X_PolyLine
]) (client
);
1403 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1404 client
, DixReadAccess
);
1405 if (result
!= Success
)
1408 isRoot
= IS_ROOT_DRAWABLE(draw
);
1409 npoint
= bytes_to_int32((client
->req_len
<< 2) - sizeof(xPolyLineReq
));
1411 origPts
= malloc(npoint
* sizeof(xPoint
));
1412 memcpy((char *) origPts
, (char *) &stuff
[1], npoint
* sizeof(xPoint
));
1413 FOR_NSCREENS_FORWARD(j
) {
1416 memcpy(&stuff
[1], origPts
, npoint
* sizeof(xPoint
));
1419 int x_off
= screenInfo
.screens
[j
]->x
;
1420 int y_off
= screenInfo
.screens
[j
]->y
;
1422 if (x_off
|| y_off
) {
1423 xPoint
*pnts
= (xPoint
*) &stuff
[1];
1425 (stuff
->coordMode
== CoordModePrevious
) ? 1 : npoint
;
1435 stuff
->drawable
= draw
->info
[j
].id
;
1436 stuff
->gc
= gc
->info
[j
].id
;
1437 result
= (*SavedProcVector
[X_PolyLine
]) (client
);
1438 if (result
!= Success
)
1449 PanoramiXPolySegment(ClientPtr client
)
1451 int result
, nsegs
, i
, j
;
1452 PanoramiXRes
*gc
, *draw
;
1456 REQUEST(xPolySegmentReq
);
1458 REQUEST_AT_LEAST_SIZE(xPolySegmentReq
);
1460 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1461 XRC_DRAWABLE
, client
, DixWriteAccess
);
1462 if (result
!= Success
)
1463 return (result
== BadValue
) ? BadDrawable
: result
;
1465 if (IS_SHARED_PIXMAP(draw
))
1466 return (*SavedProcVector
[X_PolySegment
]) (client
);
1468 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1469 client
, DixReadAccess
);
1470 if (result
!= Success
)
1473 isRoot
= IS_ROOT_DRAWABLE(draw
);
1475 nsegs
= (client
->req_len
<< 2) - sizeof(xPolySegmentReq
);
1480 origSegs
= malloc(nsegs
* sizeof(xSegment
));
1481 memcpy((char *) origSegs
, (char *) &stuff
[1], nsegs
* sizeof(xSegment
));
1482 FOR_NSCREENS_FORWARD(j
) {
1485 memcpy(&stuff
[1], origSegs
, nsegs
* sizeof(xSegment
));
1488 int x_off
= screenInfo
.screens
[j
]->x
;
1489 int y_off
= screenInfo
.screens
[j
]->y
;
1491 if (x_off
|| y_off
) {
1492 xSegment
*segs
= (xSegment
*) &stuff
[1];
1494 for (i
= nsegs
; i
--; segs
++) {
1503 stuff
->drawable
= draw
->info
[j
].id
;
1504 stuff
->gc
= gc
->info
[j
].id
;
1505 result
= (*SavedProcVector
[X_PolySegment
]) (client
);
1506 if (result
!= Success
)
1517 PanoramiXPolyRectangle(ClientPtr client
)
1519 int result
, nrects
, i
, j
;
1520 PanoramiXRes
*gc
, *draw
;
1522 xRectangle
*origRecs
;
1524 REQUEST(xPolyRectangleReq
);
1526 REQUEST_AT_LEAST_SIZE(xPolyRectangleReq
);
1528 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1529 XRC_DRAWABLE
, client
, DixWriteAccess
);
1530 if (result
!= Success
)
1531 return (result
== BadValue
) ? BadDrawable
: result
;
1533 if (IS_SHARED_PIXMAP(draw
))
1534 return (*SavedProcVector
[X_PolyRectangle
]) (client
);
1536 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1537 client
, DixReadAccess
);
1538 if (result
!= Success
)
1541 isRoot
= IS_ROOT_DRAWABLE(draw
);
1543 nrects
= (client
->req_len
<< 2) - sizeof(xPolyRectangleReq
);
1548 origRecs
= malloc(nrects
* sizeof(xRectangle
));
1549 memcpy((char *) origRecs
, (char *) &stuff
[1],
1550 nrects
* sizeof(xRectangle
));
1551 FOR_NSCREENS_FORWARD(j
) {
1554 memcpy(&stuff
[1], origRecs
, nrects
* sizeof(xRectangle
));
1557 int x_off
= screenInfo
.screens
[j
]->x
;
1558 int y_off
= screenInfo
.screens
[j
]->y
;
1560 if (x_off
|| y_off
) {
1561 xRectangle
*rects
= (xRectangle
*) &stuff
[1];
1563 for (i
= nrects
; i
--; rects
++) {
1570 stuff
->drawable
= draw
->info
[j
].id
;
1571 stuff
->gc
= gc
->info
[j
].id
;
1572 result
= (*SavedProcVector
[X_PolyRectangle
]) (client
);
1573 if (result
!= Success
)
1584 PanoramiXPolyArc(ClientPtr client
)
1586 int result
, narcs
, i
, j
;
1587 PanoramiXRes
*gc
, *draw
;
1591 REQUEST(xPolyArcReq
);
1593 REQUEST_AT_LEAST_SIZE(xPolyArcReq
);
1595 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1596 XRC_DRAWABLE
, client
, DixWriteAccess
);
1597 if (result
!= Success
)
1598 return (result
== BadValue
) ? BadDrawable
: result
;
1600 if (IS_SHARED_PIXMAP(draw
))
1601 return (*SavedProcVector
[X_PolyArc
]) (client
);
1603 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1604 client
, DixReadAccess
);
1605 if (result
!= Success
)
1608 isRoot
= IS_ROOT_DRAWABLE(draw
);
1610 narcs
= (client
->req_len
<< 2) - sizeof(xPolyArcReq
);
1611 if (narcs
% sizeof(xArc
))
1613 narcs
/= sizeof(xArc
);
1615 origArcs
= malloc(narcs
* sizeof(xArc
));
1616 memcpy((char *) origArcs
, (char *) &stuff
[1], narcs
* sizeof(xArc
));
1617 FOR_NSCREENS_FORWARD(j
) {
1620 memcpy(&stuff
[1], origArcs
, narcs
* sizeof(xArc
));
1623 int x_off
= screenInfo
.screens
[j
]->x
;
1624 int y_off
= screenInfo
.screens
[j
]->y
;
1626 if (x_off
|| y_off
) {
1627 xArc
*arcs
= (xArc
*) &stuff
[1];
1629 for (i
= narcs
; i
--; arcs
++) {
1635 stuff
->drawable
= draw
->info
[j
].id
;
1636 stuff
->gc
= gc
->info
[j
].id
;
1637 result
= (*SavedProcVector
[X_PolyArc
]) (client
);
1638 if (result
!= Success
)
1649 PanoramiXFillPoly(ClientPtr client
)
1651 int result
, count
, j
;
1652 PanoramiXRes
*gc
, *draw
;
1656 REQUEST(xFillPolyReq
);
1658 REQUEST_AT_LEAST_SIZE(xFillPolyReq
);
1660 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1661 XRC_DRAWABLE
, client
, DixWriteAccess
);
1662 if (result
!= Success
)
1663 return (result
== BadValue
) ? BadDrawable
: result
;
1665 if (IS_SHARED_PIXMAP(draw
))
1666 return (*SavedProcVector
[X_FillPoly
]) (client
);
1668 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1669 client
, DixReadAccess
);
1670 if (result
!= Success
)
1673 isRoot
= IS_ROOT_DRAWABLE(draw
);
1675 count
= bytes_to_int32((client
->req_len
<< 2) - sizeof(xFillPolyReq
));
1677 locPts
= malloc(count
* sizeof(DDXPointRec
));
1678 memcpy((char *) locPts
, (char *) &stuff
[1],
1679 count
* sizeof(DDXPointRec
));
1680 FOR_NSCREENS_FORWARD(j
) {
1683 memcpy(&stuff
[1], locPts
, count
* sizeof(DDXPointRec
));
1686 int x_off
= screenInfo
.screens
[j
]->x
;
1687 int y_off
= screenInfo
.screens
[j
]->y
;
1689 if (x_off
|| y_off
) {
1690 DDXPointPtr pnts
= (DDXPointPtr
) &stuff
[1];
1691 int i
= (stuff
->coordMode
== CoordModePrevious
) ? 1 : count
;
1701 stuff
->drawable
= draw
->info
[j
].id
;
1702 stuff
->gc
= gc
->info
[j
].id
;
1703 result
= (*SavedProcVector
[X_FillPoly
]) (client
);
1704 if (result
!= Success
)
1715 PanoramiXPolyFillRectangle(ClientPtr client
)
1717 int result
, things
, i
, j
;
1718 PanoramiXRes
*gc
, *draw
;
1720 xRectangle
*origRects
;
1722 REQUEST(xPolyFillRectangleReq
);
1724 REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq
);
1726 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1727 XRC_DRAWABLE
, client
, DixWriteAccess
);
1728 if (result
!= Success
)
1729 return (result
== BadValue
) ? BadDrawable
: result
;
1731 if (IS_SHARED_PIXMAP(draw
))
1732 return (*SavedProcVector
[X_PolyFillRectangle
]) (client
);
1734 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1735 client
, DixReadAccess
);
1736 if (result
!= Success
)
1739 isRoot
= IS_ROOT_DRAWABLE(draw
);
1741 things
= (client
->req_len
<< 2) - sizeof(xPolyFillRectangleReq
);
1746 origRects
= malloc(things
* sizeof(xRectangle
));
1747 memcpy((char *) origRects
, (char *) &stuff
[1],
1748 things
* sizeof(xRectangle
));
1749 FOR_NSCREENS_FORWARD(j
) {
1752 memcpy(&stuff
[1], origRects
, things
* sizeof(xRectangle
));
1755 int x_off
= screenInfo
.screens
[j
]->x
;
1756 int y_off
= screenInfo
.screens
[j
]->y
;
1758 if (x_off
|| y_off
) {
1759 xRectangle
*rects
= (xRectangle
*) &stuff
[1];
1761 for (i
= things
; i
--; rects
++) {
1768 stuff
->drawable
= draw
->info
[j
].id
;
1769 stuff
->gc
= gc
->info
[j
].id
;
1770 result
= (*SavedProcVector
[X_PolyFillRectangle
]) (client
);
1771 if (result
!= Success
)
1782 PanoramiXPolyFillArc(ClientPtr client
)
1784 PanoramiXRes
*gc
, *draw
;
1786 int result
, narcs
, i
, j
;
1789 REQUEST(xPolyFillArcReq
);
1791 REQUEST_AT_LEAST_SIZE(xPolyFillArcReq
);
1793 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1794 XRC_DRAWABLE
, client
, DixWriteAccess
);
1795 if (result
!= Success
)
1796 return (result
== BadValue
) ? BadDrawable
: result
;
1798 if (IS_SHARED_PIXMAP(draw
))
1799 return (*SavedProcVector
[X_PolyFillArc
]) (client
);
1801 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1802 client
, DixReadAccess
);
1803 if (result
!= Success
)
1806 isRoot
= IS_ROOT_DRAWABLE(draw
);
1808 narcs
= (client
->req_len
<< 2) - sizeof(xPolyFillArcReq
);
1809 if (narcs
% sizeof(xArc
))
1811 narcs
/= sizeof(xArc
);
1813 origArcs
= malloc(narcs
* sizeof(xArc
));
1814 memcpy((char *) origArcs
, (char *) &stuff
[1], narcs
* sizeof(xArc
));
1815 FOR_NSCREENS_FORWARD(j
) {
1818 memcpy(&stuff
[1], origArcs
, narcs
* sizeof(xArc
));
1821 int x_off
= screenInfo
.screens
[j
]->x
;
1822 int y_off
= screenInfo
.screens
[j
]->y
;
1824 if (x_off
|| y_off
) {
1825 xArc
*arcs
= (xArc
*) &stuff
[1];
1827 for (i
= narcs
; i
--; arcs
++) {
1834 stuff
->drawable
= draw
->info
[j
].id
;
1835 stuff
->gc
= gc
->info
[j
].id
;
1836 result
= (*SavedProcVector
[X_PolyFillArc
]) (client
);
1837 if (result
!= Success
)
1848 PanoramiXPutImage(ClientPtr client
)
1850 PanoramiXRes
*gc
, *draw
;
1852 int j
, result
, orig_x
, orig_y
;
1854 REQUEST(xPutImageReq
);
1856 REQUEST_AT_LEAST_SIZE(xPutImageReq
);
1858 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1859 XRC_DRAWABLE
, client
, DixWriteAccess
);
1860 if (result
!= Success
)
1861 return (result
== BadValue
) ? BadDrawable
: result
;
1863 if (IS_SHARED_PIXMAP(draw
))
1864 return (*SavedProcVector
[X_PutImage
]) (client
);
1866 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
1867 client
, DixReadAccess
);
1868 if (result
!= Success
)
1871 isRoot
= IS_ROOT_DRAWABLE(draw
);
1873 orig_x
= stuff
->dstX
;
1874 orig_y
= stuff
->dstY
;
1875 FOR_NSCREENS_BACKWARD(j
) {
1877 stuff
->dstX
= orig_x
- screenInfo
.screens
[j
]->x
;
1878 stuff
->dstY
= orig_y
- screenInfo
.screens
[j
]->y
;
1880 stuff
->drawable
= draw
->info
[j
].id
;
1881 stuff
->gc
= gc
->info
[j
].id
;
1882 result
= (*SavedProcVector
[X_PutImage
]) (client
);
1883 if (result
!= Success
)
1890 PanoramiXGetImage(ClientPtr client
)
1892 DrawablePtr drawables
[MAXSCREENS
];
1898 int i
, x
, y
, w
, h
, format
, rc
;
1899 Mask plane
= 0, planemask
;
1900 int linesDone
, nlines
, linesPerBuf
;
1901 long widthBytesLine
, length
;
1903 REQUEST(xGetImageReq
);
1905 REQUEST_SIZE_MATCH(xGetImageReq
);
1907 if ((stuff
->format
!= XYPixmap
) && (stuff
->format
!= ZPixmap
)) {
1908 client
->errorValue
= stuff
->format
;
1912 rc
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
1913 XRC_DRAWABLE
, client
, DixWriteAccess
);
1915 return (rc
== BadValue
) ? BadDrawable
: rc
;
1917 if (draw
->type
== XRT_PIXMAP
)
1918 return (*SavedProcVector
[X_GetImage
]) (client
);
1920 rc
= dixLookupDrawable(&pDraw
, stuff
->drawable
, client
, 0, DixReadAccess
);
1924 if (!((WindowPtr
) pDraw
)->realized
)
1931 format
= stuff
->format
;
1932 planemask
= stuff
->planeMask
;
1934 isRoot
= IS_ROOT_DRAWABLE(draw
);
1937 /* check for being onscreen */
1938 if (x
< 0 || x
+ w
> PanoramiXPixWidth
||
1939 y
< 0 || y
+ h
> PanoramiXPixHeight
)
1943 /* check for being onscreen and inside of border */
1944 if (screenInfo
.screens
[0]->x
+ pDraw
->x
+ x
< 0 ||
1945 screenInfo
.screens
[0]->x
+ pDraw
->x
+ x
+ w
> PanoramiXPixWidth
||
1946 screenInfo
.screens
[0]->y
+ pDraw
->y
+ y
< 0 ||
1947 screenInfo
.screens
[0]->y
+ pDraw
->y
+ y
+ h
> PanoramiXPixHeight
||
1948 x
< -wBorderWidth((WindowPtr
) pDraw
) ||
1949 x
+ w
> wBorderWidth((WindowPtr
) pDraw
) + (int) pDraw
->width
||
1950 y
< -wBorderWidth((WindowPtr
) pDraw
) ||
1951 y
+ h
> wBorderWidth((WindowPtr
) pDraw
) + (int) pDraw
->height
)
1955 drawables
[0] = pDraw
;
1956 FOR_NSCREENS_FORWARD_SKIP(i
) {
1957 rc
= dixLookupDrawable(drawables
+ i
, draw
->info
[i
].id
, client
, 0,
1963 xgi
= (xGetImageReply
) {
1965 .sequenceNumber
= client
->sequence
,
1966 .visual
= wVisual(((WindowPtr
) pDraw
)),
1967 .depth
= pDraw
->depth
1969 if (format
== ZPixmap
) {
1970 widthBytesLine
= PixmapBytePad(w
, pDraw
->depth
);
1971 length
= widthBytesLine
* h
;
1975 widthBytesLine
= BitmapBytePad(w
);
1976 plane
= ((Mask
) 1) << (pDraw
->depth
- 1);
1977 /* only planes asked for */
1978 length
= widthBytesLine
* h
* Ones(planemask
& (plane
| (plane
- 1)));
1982 xgi
.length
= bytes_to_int32(length
);
1984 if (widthBytesLine
== 0 || h
== 0)
1986 else if (widthBytesLine
>= XINERAMA_IMAGE_BUFSIZE
)
1989 linesPerBuf
= XINERAMA_IMAGE_BUFSIZE
/ widthBytesLine
;
1990 if (linesPerBuf
> h
)
1993 length
= linesPerBuf
* widthBytesLine
;
1994 if (!(pBuf
= malloc(length
)))
1997 WriteReplyToClient(client
, sizeof(xGetImageReply
), &xgi
);
1999 if (linesPerBuf
== 0) {
2002 else if (format
== ZPixmap
) {
2004 while (h
- linesDone
> 0) {
2005 nlines
= min(linesPerBuf
, h
- linesDone
);
2007 if (pDraw
->depth
== 1)
2008 memset(pBuf
, 0, nlines
* widthBytesLine
);
2010 XineramaGetImageData(drawables
, x
, y
+ linesDone
, w
, nlines
,
2011 format
, planemask
, pBuf
, widthBytesLine
,
2014 WriteToClient(client
, (int) (nlines
* widthBytesLine
), pBuf
);
2015 linesDone
+= nlines
;
2018 else { /* XYPixmap */
2019 for (; plane
; plane
>>= 1) {
2020 if (planemask
& plane
) {
2022 while (h
- linesDone
> 0) {
2023 nlines
= min(linesPerBuf
, h
- linesDone
);
2025 memset(pBuf
, 0, nlines
* widthBytesLine
);
2027 XineramaGetImageData(drawables
, x
, y
+ linesDone
, w
,
2028 nlines
, format
, plane
, pBuf
,
2029 widthBytesLine
, isRoot
);
2031 WriteToClient(client
, (int)(nlines
* widthBytesLine
), pBuf
);
2033 linesDone
+= nlines
;
2042 /* The text stuff should be rewritten so that duplication happens
2043 at the GlyphBlt level. That is, loading the font and getting
2044 the glyphs should only happen once */
2047 PanoramiXPolyText8(ClientPtr client
)
2049 PanoramiXRes
*gc
, *draw
;
2054 REQUEST(xPolyTextReq
);
2056 REQUEST_AT_LEAST_SIZE(xPolyTextReq
);
2058 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
2059 XRC_DRAWABLE
, client
, DixWriteAccess
);
2060 if (result
!= Success
)
2061 return (result
== BadValue
) ? BadDrawable
: result
;
2063 if (IS_SHARED_PIXMAP(draw
))
2064 return (*SavedProcVector
[X_PolyText8
]) (client
);
2066 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
2067 client
, DixReadAccess
);
2068 if (result
!= Success
)
2071 isRoot
= IS_ROOT_DRAWABLE(draw
);
2075 FOR_NSCREENS_BACKWARD(j
) {
2076 stuff
->drawable
= draw
->info
[j
].id
;
2077 stuff
->gc
= gc
->info
[j
].id
;
2079 stuff
->x
= orig_x
- screenInfo
.screens
[j
]->x
;
2080 stuff
->y
= orig_y
- screenInfo
.screens
[j
]->y
;
2082 result
= (*SavedProcVector
[X_PolyText8
]) (client
);
2083 if (result
!= Success
)
2090 PanoramiXPolyText16(ClientPtr client
)
2092 PanoramiXRes
*gc
, *draw
;
2097 REQUEST(xPolyTextReq
);
2099 REQUEST_AT_LEAST_SIZE(xPolyTextReq
);
2101 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
2102 XRC_DRAWABLE
, client
, DixWriteAccess
);
2103 if (result
!= Success
)
2104 return (result
== BadValue
) ? BadDrawable
: result
;
2106 if (IS_SHARED_PIXMAP(draw
))
2107 return (*SavedProcVector
[X_PolyText16
]) (client
);
2109 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
2110 client
, DixReadAccess
);
2111 if (result
!= Success
)
2114 isRoot
= IS_ROOT_DRAWABLE(draw
);
2118 FOR_NSCREENS_BACKWARD(j
) {
2119 stuff
->drawable
= draw
->info
[j
].id
;
2120 stuff
->gc
= gc
->info
[j
].id
;
2122 stuff
->x
= orig_x
- screenInfo
.screens
[j
]->x
;
2123 stuff
->y
= orig_y
- screenInfo
.screens
[j
]->y
;
2125 result
= (*SavedProcVector
[X_PolyText16
]) (client
);
2126 if (result
!= Success
)
2133 PanoramiXImageText8(ClientPtr client
)
2136 PanoramiXRes
*gc
, *draw
;
2140 REQUEST(xImageTextReq
);
2142 REQUEST_FIXED_SIZE(xImageTextReq
, stuff
->nChars
);
2144 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
2145 XRC_DRAWABLE
, client
, DixWriteAccess
);
2146 if (result
!= Success
)
2147 return (result
== BadValue
) ? BadDrawable
: result
;
2149 if (IS_SHARED_PIXMAP(draw
))
2150 return (*SavedProcVector
[X_ImageText8
]) (client
);
2152 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
2153 client
, DixReadAccess
);
2154 if (result
!= Success
)
2157 isRoot
= IS_ROOT_DRAWABLE(draw
);
2161 FOR_NSCREENS_BACKWARD(j
) {
2162 stuff
->drawable
= draw
->info
[j
].id
;
2163 stuff
->gc
= gc
->info
[j
].id
;
2165 stuff
->x
= orig_x
- screenInfo
.screens
[j
]->x
;
2166 stuff
->y
= orig_y
- screenInfo
.screens
[j
]->y
;
2168 result
= (*SavedProcVector
[X_ImageText8
]) (client
);
2169 if (result
!= Success
)
2176 PanoramiXImageText16(ClientPtr client
)
2179 PanoramiXRes
*gc
, *draw
;
2183 REQUEST(xImageTextReq
);
2185 REQUEST_FIXED_SIZE(xImageTextReq
, stuff
->nChars
<< 1);
2187 result
= dixLookupResourceByClass((pointer
*) &draw
, stuff
->drawable
,
2188 XRC_DRAWABLE
, client
, DixWriteAccess
);
2189 if (result
!= Success
)
2190 return (result
== BadValue
) ? BadDrawable
: result
;
2192 if (IS_SHARED_PIXMAP(draw
))
2193 return (*SavedProcVector
[X_ImageText16
]) (client
);
2195 result
= dixLookupResourceByType((pointer
*) &gc
, stuff
->gc
, XRT_GC
,
2196 client
, DixReadAccess
);
2197 if (result
!= Success
)
2200 isRoot
= IS_ROOT_DRAWABLE(draw
);
2204 FOR_NSCREENS_BACKWARD(j
) {
2205 stuff
->drawable
= draw
->info
[j
].id
;
2206 stuff
->gc
= gc
->info
[j
].id
;
2208 stuff
->x
= orig_x
- screenInfo
.screens
[j
]->x
;
2209 stuff
->y
= orig_y
- screenInfo
.screens
[j
]->y
;
2211 result
= (*SavedProcVector
[X_ImageText16
]) (client
);
2212 if (result
!= Success
)
2219 PanoramiXCreateColormap(ClientPtr client
)
2221 PanoramiXRes
*win
, *newCmap
;
2222 int result
, j
, orig_visual
;
2224 REQUEST(xCreateColormapReq
);
2226 REQUEST_SIZE_MATCH(xCreateColormapReq
);
2228 result
= dixLookupResourceByType((pointer
*) &win
, stuff
->window
,
2229 XRT_WINDOW
, client
, DixReadAccess
);
2230 if (result
!= Success
)
2233 if (!(newCmap
= malloc(sizeof(PanoramiXRes
))))
2236 newCmap
->type
= XRT_COLORMAP
;
2237 panoramix_setup_ids(newCmap
, client
, stuff
->mid
);
2239 orig_visual
= stuff
->visual
;
2240 FOR_NSCREENS_BACKWARD(j
) {
2241 stuff
->mid
= newCmap
->info
[j
].id
;
2242 stuff
->window
= win
->info
[j
].id
;
2243 stuff
->visual
= PanoramiXTranslateVisualID(j
, orig_visual
);
2244 result
= (*SavedProcVector
[X_CreateColormap
]) (client
);
2245 if (result
!= Success
)
2249 if (result
== Success
)
2250 AddResource(newCmap
->info
[0].id
, XRT_COLORMAP
, newCmap
);
2258 PanoramiXFreeColormap(ClientPtr client
)
2263 REQUEST(xResourceReq
);
2265 REQUEST_SIZE_MATCH(xResourceReq
);
2267 client
->errorValue
= stuff
->id
;
2269 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->id
, XRT_COLORMAP
,
2270 client
, DixDestroyAccess
);
2271 if (result
!= Success
)
2274 FOR_NSCREENS_BACKWARD(j
) {
2275 stuff
->id
= cmap
->info
[j
].id
;
2276 result
= (*SavedProcVector
[X_FreeColormap
]) (client
);
2277 if (result
!= Success
)
2281 /* Since ProcFreeColormap is using FreeResource, it will free
2282 our resource for us on the last pass through the loop above */
2288 PanoramiXCopyColormapAndFree(ClientPtr client
)
2290 PanoramiXRes
*cmap
, *newCmap
;
2293 REQUEST(xCopyColormapAndFreeReq
);
2295 REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq
);
2297 client
->errorValue
= stuff
->srcCmap
;
2299 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->srcCmap
,
2300 XRT_COLORMAP
, client
,
2301 DixReadAccess
| DixWriteAccess
);
2302 if (result
!= Success
)
2305 if (!(newCmap
= malloc(sizeof(PanoramiXRes
))))
2308 newCmap
->type
= XRT_COLORMAP
;
2309 panoramix_setup_ids(newCmap
, client
, stuff
->mid
);
2311 FOR_NSCREENS_BACKWARD(j
) {
2312 stuff
->srcCmap
= cmap
->info
[j
].id
;
2313 stuff
->mid
= newCmap
->info
[j
].id
;
2314 result
= (*SavedProcVector
[X_CopyColormapAndFree
]) (client
);
2315 if (result
!= Success
)
2319 if (result
== Success
)
2320 AddResource(newCmap
->info
[0].id
, XRT_COLORMAP
, newCmap
);
2328 PanoramiXInstallColormap(ClientPtr client
)
2330 REQUEST(xResourceReq
);
2334 REQUEST_SIZE_MATCH(xResourceReq
);
2336 client
->errorValue
= stuff
->id
;
2338 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->id
, XRT_COLORMAP
,
2339 client
, DixReadAccess
);
2340 if (result
!= Success
)
2343 FOR_NSCREENS_BACKWARD(j
) {
2344 stuff
->id
= cmap
->info
[j
].id
;
2345 result
= (*SavedProcVector
[X_InstallColormap
]) (client
);
2346 if (result
!= Success
)
2353 PanoramiXUninstallColormap(ClientPtr client
)
2355 REQUEST(xResourceReq
);
2359 REQUEST_SIZE_MATCH(xResourceReq
);
2361 client
->errorValue
= stuff
->id
;
2363 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->id
, XRT_COLORMAP
,
2364 client
, DixReadAccess
);
2365 if (result
!= Success
)
2368 FOR_NSCREENS_BACKWARD(j
) {
2369 stuff
->id
= cmap
->info
[j
].id
;
2370 result
= (*SavedProcVector
[X_UninstallColormap
]) (client
);
2371 if (result
!= Success
)
2378 PanoramiXAllocColor(ClientPtr client
)
2383 REQUEST(xAllocColorReq
);
2385 REQUEST_SIZE_MATCH(xAllocColorReq
);
2387 client
->errorValue
= stuff
->cmap
;
2389 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2390 XRT_COLORMAP
, client
, DixWriteAccess
);
2391 if (result
!= Success
)
2394 FOR_NSCREENS_BACKWARD(j
) {
2395 stuff
->cmap
= cmap
->info
[j
].id
;
2396 result
= (*SavedProcVector
[X_AllocColor
]) (client
);
2397 if (result
!= Success
)
2404 PanoramiXAllocNamedColor(ClientPtr client
)
2409 REQUEST(xAllocNamedColorReq
);
2411 REQUEST_FIXED_SIZE(xAllocNamedColorReq
, stuff
->nbytes
);
2413 client
->errorValue
= stuff
->cmap
;
2415 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2416 XRT_COLORMAP
, client
, DixWriteAccess
);
2417 if (result
!= Success
)
2420 FOR_NSCREENS_BACKWARD(j
) {
2421 stuff
->cmap
= cmap
->info
[j
].id
;
2422 result
= (*SavedProcVector
[X_AllocNamedColor
]) (client
);
2423 if (result
!= Success
)
2430 PanoramiXAllocColorCells(ClientPtr client
)
2435 REQUEST(xAllocColorCellsReq
);
2437 REQUEST_SIZE_MATCH(xAllocColorCellsReq
);
2439 client
->errorValue
= stuff
->cmap
;
2441 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2442 XRT_COLORMAP
, client
, DixWriteAccess
);
2443 if (result
!= Success
)
2446 FOR_NSCREENS_BACKWARD(j
) {
2447 stuff
->cmap
= cmap
->info
[j
].id
;
2448 result
= (*SavedProcVector
[X_AllocColorCells
]) (client
);
2449 if (result
!= Success
)
2456 PanoramiXAllocColorPlanes(ClientPtr client
)
2461 REQUEST(xAllocColorPlanesReq
);
2463 REQUEST_SIZE_MATCH(xAllocColorPlanesReq
);
2465 client
->errorValue
= stuff
->cmap
;
2467 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2468 XRT_COLORMAP
, client
, DixWriteAccess
);
2469 if (result
!= Success
)
2472 FOR_NSCREENS_BACKWARD(j
) {
2473 stuff
->cmap
= cmap
->info
[j
].id
;
2474 result
= (*SavedProcVector
[X_AllocColorPlanes
]) (client
);
2475 if (result
!= Success
)
2482 PanoramiXFreeColors(ClientPtr client
)
2487 REQUEST(xFreeColorsReq
);
2489 REQUEST_AT_LEAST_SIZE(xFreeColorsReq
);
2491 client
->errorValue
= stuff
->cmap
;
2493 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2494 XRT_COLORMAP
, client
, DixWriteAccess
);
2495 if (result
!= Success
)
2498 FOR_NSCREENS_BACKWARD(j
) {
2499 stuff
->cmap
= cmap
->info
[j
].id
;
2500 result
= (*SavedProcVector
[X_FreeColors
]) (client
);
2506 PanoramiXStoreColors(ClientPtr client
)
2511 REQUEST(xStoreColorsReq
);
2513 REQUEST_AT_LEAST_SIZE(xStoreColorsReq
);
2515 client
->errorValue
= stuff
->cmap
;
2517 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2518 XRT_COLORMAP
, client
, DixWriteAccess
);
2519 if (result
!= Success
)
2522 FOR_NSCREENS_BACKWARD(j
) {
2523 stuff
->cmap
= cmap
->info
[j
].id
;
2524 result
= (*SavedProcVector
[X_StoreColors
]) (client
);
2525 if (result
!= Success
)
2532 PanoramiXStoreNamedColor(ClientPtr client
)
2537 REQUEST(xStoreNamedColorReq
);
2539 REQUEST_FIXED_SIZE(xStoreNamedColorReq
, stuff
->nbytes
);
2541 client
->errorValue
= stuff
->cmap
;
2543 result
= dixLookupResourceByType((pointer
*) &cmap
, stuff
->cmap
,
2544 XRT_COLORMAP
, client
, DixWriteAccess
);
2545 if (result
!= Success
)
2548 FOR_NSCREENS_BACKWARD(j
) {
2549 stuff
->cmap
= cmap
->info
[j
].id
;
2550 result
= (*SavedProcVector
[X_StoreNamedColor
]) (client
);
2551 if (result
!= Success
)