2 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
23 * Copyright © 2003 Keith Packard
25 * Permission to use, copy, modify, distribute, and sell this software and its
26 * documentation for any purpose is hereby granted without fee, provided that
27 * the above copyright notice appear in all copies and that both that
28 * copyright notice and this permission notice appear in supporting
29 * documentation, and that the name of Keith Packard not be used in
30 * advertising or publicity pertaining to distribution of the software without
31 * specific, written prior permission. Keith Packard makes no
32 * representations about the suitability of this software for any purpose. It
33 * is provided "as is" without express or implied warranty.
35 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
36 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
37 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
38 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
39 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
40 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41 * PERFORMANCE OF THIS SOFTWARE.
44 #ifdef HAVE_DIX_CONFIG_H
45 #include <dix-config.h>
51 #include "panoramiXsrv.h"
54 #ifdef COMPOSITE_DEBUG
56 compCheckWindow(WindowPtr pWin
, pointer data
)
58 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
59 PixmapPtr pWinPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
60 PixmapPtr pParentPixmap
=
61 pWin
->parent
? (*pScreen
->GetWindowPixmap
) (pWin
->parent
) : 0;
62 PixmapPtr pScreenPixmap
= (*pScreen
->GetScreenPixmap
) (pScreen
);
65 assert(pWin
->redirectDraw
== RedirectDrawNone
);
66 assert(pWinPixmap
== pScreenPixmap
);
68 else if (pWin
->redirectDraw
!= RedirectDrawNone
) {
69 assert(pWinPixmap
!= pParentPixmap
);
70 assert(pWinPixmap
!= pScreenPixmap
);
73 assert(pWinPixmap
== pParentPixmap
);
75 assert(0 < pWinPixmap
->refcnt
&& pWinPixmap
->refcnt
< 3);
76 assert(0 < pScreenPixmap
->refcnt
&& pScreenPixmap
->refcnt
< 3);
78 assert(0 <= pParentPixmap
->refcnt
&& pParentPixmap
->refcnt
< 3);
79 return WT_WALKCHILDREN
;
83 compCheckTree(ScreenPtr pScreen
)
85 WalkTree(pScreen
, compCheckWindow
, 0);
89 typedef struct _compPixmapVisit
{
92 } CompPixmapVisitRec
, *CompPixmapVisitPtr
;
95 compRepaintBorder(ClientPtr pClient
, pointer closure
)
99 dixLookupWindow(&pWindow
, (XID
) (intptr_t) closure
, pClient
,
105 RegionNull(&exposed
);
106 RegionSubtract(&exposed
, &pWindow
->borderClip
, &pWindow
->winSize
);
107 miPaintWindow(pWindow
, &exposed
, PW_BORDER
);
108 RegionUninit(&exposed
);
114 compSetPixmapVisitWindow(WindowPtr pWindow
, pointer data
)
116 CompPixmapVisitPtr pVisit
= (CompPixmapVisitPtr
) data
;
117 ScreenPtr pScreen
= pWindow
->drawable
.pScreen
;
119 if (pWindow
!= pVisit
->pWindow
&& pWindow
->redirectDraw
!= RedirectDrawNone
)
120 return WT_DONTWALKCHILDREN
;
121 (*pScreen
->SetWindowPixmap
) (pWindow
, pVisit
->pPixmap
);
123 * Recompute winSize and borderSize. This is duplicate effort
124 * when resizing pixmaps, but necessary when changing redirection.
125 * Might be nice to fix this.
128 SetBorderSize(pWindow
);
129 if (HasBorder(pWindow
))
130 QueueWorkProc(compRepaintBorder
, serverClient
,
131 (pointer
) (intptr_t) pWindow
->drawable
.id
);
132 return WT_WALKCHILDREN
;
136 compSetPixmap(WindowPtr pWindow
, PixmapPtr pPixmap
)
138 CompPixmapVisitRec visitRec
;
140 visitRec
.pWindow
= pWindow
;
141 visitRec
.pPixmap
= pPixmap
;
142 TraverseTree(pWindow
, compSetPixmapVisitWindow
, (pointer
) &visitRec
);
143 compCheckTree(pWindow
->drawable
.pScreen
);
147 compCheckRedirect(WindowPtr pWin
)
149 CompWindowPtr cw
= GetCompWindow(pWin
);
150 CompScreenPtr cs
= GetCompScreen(pWin
->drawable
.pScreen
);
153 should
= pWin
->realized
&& (pWin
->drawable
.class != InputOnly
) &&
154 (cw
!= NULL
) && (pWin
->parent
!= NULL
);
156 /* Never redirect the overlay window */
157 if (cs
->pOverlayWin
!= NULL
) {
158 if (pWin
== cs
->pOverlayWin
) {
163 if (should
!= (pWin
->redirectDraw
!= RedirectDrawNone
)) {
165 return compAllocPixmap(pWin
);
167 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
168 PixmapPtr pPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
170 compSetParentPixmap(pWin
);
171 compRestoreWindow(pWin
, pPixmap
);
172 (*pScreen
->DestroyPixmap
) (pPixmap
);
176 if (cw
->update
== CompositeRedirectAutomatic
)
177 pWin
->redirectDraw
= RedirectDrawAutomatic
;
179 pWin
->redirectDraw
= RedirectDrawManual
;
185 updateOverlayWindow(ScreenPtr pScreen
)
188 WindowPtr pWin
; /* overlay window */
190 int w
= pScreen
->width
;
191 int h
= pScreen
->height
;
194 if (!noPanoramiXExtension
) {
195 w
= PanoramiXPixWidth
;
196 h
= PanoramiXPixHeight
;
200 cs
= GetCompScreen(pScreen
);
201 if ((pWin
= cs
->pOverlayWin
) != NULL
) {
202 if ((pWin
->drawable
.width
== w
) && (pWin
->drawable
.height
== h
))
205 /* Let's resize the overlay window. */
208 return ConfigureWindow(pWin
, CWWidth
| CWHeight
, vlist
, wClient(pWin
));
211 /* Let's be on the safe side and not assume an overlay window is
217 compPositionWindow(WindowPtr pWin
, int x
, int y
)
219 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
220 CompScreenPtr cs
= GetCompScreen(pScreen
);
223 pScreen
->PositionWindow
= cs
->PositionWindow
;
225 * "Shouldn't need this as all possible places should be wrapped
227 compCheckRedirect (pWin);
229 #ifdef COMPOSITE_DEBUG
230 if ((pWin
->redirectDraw
!= RedirectDrawNone
) !=
231 (pWin
->viewable
&& (GetCompWindow(pWin
) != NULL
)))
234 if (pWin
->redirectDraw
!= RedirectDrawNone
) {
235 PixmapPtr pPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
236 int bw
= wBorderWidth(pWin
);
237 int nx
= pWin
->drawable
.x
- bw
;
238 int ny
= pWin
->drawable
.y
- bw
;
240 if (pPixmap
->screen_x
!= nx
|| pPixmap
->screen_y
!= ny
) {
241 pPixmap
->screen_x
= nx
;
242 pPixmap
->screen_y
= ny
;
243 pPixmap
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
247 if (!(*pScreen
->PositionWindow
) (pWin
, x
, y
))
249 cs
->PositionWindow
= pScreen
->PositionWindow
;
250 pScreen
->PositionWindow
= compPositionWindow
;
251 compCheckTree(pWin
->drawable
.pScreen
);
252 if (updateOverlayWindow(pScreen
) != Success
)
258 compRealizeWindow(WindowPtr pWin
)
260 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
261 CompScreenPtr cs
= GetCompScreen(pScreen
);
264 pScreen
->RealizeWindow
= cs
->RealizeWindow
;
265 compCheckRedirect(pWin
);
266 if (!(*pScreen
->RealizeWindow
) (pWin
))
268 cs
->RealizeWindow
= pScreen
->RealizeWindow
;
269 pScreen
->RealizeWindow
= compRealizeWindow
;
270 compCheckTree(pWin
->drawable
.pScreen
);
275 compUnrealizeWindow(WindowPtr pWin
)
277 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
278 CompScreenPtr cs
= GetCompScreen(pScreen
);
281 pScreen
->UnrealizeWindow
= cs
->UnrealizeWindow
;
282 compCheckRedirect(pWin
);
283 if (!(*pScreen
->UnrealizeWindow
) (pWin
))
285 cs
->UnrealizeWindow
= pScreen
->UnrealizeWindow
;
286 pScreen
->UnrealizeWindow
= compUnrealizeWindow
;
287 compCheckTree(pWin
->drawable
.pScreen
);
292 * Called after the borderClip for the window has settled down
293 * We use this to make sure our extra borderClip has the right origin
297 compClipNotify(WindowPtr pWin
, int dx
, int dy
)
299 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
300 CompScreenPtr cs
= GetCompScreen(pScreen
);
301 CompWindowPtr cw
= GetCompWindow(pWin
);
304 if (cw
->borderClipX
!= pWin
->drawable
.x
||
305 cw
->borderClipY
!= pWin
->drawable
.y
) {
306 RegionTranslate(&cw
->borderClip
,
307 pWin
->drawable
.x
- cw
->borderClipX
,
308 pWin
->drawable
.y
- cw
->borderClipY
);
309 cw
->borderClipX
= pWin
->drawable
.x
;
310 cw
->borderClipY
= pWin
->drawable
.y
;
313 if (cs
->ClipNotify
) {
314 pScreen
->ClipNotify
= cs
->ClipNotify
;
315 (*pScreen
->ClipNotify
) (pWin
, dx
, dy
);
316 cs
->ClipNotify
= pScreen
->ClipNotify
;
317 pScreen
->ClipNotify
= compClipNotify
;
322 * Returns TRUE if the window needs server-provided automatic redirect,
323 * which is true if the child and parent aren't both regular or ARGB visuals
327 compIsAlternateVisual(ScreenPtr pScreen
, XID visual
)
329 CompScreenPtr cs
= GetCompScreen(pScreen
);
332 for (i
= 0; i
< cs
->numAlternateVisuals
; i
++)
333 if (cs
->alternateVisuals
[i
] == visual
)
339 compImplicitRedirect(WindowPtr pWin
, WindowPtr pParent
)
342 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
343 XID winVisual
= wVisual(pWin
);
344 XID parentVisual
= wVisual(pParent
);
346 if (winVisual
!= parentVisual
&&
347 (compIsAlternateVisual(pScreen
, winVisual
) ||
348 compIsAlternateVisual(pScreen
, parentVisual
)))
355 compFreeOldPixmap(WindowPtr pWin
)
357 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
359 if (pWin
->redirectDraw
!= RedirectDrawNone
) {
360 CompWindowPtr cw
= GetCompWindow(pWin
);
362 if (cw
->pOldPixmap
) {
363 (*pScreen
->DestroyPixmap
) (cw
->pOldPixmap
);
364 cw
->pOldPixmap
= NullPixmap
;
370 compMoveWindow(WindowPtr pWin
, int x
, int y
, WindowPtr pSib
, VTKind kind
)
372 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
373 CompScreenPtr cs
= GetCompScreen(pScreen
);
375 pScreen
->MoveWindow
= cs
->MoveWindow
;
376 (*pScreen
->MoveWindow
) (pWin
, x
, y
, pSib
, kind
);
377 cs
->MoveWindow
= pScreen
->MoveWindow
;
378 pScreen
->MoveWindow
= compMoveWindow
;
380 compFreeOldPixmap(pWin
);
381 compCheckTree(pScreen
);
385 compResizeWindow(WindowPtr pWin
, int x
, int y
,
386 unsigned int w
, unsigned int h
, WindowPtr pSib
)
388 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
389 CompScreenPtr cs
= GetCompScreen(pScreen
);
391 pScreen
->ResizeWindow
= cs
->ResizeWindow
;
392 (*pScreen
->ResizeWindow
) (pWin
, x
, y
, w
, h
, pSib
);
393 cs
->ResizeWindow
= pScreen
->ResizeWindow
;
394 pScreen
->ResizeWindow
= compResizeWindow
;
396 compFreeOldPixmap(pWin
);
397 compCheckTree(pWin
->drawable
.pScreen
);
401 compChangeBorderWidth(WindowPtr pWin
, unsigned int bw
)
403 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
404 CompScreenPtr cs
= GetCompScreen(pScreen
);
406 pScreen
->ChangeBorderWidth
= cs
->ChangeBorderWidth
;
407 (*pScreen
->ChangeBorderWidth
) (pWin
, bw
);
408 cs
->ChangeBorderWidth
= pScreen
->ChangeBorderWidth
;
409 pScreen
->ChangeBorderWidth
= compChangeBorderWidth
;
411 compFreeOldPixmap(pWin
);
412 compCheckTree(pWin
->drawable
.pScreen
);
416 compReparentWindow(WindowPtr pWin
, WindowPtr pPriorParent
)
418 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
419 CompScreenPtr cs
= GetCompScreen(pScreen
);
421 pScreen
->ReparentWindow
= cs
->ReparentWindow
;
423 * Remove any implicit redirect due to synthesized visual
425 if (compImplicitRedirect(pWin
, pPriorParent
))
426 compUnredirectWindow(serverClient
, pWin
, CompositeRedirectAutomatic
);
428 * Handle subwindows redirection
430 compUnredirectOneSubwindow(pPriorParent
, pWin
);
431 compRedirectOneSubwindow(pWin
->parent
, pWin
);
433 * Add any implict redirect due to synthesized visual
435 if (compImplicitRedirect(pWin
, pWin
->parent
))
436 compRedirectWindow(serverClient
, pWin
, CompositeRedirectAutomatic
);
439 * Allocate any necessary redirect pixmap
440 * (this actually should never be true; pWin is always unmapped)
442 compCheckRedirect(pWin
);
445 * Reset pixmap pointers as appropriate
447 if (pWin
->parent
&& pWin
->redirectDraw
== RedirectDrawNone
)
448 compSetPixmap(pWin
, (*pScreen
->GetWindowPixmap
) (pWin
->parent
));
450 * Call down to next function
452 if (pScreen
->ReparentWindow
)
453 (*pScreen
->ReparentWindow
) (pWin
, pPriorParent
);
454 cs
->ReparentWindow
= pScreen
->ReparentWindow
;
455 pScreen
->ReparentWindow
= compReparentWindow
;
456 compCheckTree(pWin
->drawable
.pScreen
);
460 compCopyWindow(WindowPtr pWin
, DDXPointRec ptOldOrg
, RegionPtr prgnSrc
)
462 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
463 CompScreenPtr cs
= GetCompScreen(pScreen
);
466 if (pWin
->redirectDraw
!= RedirectDrawNone
) {
467 PixmapPtr pPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
468 CompWindowPtr cw
= GetCompWindow(pWin
);
470 assert(cw
->oldx
!= COMP_ORIGIN_INVALID
);
471 assert(cw
->oldy
!= COMP_ORIGIN_INVALID
);
472 if (cw
->pOldPixmap
) {
474 * Ok, the old bits are available in pOldPixmap and
475 * need to be copied to pNewPixmap.
478 PixmapPtr pPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
481 dx
= ptOldOrg
.x
- pWin
->drawable
.x
;
482 dy
= ptOldOrg
.y
- pWin
->drawable
.y
;
483 RegionTranslate(prgnSrc
, -dx
, -dy
);
487 RegionIntersect(&rgnDst
, &pWin
->borderClip
, prgnSrc
);
489 RegionTranslate(&rgnDst
, -pPixmap
->screen_x
, -pPixmap
->screen_y
);
491 dx
= dx
+ pPixmap
->screen_x
- cw
->oldx
;
492 dy
= dy
+ pPixmap
->screen_y
- cw
->oldy
;
493 pGC
= GetScratchGC(pPixmap
->drawable
.depth
, pScreen
);
495 BoxPtr pBox
= RegionRects(&rgnDst
);
496 int nBox
= RegionNumRects(&rgnDst
);
498 ValidateGC(&pPixmap
->drawable
, pGC
);
500 (void) (*pGC
->ops
->CopyArea
) (&cw
->pOldPixmap
->drawable
,
503 pBox
->x1
+ dx
, pBox
->y1
+ dy
,
513 dx
= pPixmap
->screen_x
- cw
->oldx
;
514 dy
= pPixmap
->screen_y
- cw
->oldy
;
519 pScreen
->CopyWindow
= cs
->CopyWindow
;
520 if (ptOldOrg
.x
!= pWin
->drawable
.x
|| ptOldOrg
.y
!= pWin
->drawable
.y
) {
522 RegionTranslate(prgnSrc
, dx
, dy
);
523 (*pScreen
->CopyWindow
) (pWin
, ptOldOrg
, prgnSrc
);
525 RegionTranslate(prgnSrc
, -dx
, -dy
);
530 RegionTranslate(prgnSrc
,
531 pWin
->drawable
.x
- ptOldOrg
.x
,
532 pWin
->drawable
.y
- ptOldOrg
.y
);
533 DamageDamageRegion(&pWin
->drawable
, prgnSrc
);
535 cs
->CopyWindow
= pScreen
->CopyWindow
;
536 pScreen
->CopyWindow
= compCopyWindow
;
537 compCheckTree(pWin
->drawable
.pScreen
);
541 compCreateWindow(WindowPtr pWin
)
543 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
544 CompScreenPtr cs
= GetCompScreen(pScreen
);
547 pScreen
->CreateWindow
= cs
->CreateWindow
;
548 ret
= (*pScreen
->CreateWindow
) (pWin
);
549 if (pWin
->parent
&& ret
) {
550 CompSubwindowsPtr csw
= GetCompSubwindows(pWin
->parent
);
551 CompClientWindowPtr ccw
;
553 (*pScreen
->SetWindowPixmap
) (pWin
,
554 (*pScreen
->GetWindowPixmap
) (pWin
->
557 for (ccw
= csw
->clients
; ccw
; ccw
= ccw
->next
)
558 compRedirectWindow(clients
[CLIENT_ID(ccw
->id
)],
560 if (compImplicitRedirect(pWin
, pWin
->parent
))
561 compRedirectWindow(serverClient
, pWin
, CompositeRedirectAutomatic
);
563 cs
->CreateWindow
= pScreen
->CreateWindow
;
564 pScreen
->CreateWindow
= compCreateWindow
;
565 compCheckTree(pWin
->drawable
.pScreen
);
570 compDestroyWindow(WindowPtr pWin
)
572 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
573 CompScreenPtr cs
= GetCompScreen(pScreen
);
575 CompSubwindowsPtr csw
;
578 pScreen
->DestroyWindow
= cs
->DestroyWindow
;
579 while ((cw
= GetCompWindow(pWin
)))
580 FreeResource(cw
->clients
->id
, RT_NONE
);
581 while ((csw
= GetCompSubwindows(pWin
)))
582 FreeResource(csw
->clients
->id
, RT_NONE
);
584 if (pWin
->redirectDraw
!= RedirectDrawNone
) {
585 PixmapPtr pPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
587 compSetParentPixmap(pWin
);
588 (*pScreen
->DestroyPixmap
) (pPixmap
);
590 ret
= (*pScreen
->DestroyWindow
) (pWin
);
591 cs
->DestroyWindow
= pScreen
->DestroyWindow
;
592 pScreen
->DestroyWindow
= compDestroyWindow
;
593 /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
598 compSetRedirectBorderClip(WindowPtr pWin
, RegionPtr pRegion
)
600 CompWindowPtr cw
= GetCompWindow(pWin
);
605 * Align old border clip with new border clip
607 RegionTranslate(&cw
->borderClip
,
608 pWin
->drawable
.x
- cw
->borderClipX
,
609 pWin
->drawable
.y
- cw
->borderClipY
);
611 * Compute newly visible portion of window for repaint
613 RegionSubtract(&damage
, pRegion
, &cw
->borderClip
);
615 * Report that as damaged so it will be redrawn
617 DamageDamageRegion(&pWin
->drawable
, &damage
);
618 RegionUninit(&damage
);
620 * Save the new border clip region
622 RegionCopy(&cw
->borderClip
, pRegion
);
623 cw
->borderClipX
= pWin
->drawable
.x
;
624 cw
->borderClipY
= pWin
->drawable
.y
;
628 compGetRedirectBorderClip(WindowPtr pWin
)
630 CompWindowPtr cw
= GetCompWindow(pWin
);
632 return &cw
->borderClip
;
636 compWindowUpdateAutomatic(WindowPtr pWin
)
638 CompWindowPtr cw
= GetCompWindow(pWin
);
639 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
640 WindowPtr pParent
= pWin
->parent
;
641 PixmapPtr pSrcPixmap
= (*pScreen
->GetWindowPixmap
) (pWin
);
642 PictFormatPtr pSrcFormat
= PictureWindowFormat(pWin
);
643 PictFormatPtr pDstFormat
= PictureWindowFormat(pWin
->parent
);
645 RegionPtr pRegion
= DamageRegion(cw
->damage
);
646 PicturePtr pSrcPicture
= CreatePicture(0, &pSrcPixmap
->drawable
,
651 XID subwindowMode
= IncludeInferiors
;
652 PicturePtr pDstPicture
= CreatePicture(0, &pParent
->drawable
,
660 * First move the region from window to screen coordinates
662 RegionTranslate(pRegion
, pWin
->drawable
.x
, pWin
->drawable
.y
);
665 * Clip against the "real" border clip
667 RegionIntersect(pRegion
, pRegion
, &cw
->borderClip
);
670 * Now translate from screen to dest coordinates
672 RegionTranslate(pRegion
, -pParent
->drawable
.x
, -pParent
->drawable
.y
);
677 SetPictureClipRegion(pDstPicture
, 0, 0, pRegion
);
682 CompositePicture(PictOpSrc
, pSrcPicture
, 0, pDstPicture
,
683 0, 0, /* src_x, src_y */
684 0, 0, /* msk_x, msk_y */
685 pSrcPixmap
->screen_x
- pParent
->drawable
.x
,
686 pSrcPixmap
->screen_y
- pParent
->drawable
.y
,
687 pSrcPixmap
->drawable
.width
, pSrcPixmap
->drawable
.height
);
688 FreePicture(pSrcPicture
, 0);
689 FreePicture(pDstPicture
, 0);
691 * Empty the damage region. This has the nice effect of
692 * rendering the translations above harmless
694 DamageEmpty(cw
->damage
);
698 compPaintWindowToParent(WindowPtr pWin
)
700 compPaintChildrenToWindow(pWin
);
702 if (pWin
->redirectDraw
!= RedirectDrawNone
) {
703 CompWindowPtr cw
= GetCompWindow(pWin
);
706 compWindowUpdateAutomatic(pWin
);
713 compPaintChildrenToWindow(WindowPtr pWin
)
717 if (!pWin
->damagedDescendants
)
720 for (pChild
= pWin
->lastChild
; pChild
; pChild
= pChild
->prevSib
)
721 compPaintWindowToParent(pChild
);
723 pWin
->damagedDescendants
= FALSE
;
727 CompositeRealChildHead(WindowPtr pWin
)
729 WindowPtr pChild
, pChildBefore
;
733 (screenIsSaved
== SCREEN_SAVER_ON
) &&
734 (HasSaverWindow(pWin
->drawable
.pScreen
))) {
736 /* First child is the screen saver; see if next child is the overlay */
737 pChildBefore
= pWin
->firstChild
;
738 pChild
= pChildBefore
->nextSib
;
742 pChildBefore
= NullWindow
;
743 pChild
= pWin
->firstChild
;
750 cs
= GetCompScreen(pWin
->drawable
.pScreen
);
751 if (pChild
== cs
->pOverlayWin
) {
760 compConfigNotify(WindowPtr pWin
, int x
, int y
, int w
, int h
,
761 int bw
, WindowPtr pSib
)
763 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
764 CompScreenPtr cs
= GetCompScreen(pScreen
);
766 WindowPtr pParent
= pWin
->parent
;
770 if (cs
->ConfigNotify
) {
771 pScreen
->ConfigNotify
= cs
->ConfigNotify
;
772 ret
= (*pScreen
->ConfigNotify
) (pWin
, x
, y
, w
, h
, bw
, pSib
);
773 cs
->ConfigNotify
= pScreen
->ConfigNotify
;
774 pScreen
->ConfigNotify
= compConfigNotify
;
780 if (pWin
->redirectDraw
== RedirectDrawNone
)
783 compCheckTree(pScreen
);
785 draw_x
= pParent
->drawable
.x
+ x
+ bw
;
786 draw_y
= pParent
->drawable
.y
+ y
+ bw
;
787 alloc_ret
= compReallocPixmap(pWin
, draw_x
, draw_y
, w
, h
, bw
);
789 if (alloc_ret
== FALSE
)