1 /***********************************************************
3 Copyright 1987, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
26 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 ******************************************************************/
47 /*****************************************************************
49 Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
51 Permission is hereby granted, free of charge, to any person obtaining a copy
52 of this software and associated documentation files (the "Software"), to deal
53 in the Software without restriction, including without limitation the rights
54 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55 copies of the Software.
57 The above copyright notice and this permission notice shall be included in
58 all copies or substantial portions of the Software.
60 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
63 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
64 BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
65 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
66 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
68 Except as contained in this notice, the name of Digital Equipment Corporation
69 shall not be used in advertising or otherwise to promote the sale, use or other
70 dealings in this Software without prior written authorization from Digital
71 Equipment Corporation.
73 ******************************************************************/
76 #ifdef HAVE_DIX_CONFIG_H
77 #include <dix-config.h>
82 #include <X11/Xproto.h>
83 #include <X11/Xprotostr.h>
86 #include "regionstr.h"
87 #include "scrnintstr.h"
89 #include "windowstr.h"
93 #include "dixstruct.h"
100 #include "panoramiX.h"
101 #include "panoramiXsrv.h"
105 machine-independent graphics exposure code. any device that uses
106 the region package can call this.
110 #define RECTLIMIT 25 /* pick a number, any number > 8 */
114 generate a region for exposures for areas that were copied from obscured or
115 non-existent areas to non-obscured areas of the destination. Paint the
116 background for the region, if the destination is a window.
119 this should generally be called, even if graphicsExposures is false,
120 because this is where bits get recovered from backing store.
123 added argument 'plane' is used to indicate how exposures from backing
124 store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea
125 should be used, else a CopyPlane of the indicated plane will be used. The
126 exposing is done by the backing store's GraphicsExpose function, of course.
131 miHandleExposures(pSrcDrawable
, pDstDrawable
,
132 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
, plane
)
133 DrawablePtr pSrcDrawable
;
134 DrawablePtr pDstDrawable
;
142 RegionPtr prgnSrcClip
; /* drawable-relative source clip */
144 RegionPtr prgnDstClip
; /* drawable-relative dest clip */
146 BoxRec srcBox
; /* unclipped source */
147 RegionRec rgnExposed
; /* exposed region, calculated source-
148 relative, made dst relative to
149 intersect with visible parts of
150 dest and send events to client,
151 and then screen relative to paint
152 the window background
158 /* This prevents warning about pscr not being used. */
159 pGC
->pScreen
= pscr
= pGC
->pScreen
;
161 /* avoid work if we can */
162 if (!pGC
->graphicsExposures
&&
163 (pDstDrawable
->type
== DRAWABLE_PIXMAP
) &&
164 ((pSrcDrawable
->type
== DRAWABLE_PIXMAP
) ||
165 (((WindowPtr
)pSrcDrawable
)->backStorage
== NULL
)))
170 srcBox
.x2
= srcx
+width
;
171 srcBox
.y2
= srcy
+height
;
173 if (pSrcDrawable
->type
!= DRAWABLE_PIXMAP
)
177 TsrcBox
.x1
= srcx
+ pSrcDrawable
->x
;
178 TsrcBox
.y1
= srcy
+ pSrcDrawable
->y
;
179 TsrcBox
.x2
= TsrcBox
.x1
+ width
;
180 TsrcBox
.y2
= TsrcBox
.y1
+ height
;
181 pSrcWin
= (WindowPtr
) pSrcDrawable
;
182 if (pGC
->subWindowMode
== IncludeInferiors
)
184 prgnSrcClip
= NotClippedByChildren (pSrcWin
);
185 if ((RECT_IN_REGION(pscr
, prgnSrcClip
, &TsrcBox
)) == rgnIN
)
187 REGION_DESTROY(pscr
, prgnSrcClip
);
193 if ((RECT_IN_REGION(pscr
, &pSrcWin
->clipList
, &TsrcBox
)) == rgnIN
)
195 prgnSrcClip
= &rgnSrcRec
;
196 REGION_NULL(pscr
, prgnSrcClip
);
197 REGION_COPY(pscr
, prgnSrcClip
, &pSrcWin
->clipList
);
199 REGION_TRANSLATE(pscr
, prgnSrcClip
,
200 -pSrcDrawable
->x
, -pSrcDrawable
->y
);
206 if ((srcBox
.x1
>= 0) && (srcBox
.y1
>= 0) &&
207 (srcBox
.x2
<= pSrcDrawable
->width
) &&
208 (srcBox
.y2
<= pSrcDrawable
->height
))
213 box
.x2
= pSrcDrawable
->width
;
214 box
.y2
= pSrcDrawable
->height
;
215 prgnSrcClip
= &rgnSrcRec
;
216 REGION_INIT(pscr
, prgnSrcClip
, &box
, 1);
217 pSrcWin
= (WindowPtr
)NULL
;
220 if (pDstDrawable
== pSrcDrawable
)
222 prgnDstClip
= prgnSrcClip
;
224 else if (pDstDrawable
->type
!= DRAWABLE_PIXMAP
)
226 if (pGC
->subWindowMode
== IncludeInferiors
)
228 prgnDstClip
= NotClippedByChildren((WindowPtr
)pDstDrawable
);
232 prgnDstClip
= &rgnDstRec
;
233 REGION_NULL(pscr
, prgnDstClip
);
234 REGION_COPY(pscr
, prgnDstClip
,
235 &((WindowPtr
)pDstDrawable
)->clipList
);
237 REGION_TRANSLATE(pscr
, prgnDstClip
,
238 -pDstDrawable
->x
, -pDstDrawable
->y
);
246 box
.x2
= pDstDrawable
->width
;
247 box
.y2
= pDstDrawable
->height
;
248 prgnDstClip
= &rgnDstRec
;
249 REGION_INIT(pscr
, prgnDstClip
, &box
, 1);
252 /* drawable-relative source region */
253 REGION_INIT(pscr
, &rgnExposed
, &srcBox
, 1);
255 /* now get the hidden parts of the source box*/
256 REGION_SUBTRACT(pscr
, &rgnExposed
, &rgnExposed
, prgnSrcClip
);
258 if (pSrcWin
&& pSrcWin
->backStorage
)
261 * Copy any areas from the source backing store. Modifies
264 (* pSrcWin
->drawable
.pScreen
->ExposeCopy
) ((WindowPtr
)pSrcDrawable
,
273 /* move them over the destination */
274 REGION_TRANSLATE(pscr
, &rgnExposed
, dstx
-srcx
, dsty
-srcy
);
276 /* intersect with visible areas of dest */
277 REGION_INTERSECT(pscr
, &rgnExposed
, &rgnExposed
, prgnDstClip
);
280 * If we have LOTS of rectangles, we decide to take the extents
281 * and force an exposure on that. This should require much less
282 * work overall, on both client and server. This is cheating, but
283 * isn't prohibited by the protocol ("spontaneous combustion" :-)
286 extents
= pGC
->graphicsExposures
&&
287 (REGION_NUM_RECTS(&rgnExposed
) > RECTLIMIT
) &&
288 (pDstDrawable
->type
!= DRAWABLE_PIXMAP
);
293 if (!(region
= wClipShape (pSrcWin
)))
294 region
= wBoundingShape (pSrcWin
);
296 * If you try to CopyArea the extents of a shaped window, compacting the
297 * exposed region will undo all our work!
299 if (extents
&& pSrcWin
&& region
&&
300 (RECT_IN_REGION(pscr
, region
, &srcBox
) != rgnIN
))
306 WindowPtr pWin
= (WindowPtr
)pDstDrawable
;
308 expBox
= *REGION_EXTENTS(pscr
, &rgnExposed
);
309 REGION_RESET(pscr
, &rgnExposed
, &expBox
);
310 /* need to clear out new areas of backing store */
311 if (pWin
->backStorage
)
312 (void) (* pWin
->drawable
.pScreen
->ClearBackingStore
)(
316 expBox
.x2
- expBox
.x1
,
317 expBox
.y2
- expBox
.y1
,
320 if ((pDstDrawable
->type
!= DRAWABLE_PIXMAP
) &&
321 (((WindowPtr
)pDstDrawable
)->backgroundState
!= None
))
323 WindowPtr pWin
= (WindowPtr
)pDstDrawable
;
325 /* make the exposed area screen-relative */
326 REGION_TRANSLATE(pscr
, &rgnExposed
,
327 pDstDrawable
->x
, pDstDrawable
->y
);
331 /* PaintWindowBackground doesn't clip, so we have to */
332 REGION_INTERSECT(pscr
, &rgnExposed
, &rgnExposed
, &pWin
->clipList
);
334 (*pWin
->drawable
.pScreen
->PaintWindowBackground
)(
335 (WindowPtr
)pDstDrawable
, &rgnExposed
, PW_BACKGROUND
);
339 REGION_RESET(pscr
, &rgnExposed
, &expBox
);
342 REGION_TRANSLATE(pscr
, &rgnExposed
,
343 -pDstDrawable
->x
, -pDstDrawable
->y
);
345 if (prgnDstClip
== &rgnDstRec
)
347 REGION_UNINIT(pscr
, prgnDstClip
);
349 else if (prgnDstClip
!= prgnSrcClip
)
351 REGION_DESTROY(pscr
, prgnDstClip
);
354 if (prgnSrcClip
== &rgnSrcRec
)
356 REGION_UNINIT(pscr
, prgnSrcClip
);
360 REGION_DESTROY(pscr
, prgnSrcClip
);
363 if (pGC
->graphicsExposures
)
366 RegionPtr exposed
= REGION_CREATE(pscr
, NullBox
, 0);
367 *exposed
= rgnExposed
;
372 REGION_UNINIT(pscr
, &rgnExposed
);
377 /* send GraphicsExpose events, or a NoExpose event, based on the region */
380 miSendGraphicsExpose (client
, pRgn
, drawable
, major
, minor
)
387 if (pRgn
&& !REGION_NIL(pRgn
))
395 numRects
= REGION_NUM_RECTS(pRgn
);
396 pBox
= REGION_RECTS(pRgn
);
397 if(!(pEvent
= (xEvent
*)ALLOCATE_LOCAL(numRects
* sizeof(xEvent
))))
401 for (i
=1; i
<=numRects
; i
++, pe
++, pBox
++)
403 pe
->u
.u
.type
= GraphicsExpose
;
404 pe
->u
.graphicsExposure
.drawable
= drawable
;
405 pe
->u
.graphicsExposure
.x
= pBox
->x1
;
406 pe
->u
.graphicsExposure
.y
= pBox
->y1
;
407 pe
->u
.graphicsExposure
.width
= pBox
->x2
- pBox
->x1
;
408 pe
->u
.graphicsExposure
.height
= pBox
->y2
- pBox
->y1
;
409 pe
->u
.graphicsExposure
.count
= numRects
- i
;
410 pe
->u
.graphicsExposure
.majorEvent
= major
;
411 pe
->u
.graphicsExposure
.minorEvent
= minor
;
413 TryClientEvents(client
, pEvent
, numRects
,
414 (Mask
)0, NoEventMask
, NullGrab
);
415 DEALLOCATE_LOCAL(pEvent
);
420 event
.u
.u
.type
= NoExpose
;
421 event
.u
.noExposure
.drawable
= drawable
;
422 event
.u
.noExposure
.majorEvent
= major
;
423 event
.u
.noExposure
.minorEvent
= minor
;
424 TryClientEvents(client
, &event
, 1,
425 (Mask
)0, NoEventMask
, NullGrab
);
431 miSendExposures(pWin
, pRgn
, dx
, dy
)
441 pBox
= REGION_RECTS(pRgn
);
442 numRects
= REGION_NUM_RECTS(pRgn
);
443 if(!(pEvent
= (xEvent
*) ALLOCATE_LOCAL(numRects
* sizeof(xEvent
))))
446 for (i
=numRects
, pe
= pEvent
; --i
>= 0; pe
++, pBox
++)
448 pe
->u
.u
.type
= Expose
;
449 pe
->u
.expose
.window
= pWin
->drawable
.id
;
450 pe
->u
.expose
.x
= pBox
->x1
- dx
;
451 pe
->u
.expose
.y
= pBox
->y1
- dy
;
452 pe
->u
.expose
.width
= pBox
->x2
- pBox
->x1
;
453 pe
->u
.expose
.height
= pBox
->y2
- pBox
->y1
;
454 pe
->u
.expose
.count
= i
;
458 if(!noPanoramiXExtension
) {
459 int scrnum
= pWin
->drawable
.pScreen
->myNum
;
464 x
= panoramiXdataPtr
[scrnum
].x
;
465 y
= panoramiXdataPtr
[scrnum
].y
;
466 pWin
= WindowTable
[0];
467 realWin
= pWin
->drawable
.id
;
470 win
= PanoramiXFindIDByScrnum(XRT_WINDOW
,
471 pWin
->drawable
.id
, scrnum
);
473 DEALLOCATE_LOCAL(pEvent
);
476 realWin
= win
->info
[0].id
;
477 pWin
= LookupIDByType(realWin
, RT_WINDOW
);
480 for (i
= 0; i
< numRects
; i
++) {
481 pEvent
[i
].u
.expose
.window
= realWin
;
482 pEvent
[i
].u
.expose
.x
+= x
;
483 pEvent
[i
].u
.expose
.y
+= y
;
488 DeliverEvents(pWin
, pEvent
, numRects
, NullWindow
);
490 DEALLOCATE_LOCAL(pEvent
);
494 miWindowExposures(pWin
, prgn
, other_exposed
)
496 RegionPtr prgn
, other_exposed
;
498 RegionPtr exposures
= prgn
;
499 if (pWin
->backStorage
&& prgn
)
501 * in some cases, backing store will cause a different
502 * region to be exposed than needs to be repainted
503 * (like when a window is mapped). RestoreAreas is
504 * allowed to return a region other than prgn,
505 * in which case this routine will free the resultant
506 * region. If exposures is null, then no events will
507 * be sent to the client; if prgn is empty
508 * no areas will be repainted.
510 exposures
= (*pWin
->drawable
.pScreen
->RestoreAreas
)(pWin
, prgn
);
511 if ((prgn
&& !REGION_NIL(prgn
)) ||
512 (exposures
&& !REGION_NIL(exposures
)) || other_exposed
)
515 int clientInterested
;
518 * Restore from backing-store FIRST.
520 clientInterested
= (pWin
->eventMask
|wOtherEventMasks(pWin
)) & ExposureMask
;
525 REGION_UNION(pWin
->drawable
.pScreen
, other_exposed
,
528 if (exposures
!= prgn
)
529 REGION_DESTROY(pWin
->drawable
.pScreen
, exposures
);
531 exposures
= other_exposed
;
533 if (clientInterested
&& exposures
&& (REGION_NUM_RECTS(exposures
) > RECTLIMIT
))
536 * If we have LOTS of rectangles, we decide to take the extents
537 * and force an exposure on that. This should require much less
538 * work overall, on both client and server. This is cheating, but
539 * isn't prohibited by the protocol ("spontaneous combustion" :-).
543 box
= *REGION_EXTENTS( pWin
->drawable
.pScreen
, exposures
);
544 if (exposures
== prgn
) {
546 REGION_INIT( pWin
->drawable
.pScreen
, exposures
, &box
, 1);
547 REGION_RESET( pWin
->drawable
.pScreen
, prgn
, &box
);
549 REGION_RESET( pWin
->drawable
.pScreen
, exposures
, &box
);
550 REGION_UNION( pWin
->drawable
.pScreen
, prgn
, prgn
, exposures
);
552 /* PaintWindowBackground doesn't clip, so we have to */
553 REGION_INTERSECT( pWin
->drawable
.pScreen
, prgn
, prgn
, &pWin
->clipList
);
554 /* need to clear out new areas of backing store, too */
555 if (pWin
->backStorage
)
556 (void) (* pWin
->drawable
.pScreen
->ClearBackingStore
)(
558 box
.x1
- pWin
->drawable
.x
,
559 box
.y1
- pWin
->drawable
.y
,
564 if (prgn
&& !REGION_NIL(prgn
))
565 (*pWin
->drawable
.pScreen
->PaintWindowBackground
)(pWin
, prgn
, PW_BACKGROUND
);
566 if (clientInterested
&& exposures
&& !REGION_NIL(exposures
))
567 miSendExposures(pWin
, exposures
,
568 pWin
->drawable
.x
, pWin
->drawable
.y
);
569 if (exposures
== &expRec
)
571 REGION_UNINIT( pWin
->drawable
.pScreen
, exposures
);
573 else if (exposures
&& exposures
!= prgn
&& exposures
!= other_exposed
)
574 REGION_DESTROY( pWin
->drawable
.pScreen
, exposures
);
576 REGION_EMPTY( pWin
->drawable
.pScreen
, prgn
);
578 else if (exposures
&& exposures
!= prgn
)
579 REGION_DESTROY( pWin
->drawable
.pScreen
, exposures
);
584 this code is highly unlikely. it is not haile selassie.
586 there is some hair here. we can't just use the window's
587 clip region as it is, because if we are painting the border,
588 the border is not in the client area and so we will be excluded
589 when we validate the GC, and if we are painting a parent-relative
590 background, the area we want to paint is in some other window.
591 since we trust the code calling us to tell us to paint only areas
592 that are really ours, we will temporarily give the window a
593 clipList the size of the whole screen and an origin at (0,0).
594 this more or less assumes that ddX code will do translation
595 based on the window's absolute position, and that ValidateGC will
596 look at clipList, and that no other fields from the
597 window will be used. it's not possible to just draw
598 in the root because it may be a different depth.
600 to get the tile to align correctly we set the GC's tile origin to
601 be the (x,y) of the window's upper left corner, after which we
602 get the right bits when drawing into the root.
604 because the clip_mask is being set to None, we may call DoChangeGC with
605 fPointer set true, thus we no longer need to install the background or
606 border tile in the resource table.
609 static RESTYPE ResType
= 0;
610 static int numGCs
= 0;
611 static GCPtr screenContext
[MAXSCREENS
];
619 GCPtr pGC
= (GCPtr
)value
;
620 screenContext
[pGC
->pScreen
->myNum
] = (GCPtr
)NULL
;
631 miPaintWindow(pWin
, prgn
, what
)
638 Bool usingScratchGC
= FALSE
;
651 ChangeGCVal gcval
[7];
652 ChangeGCVal newValues
[COUNT_BITS
];
654 BITS32 gcmask
, index
, mask
;
656 DDXPointRec oldCorner
;
662 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
668 if (what
== PW_BACKGROUND
)
670 switch (pWin
->backgroundState
) {
674 (*pWin
->parent
->drawable
.pScreen
->PaintWindowBackground
)(pWin
->parent
, prgn
, what
);
676 case BackgroundPixel
:
677 newValues
[FOREGROUND
].val
= pWin
->background
.pixel
;
678 newValues
[FILLSTYLE
].val
= FillSolid
;
679 gcmask
|= GCForeground
| GCFillStyle
;
681 case BackgroundPixmap
:
682 newValues
[TILE
].ptr
= (pointer
)pWin
->background
.pixmap
;
683 newValues
[FILLSTYLE
].val
= FillTiled
;
684 gcmask
|= GCTile
| GCFillStyle
| GCTileStipXOrigin
| GCTileStipYOrigin
;
690 if (pWin
->borderIsPixel
)
692 newValues
[FOREGROUND
].val
= pWin
->border
.pixel
;
693 newValues
[FILLSTYLE
].val
= FillSolid
;
694 gcmask
|= GCForeground
| GCFillStyle
;
698 newValues
[TILE
].ptr
= (pointer
)pWin
->border
.pixmap
;
699 newValues
[FILLSTYLE
].val
= FillTiled
;
700 gcmask
|= GCTile
| GCFillStyle
| GCTileStipXOrigin
| GCTileStipYOrigin
;
704 prect
= (xRectangle
*)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn
) *
709 newValues
[FUNCTION
].val
= GXcopy
;
710 gcmask
|= GCFunction
| GCClipMask
;
713 pRoot
= WindowTable
[i
];
716 if (what
== PW_BORDER
)
718 while (pBgWin
->backgroundState
== ParentRelative
)
719 pBgWin
= pBgWin
->parent
;
722 if ((pWin
->drawable
.depth
!= pRoot
->drawable
.depth
) ||
723 (pWin
->drawable
.bitsPerPixel
!= pRoot
->drawable
.bitsPerPixel
))
725 usingScratchGC
= TRUE
;
726 pGC
= GetScratchGC(pWin
->drawable
.depth
, pWin
->drawable
.pScreen
);
729 DEALLOCATE_LOCAL(prect
);
733 * mash the clip list so we can paint the border by
734 * mangling the window in place, pretending it
735 * spans the entire screen
737 if (what
== PW_BORDER
)
739 prgnWin
= pWin
->clipList
;
740 oldCorner
.x
= pWin
->drawable
.x
;
741 oldCorner
.y
= pWin
->drawable
.y
;
742 pWin
->drawable
.x
= pWin
->drawable
.y
= 0;
745 box
.x2
= pScreen
->width
;
746 box
.y2
= pScreen
->height
;
747 REGION_INIT(pScreen
, &pWin
->clipList
, &box
, 1);
748 pWin
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
749 newValues
[ABSX
].val
= pBgWin
->drawable
.x
;
750 newValues
[ABSY
].val
= pBgWin
->drawable
.y
;
754 newValues
[ABSX
].val
= 0;
755 newValues
[ABSY
].val
= 0;
759 * draw the background to the root window
761 if (screenContext
[i
] == (GCPtr
)NULL
)
763 if (!ResType
&& !(ResType
= CreateNewResourceType(tossGC
)))
765 screenContext
[i
] = CreateGC((DrawablePtr
)pWin
, (BITS32
) 0,
766 (XID
*)NULL
, &status
);
767 if (!screenContext
[i
])
770 if (!AddResource(FakeClientID(0), ResType
,
771 (pointer
)screenContext
[i
]))
774 pGC
= screenContext
[i
];
775 newValues
[SUBWINDOW
].val
= IncludeInferiors
;
776 newValues
[ABSX
].val
= pBgWin
->drawable
.x
;
777 newValues
[ABSY
].val
= pBgWin
->drawable
.y
;
778 gcmask
|= GCSubwindowMode
;
782 if (pWin
->backStorage
)
783 (*pWin
->drawable
.pScreen
->DrawGuarantee
) (pWin
, pGC
, GuaranteeVisBack
);
789 index
= lowbit (mask
);
793 if (pGC
->alu
!= newValues
[FUNCTION
].val
) {
795 gcval
[i
++].val
= newValues
[FUNCTION
].val
;
798 case GCTileStipXOrigin
:
799 if ( pGC
->patOrg
.x
!= newValues
[ABSX
].val
) {
801 gcval
[i
++].val
= newValues
[ABSX
].val
;
804 case GCTileStipYOrigin
:
805 if ( pGC
->patOrg
.y
!= newValues
[ABSY
].val
) {
807 gcval
[i
++].val
= newValues
[ABSY
].val
;
811 if ( pGC
->clientClipType
!= CT_NONE
) {
813 gcval
[i
++].val
= CT_NONE
;
816 case GCSubwindowMode
:
817 if ( pGC
->subWindowMode
!= newValues
[SUBWINDOW
].val
) {
819 gcval
[i
++].val
= newValues
[SUBWINDOW
].val
;
823 if (pGC
->tileIsPixel
|| pGC
->tile
.pixmap
!= newValues
[TILE
].ptr
)
826 gcval
[i
++].ptr
= newValues
[TILE
].ptr
;
830 if ( pGC
->fillStyle
!= newValues
[FILLSTYLE
].val
) {
832 gcval
[i
++].val
= newValues
[FILLSTYLE
].val
;
836 if ( pGC
->fgPixel
!= newValues
[FOREGROUND
].val
) {
838 gcval
[i
++].val
= newValues
[FOREGROUND
].val
;
845 dixChangeGC(NullClient
, pGC
, gcmask
, NULL
, gcval
);
847 if (pWin
->drawable
.serialNumber
!= pGC
->serialNumber
)
848 ValidateGC((DrawablePtr
)pWin
, pGC
);
850 numRects
= REGION_NUM_RECTS(prgn
);
851 pbox
= REGION_RECTS(prgn
);
852 for (i
= numRects
; --i
>= 0; pbox
++, prect
++)
854 prect
->x
= pbox
->x1
- pWin
->drawable
.x
;
855 prect
->y
= pbox
->y1
- pWin
->drawable
.y
;
856 prect
->width
= pbox
->x2
- pbox
->x1
;
857 prect
->height
= pbox
->y2
- pbox
->y1
;
860 (*pGC
->ops
->PolyFillRect
)((DrawablePtr
)pWin
, pGC
, numRects
, prect
);
861 DEALLOCATE_LOCAL(prect
);
863 if (pWin
->backStorage
)
864 (*pWin
->drawable
.pScreen
->DrawGuarantee
) (pWin
, pGC
, GuaranteeNothing
);
868 if (what
== PW_BORDER
)
870 REGION_UNINIT(pScreen
, &pWin
->clipList
);
871 pWin
->clipList
= prgnWin
;
872 pWin
->drawable
.x
= oldCorner
.x
;
873 pWin
->drawable
.y
= oldCorner
.y
;
874 pWin
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
881 /* MICLEARDRAWABLE -- sets the entire drawable to the background color of
882 * the GC. Useful when we have a scratch drawable and need to initialize
885 miClearDrawable(pDraw
, pGC
)
889 XID fg
= pGC
->fgPixel
;
890 XID bg
= pGC
->bgPixel
;
895 rect
.width
= pDraw
->width
;
896 rect
.height
= pDraw
->height
;
897 DoChangeGC(pGC
, GCForeground
, &bg
, 0);
898 ValidateGC(pDraw
, pGC
);
899 (*pGC
->ops
->PolyFillRect
)(pDraw
, pGC
, 1, &rect
);
900 DoChangeGC(pGC
, GCForeground
, &fg
, 0);
901 ValidateGC(pDraw
, pGC
);