105b261ecSmrg/*
29ace9065Smrg * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
305b261ecSmrg *
46747b715Smrg * Permission is hereby granted, free of charge, to any person obtaining a
56747b715Smrg * copy of this software and associated documentation files (the "Software"),
66747b715Smrg * to deal in the Software without restriction, including without limitation
76747b715Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
86747b715Smrg * and/or sell copies of the Software, and to permit persons to whom the
96747b715Smrg * Software is furnished to do so, subject to the following conditions:
1005b261ecSmrg *
116747b715Smrg * The above copyright notice and this permission notice (including the next
126747b715Smrg * paragraph) shall be included in all copies or substantial portions of the
136747b715Smrg * Software.
146747b715Smrg *
156747b715Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166747b715Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
176747b715Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
186747b715Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
196747b715Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
206747b715Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
216747b715Smrg * DEALINGS IN THE SOFTWARE.
2205b261ecSmrg *
2305b261ecSmrg * Copyright © 2003 Keith Packard
2405b261ecSmrg *
2505b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
2605b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
2705b261ecSmrg * the above copyright notice appear in all copies and that both that
2805b261ecSmrg * copyright notice and this permission notice appear in supporting
2905b261ecSmrg * documentation, and that the name of Keith Packard not be used in
3005b261ecSmrg * advertising or publicity pertaining to distribution of the software without
3105b261ecSmrg * specific, written prior permission.  Keith Packard makes no
3205b261ecSmrg * representations about the suitability of this software for any purpose.  It
3305b261ecSmrg * is provided "as is" without express or implied warranty.
3405b261ecSmrg *
3505b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
3605b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
3705b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
3805b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
3905b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
4005b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4105b261ecSmrg * PERFORMANCE OF THIS SOFTWARE.
4205b261ecSmrg */
4305b261ecSmrg
4405b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
4505b261ecSmrg#include <dix-config.h>
4605b261ecSmrg#endif
4705b261ecSmrg
4805b261ecSmrg#ifndef _COMPINT_H_
4905b261ecSmrg#define _COMPINT_H_
5005b261ecSmrg
5105b261ecSmrg#include "misc.h"
5205b261ecSmrg#include "scrnintstr.h"
5305b261ecSmrg#include "os.h"
5405b261ecSmrg#include "regionstr.h"
5505b261ecSmrg#include "validate.h"
5605b261ecSmrg#include "windowstr.h"
5705b261ecSmrg#include "input.h"
5805b261ecSmrg#include "resource.h"
5905b261ecSmrg#include "colormapst.h"
6005b261ecSmrg#include "cursorstr.h"
6105b261ecSmrg#include "dixstruct.h"
6205b261ecSmrg#include "gcstruct.h"
6305b261ecSmrg#include "servermd.h"
6405b261ecSmrg#include "dixevents.h"
6505b261ecSmrg#include "globals.h"
6605b261ecSmrg#include "picturestr.h"
6705b261ecSmrg#include "extnsionst.h"
684642e01fSmrg#include "privates.h"
6905b261ecSmrg#include "mi.h"
7005b261ecSmrg#include "damage.h"
7105b261ecSmrg#include "damageextint.h"
7205b261ecSmrg#include "xfixes.h"
7305b261ecSmrg#include <X11/extensions/compositeproto.h>
7435c4bbdfSmrg#include "compositeext.h"
7505b261ecSmrg#include <assert.h>
7605b261ecSmrg
7705b261ecSmrg/*
7805b261ecSmrg *  enable this for debugging
7935c4bbdfSmrg
8005b261ecSmrg    #define COMPOSITE_DEBUG
8105b261ecSmrg */
8205b261ecSmrg
8305b261ecSmrgtypedef struct _CompClientWindow {
8435c4bbdfSmrg    struct _CompClientWindow *next;
8535c4bbdfSmrg    XID id;
8635c4bbdfSmrg    int update;
8735c4bbdfSmrg} CompClientWindowRec, *CompClientWindowPtr;
8805b261ecSmrg
8905b261ecSmrgtypedef struct _CompWindow {
9035c4bbdfSmrg    RegionRec borderClip;
9135c4bbdfSmrg    DamagePtr damage;           /* for automatic update mode */
9235c4bbdfSmrg    Bool damageRegistered;
9335c4bbdfSmrg    Bool damaged;
9435c4bbdfSmrg    int update;
9535c4bbdfSmrg    CompClientWindowPtr clients;
9635c4bbdfSmrg    int oldx;
9735c4bbdfSmrg    int oldy;
9835c4bbdfSmrg    PixmapPtr pOldPixmap;
9935c4bbdfSmrg    int borderClipX, borderClipY;
10005b261ecSmrg} CompWindowRec, *CompWindowPtr;
10105b261ecSmrg
10205b261ecSmrg#define COMP_ORIGIN_INVALID	    0x80000000
10305b261ecSmrg
10405b261ecSmrgtypedef struct _CompSubwindows {
10535c4bbdfSmrg    int update;
10635c4bbdfSmrg    CompClientWindowPtr clients;
10705b261ecSmrg} CompSubwindowsRec, *CompSubwindowsPtr;
10805b261ecSmrg
10905b261ecSmrg#ifndef COMP_INCLUDE_RGB24_VISUAL
11005b261ecSmrg#define COMP_INCLUDE_RGB24_VISUAL 0
11105b261ecSmrg#endif
11205b261ecSmrg
11305b261ecSmrgtypedef struct _CompOverlayClientRec *CompOverlayClientPtr;
11405b261ecSmrg
11505b261ecSmrgtypedef struct _CompOverlayClientRec {
11635c4bbdfSmrg    CompOverlayClientPtr pNext;
11735c4bbdfSmrg    ClientPtr pClient;
11835c4bbdfSmrg    ScreenPtr pScreen;
11935c4bbdfSmrg    XID resource;
12005b261ecSmrg} CompOverlayClientRec;
12105b261ecSmrg
12235c4bbdfSmrgtypedef struct _CompImplicitRedirectException {
12335c4bbdfSmrg    XID parentVisual;
12435c4bbdfSmrg    XID winVisual;
12535c4bbdfSmrg} CompImplicitRedirectException;
12635c4bbdfSmrg
12705b261ecSmrgtypedef struct _CompScreen {
12835c4bbdfSmrg    PositionWindowProcPtr PositionWindow;
12935c4bbdfSmrg    CopyWindowProcPtr CopyWindow;
13035c4bbdfSmrg    CreateWindowProcPtr CreateWindow;
13135c4bbdfSmrg    DestroyWindowProcPtr DestroyWindow;
13235c4bbdfSmrg    RealizeWindowProcPtr RealizeWindow;
13335c4bbdfSmrg    UnrealizeWindowProcPtr UnrealizeWindow;
13435c4bbdfSmrg    ClipNotifyProcPtr ClipNotify;
13505b261ecSmrg    /*
13605b261ecSmrg     * Called from ConfigureWindow, these
13705b261ecSmrg     * three track changes to the offscreen storage
13805b261ecSmrg     * geometry
13905b261ecSmrg     */
14035c4bbdfSmrg    ConfigNotifyProcPtr ConfigNotify;
14135c4bbdfSmrg    MoveWindowProcPtr MoveWindow;
14235c4bbdfSmrg    ResizeWindowProcPtr ResizeWindow;
14335c4bbdfSmrg    ChangeBorderWidthProcPtr ChangeBorderWidth;
14405b261ecSmrg    /*
14505b261ecSmrg     * Reparenting has an effect on Subwindows redirect
14605b261ecSmrg     */
14735c4bbdfSmrg    ReparentWindowProcPtr ReparentWindow;
14835c4bbdfSmrg
14905b261ecSmrg    /*
15005b261ecSmrg     * Colormaps for new visuals better not get installed
15105b261ecSmrg     */
15235c4bbdfSmrg    InstallColormapProcPtr InstallColormap;
15305b261ecSmrg
1544642e01fSmrg    /*
1554642e01fSmrg     * Fake backing store via automatic redirection
1564642e01fSmrg     */
1574642e01fSmrg    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
1584642e01fSmrg
1591b5d61b8Smrg    Bool pendingScreenUpdate;
1601b5d61b8Smrg
16135c4bbdfSmrg    CloseScreenProcPtr CloseScreen;
16235c4bbdfSmrg    int numAlternateVisuals;
16335c4bbdfSmrg    VisualID *alternateVisuals;
16435c4bbdfSmrg    int numImplicitRedirectExceptions;
16535c4bbdfSmrg    CompImplicitRedirectException *implicitRedirectExceptions;
16635c4bbdfSmrg
16735c4bbdfSmrg    WindowPtr pOverlayWin;
16835c4bbdfSmrg    Window overlayWid;
16935c4bbdfSmrg    CompOverlayClientPtr pOverlayClients;
17035c4bbdfSmrg
17135c4bbdfSmrg    SourceValidateProcPtr SourceValidate;
17205b261ecSmrg} CompScreenRec, *CompScreenPtr;
17305b261ecSmrg
1746747b715Smrgextern DevPrivateKeyRec CompScreenPrivateKeyRec;
17535c4bbdfSmrg
1766747b715Smrg#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
1776747b715Smrg
1786747b715Smrgextern DevPrivateKeyRec CompWindowPrivateKeyRec;
17935c4bbdfSmrg
1806747b715Smrg#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
1816747b715Smrg
1826747b715Smrgextern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
18335c4bbdfSmrg
1846747b715Smrg#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
18505b261ecSmrg
1864642e01fSmrg#define GetCompScreen(s) ((CompScreenPtr) \
1874642e01fSmrg    dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
1884642e01fSmrg#define GetCompWindow(w) ((CompWindowPtr) \
1894642e01fSmrg    dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
1904642e01fSmrg#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
1914642e01fSmrg    dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
19205b261ecSmrg
19335c4bbdfSmrgextern RESTYPE CompositeClientSubwindowsType;
19435c4bbdfSmrgextern RESTYPE CompositeClientOverlayType;
19505b261ecSmrg
19605b261ecSmrg/*
19705b261ecSmrg * compalloc.c
19805b261ecSmrg */
19905b261ecSmrg
20005b261ecSmrgBool
20135c4bbdfSmrg compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
20205b261ecSmrg
20305b261ecSmrgvoid
20435c4bbdfSmrg compFreeClientWindow(WindowPtr pWin, XID id);
20505b261ecSmrg
20605b261ecSmrgint
20735c4bbdfSmrg compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update);
20805b261ecSmrg
20905b261ecSmrgint
21035c4bbdfSmrg compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
21105b261ecSmrg
21205b261ecSmrgvoid
21335c4bbdfSmrg compFreeClientSubwindows(WindowPtr pWin, XID id);
21405b261ecSmrg
21505b261ecSmrgint
21635c4bbdfSmrg compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update);
21705b261ecSmrg
21805b261ecSmrgint
21935c4bbdfSmrg compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
22005b261ecSmrg
22105b261ecSmrgint
22235c4bbdfSmrg compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin);
22305b261ecSmrg
22405b261ecSmrgBool
22535c4bbdfSmrg compAllocPixmap(WindowPtr pWin);
22605b261ecSmrg
22705b261ecSmrgvoid
22835c4bbdfSmrg compSetParentPixmap(WindowPtr pWin);
22905b261ecSmrg
23035c4bbdfSmrgvoid
23135c4bbdfSmrg compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
23205b261ecSmrg
23335c4bbdfSmrgBool
23405b261ecSmrg
23535c4bbdfSmrgcompReallocPixmap(WindowPtr pWin, int x, int y,
23635c4bbdfSmrg                  unsigned int w, unsigned int h, int bw);
23705b261ecSmrg
2381b5d61b8Smrgvoid compMarkAncestors(WindowPtr pWin);
2391b5d61b8Smrg
24005b261ecSmrg/*
24105b261ecSmrg * compinit.c
24205b261ecSmrg */
24305b261ecSmrg
24405b261ecSmrgBool
24535c4bbdfSmrg compScreenInit(ScreenPtr pScreen);
24605b261ecSmrg
2474642e01fSmrg/*
2484642e01fSmrg * compoverlay.c
2494642e01fSmrg */
2504642e01fSmrg
2514642e01fSmrgvoid
25235c4bbdfSmrg compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
2534642e01fSmrg
2544642e01fSmrgCompOverlayClientPtr
25535c4bbdfSmrgcompFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
25635c4bbdfSmrg
2574642e01fSmrgCompOverlayClientPtr
25835c4bbdfSmrgcompCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
2594642e01fSmrg
2604642e01fSmrgBool
26135c4bbdfSmrg compCreateOverlayWindow(ScreenPtr pScreen);
2624642e01fSmrg
2634642e01fSmrgvoid
26435c4bbdfSmrg compDestroyOverlayWindow(ScreenPtr pScreen);
2654642e01fSmrg
26605b261ecSmrg/*
26705b261ecSmrg * compwindow.c
26805b261ecSmrg */
26905b261ecSmrg
27005b261ecSmrg#ifdef COMPOSITE_DEBUG
27105b261ecSmrgvoid
27235c4bbdfSmrg compCheckTree(ScreenPtr pScreen);
27305b261ecSmrg#else
27405b261ecSmrg#define compCheckTree(s)
27505b261ecSmrg#endif
27605b261ecSmrg
27705b261ecSmrgvoid
2781b5d61b8Smrg compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap, int bw);
27905b261ecSmrg
28005b261ecSmrgBool
28135c4bbdfSmrg compCheckRedirect(WindowPtr pWin);
28205b261ecSmrg
28305b261ecSmrgBool
28435c4bbdfSmrg compPositionWindow(WindowPtr pWin, int x, int y);
28505b261ecSmrg
28605b261ecSmrgBool
28735c4bbdfSmrg compRealizeWindow(WindowPtr pWin);
28805b261ecSmrg
28905b261ecSmrgBool
29035c4bbdfSmrg compUnrealizeWindow(WindowPtr pWin);
29105b261ecSmrg
29205b261ecSmrgvoid
29335c4bbdfSmrg compClipNotify(WindowPtr pWin, int dx, int dy);
29405b261ecSmrg
29505b261ecSmrgvoid
29635c4bbdfSmrg compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
29705b261ecSmrg
29805b261ecSmrgvoid
29935c4bbdfSmrg
30035c4bbdfSmrgcompResizeWindow(WindowPtr pWin, int x, int y,
30135c4bbdfSmrg                 unsigned int w, unsigned int h, WindowPtr pSib);
30205b261ecSmrg
30305b261ecSmrgvoid
30435c4bbdfSmrg compChangeBorderWidth(WindowPtr pWin, unsigned int border_width);
30505b261ecSmrg
30605b261ecSmrgvoid
30735c4bbdfSmrg compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
30805b261ecSmrg
30905b261ecSmrgBool
31035c4bbdfSmrg compCreateWindow(WindowPtr pWin);
31105b261ecSmrg
31205b261ecSmrgBool
31335c4bbdfSmrg compDestroyWindow(WindowPtr pWin);
31405b261ecSmrg
31505b261ecSmrgvoid
31635c4bbdfSmrg compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
31705b261ecSmrg
31805b261ecSmrgRegionPtr
31935c4bbdfSmrg compGetRedirectBorderClip(WindowPtr pWin);
32005b261ecSmrg
32105b261ecSmrgvoid
32235c4bbdfSmrg compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
32305b261ecSmrg
32405b261ecSmrgvoid
32535c4bbdfSmrg compPaintChildrenToWindow(WindowPtr pWin);
32605b261ecSmrg
32705b261ecSmrgWindowPtr
32835c4bbdfSmrg CompositeRealChildHead(WindowPtr pWin);
32905b261ecSmrg
33005b261ecSmrgint
33135c4bbdfSmrg DeleteWindowNoInputDevices(void *value, XID wid);
33205b261ecSmrg
3336747b715Smrgint
33435c4bbdfSmrg
3356747b715SmrgcompConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
33635c4bbdfSmrg                 int bw, WindowPtr pSib);
3376747b715Smrg
33835c4bbdfSmrgvoid PanoramiXCompositeInit(void);
33935c4bbdfSmrgvoid PanoramiXCompositeReset(void);
3409ace9065Smrg
34135c4bbdfSmrg#endif                          /* _COMPINT_H_ */
342