compint.h revision 706f2543
1706f2543Smrg/*
2706f2543Smrg * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
3706f2543Smrg *
4706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5706f2543Smrg * copy of this software and associated documentation files (the "Software"),
6706f2543Smrg * to deal in the Software without restriction, including without limitation
7706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
9706f2543Smrg * Software is furnished to do so, subject to the following conditions:
10706f2543Smrg *
11706f2543Smrg * The above copyright notice and this permission notice (including the next
12706f2543Smrg * paragraph) shall be included in all copies or substantial portions of the
13706f2543Smrg * Software.
14706f2543Smrg *
15706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18706f2543Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19706f2543Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20706f2543Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21706f2543Smrg * DEALINGS IN THE SOFTWARE.
22706f2543Smrg *
23706f2543Smrg * Copyright © 2003 Keith Packard
24706f2543Smrg *
25706f2543Smrg * Permission to use, copy, modify, distribute, and sell this software and its
26706f2543Smrg * documentation for any purpose is hereby granted without fee, provided that
27706f2543Smrg * the above copyright notice appear in all copies and that both that
28706f2543Smrg * copyright notice and this permission notice appear in supporting
29706f2543Smrg * documentation, and that the name of Keith Packard not be used in
30706f2543Smrg * advertising or publicity pertaining to distribution of the software without
31706f2543Smrg * specific, written prior permission.  Keith Packard makes no
32706f2543Smrg * representations about the suitability of this software for any purpose.  It
33706f2543Smrg * is provided "as is" without express or implied warranty.
34706f2543Smrg *
35706f2543Smrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
36706f2543Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
37706f2543Smrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
38706f2543Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
39706f2543Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
40706f2543Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41706f2543Smrg * PERFORMANCE OF THIS SOFTWARE.
42706f2543Smrg */
43706f2543Smrg
44706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
45706f2543Smrg#include <dix-config.h>
46706f2543Smrg#endif
47706f2543Smrg
48706f2543Smrg#ifndef _COMPINT_H_
49706f2543Smrg#define _COMPINT_H_
50706f2543Smrg
51706f2543Smrg#include "misc.h"
52706f2543Smrg#include "scrnintstr.h"
53706f2543Smrg#include "os.h"
54706f2543Smrg#include "regionstr.h"
55706f2543Smrg#include "validate.h"
56706f2543Smrg#include "windowstr.h"
57706f2543Smrg#include "input.h"
58706f2543Smrg#include "resource.h"
59706f2543Smrg#include "colormapst.h"
60706f2543Smrg#include "cursorstr.h"
61706f2543Smrg#include "dixstruct.h"
62706f2543Smrg#include "gcstruct.h"
63706f2543Smrg#include "servermd.h"
64706f2543Smrg#include "dixevents.h"
65706f2543Smrg#include "globals.h"
66706f2543Smrg#include "picturestr.h"
67706f2543Smrg#include "extnsionst.h"
68706f2543Smrg#include "privates.h"
69706f2543Smrg#include "mi.h"
70706f2543Smrg#include "damage.h"
71706f2543Smrg#include "damageextint.h"
72706f2543Smrg#include "xfixes.h"
73706f2543Smrg#include <X11/extensions/compositeproto.h>
74706f2543Smrg#include <assert.h>
75706f2543Smrg
76706f2543Smrg/*
77706f2543Smrg *  enable this for debugging
78706f2543Smrg
79706f2543Smrg    #define COMPOSITE_DEBUG
80706f2543Smrg */
81706f2543Smrg
82706f2543Smrgtypedef struct _CompClientWindow {
83706f2543Smrg    struct _CompClientWindow	*next;
84706f2543Smrg    XID				id;
85706f2543Smrg    int				update;
86706f2543Smrg}  CompClientWindowRec, *CompClientWindowPtr;
87706f2543Smrg
88706f2543Smrgtypedef struct _CompWindow {
89706f2543Smrg    RegionRec		    borderClip;
90706f2543Smrg    DamagePtr		    damage;	/* for automatic update mode */
91706f2543Smrg    Bool		    damageRegistered;
92706f2543Smrg    Bool		    damaged;
93706f2543Smrg    int			    update;
94706f2543Smrg    CompClientWindowPtr	    clients;
95706f2543Smrg    int			    oldx;
96706f2543Smrg    int			    oldy;
97706f2543Smrg    PixmapPtr		    pOldPixmap;
98706f2543Smrg    int			    borderClipX, borderClipY;
99706f2543Smrg} CompWindowRec, *CompWindowPtr;
100706f2543Smrg
101706f2543Smrg#define COMP_ORIGIN_INVALID	    0x80000000
102706f2543Smrg
103706f2543Smrgtypedef struct _CompSubwindows {
104706f2543Smrg    int			    update;
105706f2543Smrg    CompClientWindowPtr	    clients;
106706f2543Smrg} CompSubwindowsRec, *CompSubwindowsPtr;
107706f2543Smrg
108706f2543Smrg#ifndef COMP_INCLUDE_RGB24_VISUAL
109706f2543Smrg#define COMP_INCLUDE_RGB24_VISUAL 0
110706f2543Smrg#endif
111706f2543Smrg
112706f2543Smrgtypedef struct _CompOverlayClientRec *CompOverlayClientPtr;
113706f2543Smrg
114706f2543Smrgtypedef struct _CompOverlayClientRec {
115706f2543Smrg    CompOverlayClientPtr pNext;
116706f2543Smrg    ClientPtr            pClient;
117706f2543Smrg    ScreenPtr            pScreen;
118706f2543Smrg    XID			 resource;
119706f2543Smrg} CompOverlayClientRec;
120706f2543Smrg
121706f2543Smrgtypedef struct _CompScreen {
122706f2543Smrg    PositionWindowProcPtr	PositionWindow;
123706f2543Smrg    CopyWindowProcPtr		CopyWindow;
124706f2543Smrg    CreateWindowProcPtr		CreateWindow;
125706f2543Smrg    DestroyWindowProcPtr	DestroyWindow;
126706f2543Smrg    RealizeWindowProcPtr	RealizeWindow;
127706f2543Smrg    UnrealizeWindowProcPtr	UnrealizeWindow;
128706f2543Smrg    ClipNotifyProcPtr		ClipNotify;
129706f2543Smrg    /*
130706f2543Smrg     * Called from ConfigureWindow, these
131706f2543Smrg     * three track changes to the offscreen storage
132706f2543Smrg     * geometry
133706f2543Smrg     */
134706f2543Smrg    ConfigNotifyProcPtr         ConfigNotify;
135706f2543Smrg    MoveWindowProcPtr		MoveWindow;
136706f2543Smrg    ResizeWindowProcPtr		ResizeWindow;
137706f2543Smrg    ChangeBorderWidthProcPtr	ChangeBorderWidth;
138706f2543Smrg    /*
139706f2543Smrg     * Reparenting has an effect on Subwindows redirect
140706f2543Smrg     */
141706f2543Smrg    ReparentWindowProcPtr	ReparentWindow;
142706f2543Smrg
143706f2543Smrg    /*
144706f2543Smrg     * Colormaps for new visuals better not get installed
145706f2543Smrg     */
146706f2543Smrg    InstallColormapProcPtr	InstallColormap;
147706f2543Smrg
148706f2543Smrg    /*
149706f2543Smrg     * Fake backing store via automatic redirection
150706f2543Smrg     */
151706f2543Smrg    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
152706f2543Smrg
153706f2543Smrg    ScreenBlockHandlerProcPtr	BlockHandler;
154706f2543Smrg    CloseScreenProcPtr		CloseScreen;
155706f2543Smrg    int				numAlternateVisuals;
156706f2543Smrg    VisualID			*alternateVisuals;
157706f2543Smrg
158706f2543Smrg    WindowPtr                   pOverlayWin;
159706f2543Smrg    Window			overlayWid;
160706f2543Smrg    CompOverlayClientPtr        pOverlayClients;
161706f2543Smrg
162706f2543Smrg    GetImageProcPtr		GetImage;
163706f2543Smrg    SourceValidateProcPtr	SourceValidate;
164706f2543Smrg} CompScreenRec, *CompScreenPtr;
165706f2543Smrg
166706f2543Smrgextern DevPrivateKeyRec CompScreenPrivateKeyRec;
167706f2543Smrg#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
168706f2543Smrg
169706f2543Smrgextern DevPrivateKeyRec CompWindowPrivateKeyRec;
170706f2543Smrg#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
171706f2543Smrg
172706f2543Smrgextern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
173706f2543Smrg#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
174706f2543Smrg
175706f2543Smrg#define GetCompScreen(s) ((CompScreenPtr) \
176706f2543Smrg    dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
177706f2543Smrg#define GetCompWindow(w) ((CompWindowPtr) \
178706f2543Smrg    dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
179706f2543Smrg#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
180706f2543Smrg    dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
181706f2543Smrg
182706f2543Smrgextern RESTYPE		CompositeClientWindowType;
183706f2543Smrgextern RESTYPE		CompositeClientSubwindowsType;
184706f2543Smrgextern RESTYPE		CompositeClientOverlayType;
185706f2543Smrg
186706f2543Smrg/*
187706f2543Smrg * compalloc.c
188706f2543Smrg */
189706f2543Smrg
190706f2543SmrgBool
191706f2543SmrgcompRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
192706f2543Smrg
193706f2543Smrgvoid
194706f2543SmrgcompFreeClientWindow (WindowPtr pWin, XID id);
195706f2543Smrg
196706f2543Smrgint
197706f2543SmrgcompUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
198706f2543Smrg
199706f2543Smrgint
200706f2543SmrgcompRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
201706f2543Smrg
202706f2543Smrgvoid
203706f2543SmrgcompFreeClientSubwindows (WindowPtr pWin, XID id);
204706f2543Smrg
205706f2543Smrgint
206706f2543SmrgcompUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update);
207706f2543Smrg
208706f2543Smrgint
209706f2543SmrgcompRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
210706f2543Smrg
211706f2543Smrgint
212706f2543SmrgcompUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin);
213706f2543Smrg
214706f2543SmrgBool
215706f2543SmrgcompAllocPixmap (WindowPtr pWin);
216706f2543Smrg
217706f2543Smrgvoid
218706f2543SmrgcompFreePixmap (WindowPtr pWin);
219706f2543Smrg
220706f2543SmrgBool
221706f2543SmrgcompReallocPixmap (WindowPtr pWin, int x, int y,
222706f2543Smrg		   unsigned int w, unsigned int h, int bw);
223706f2543Smrg
224706f2543Smrg/*
225706f2543Smrg * compext.c
226706f2543Smrg */
227706f2543Smrg
228706f2543Smrgvoid
229706f2543SmrgCompositeExtensionInit (void);
230706f2543Smrg
231706f2543Smrg/*
232706f2543Smrg * compinit.c
233706f2543Smrg */
234706f2543Smrg
235706f2543SmrgBool
236706f2543SmrgcompScreenInit (ScreenPtr pScreen);
237706f2543Smrg
238706f2543Smrg/*
239706f2543Smrg * compoverlay.c
240706f2543Smrg */
241706f2543Smrg
242706f2543Smrgvoid
243706f2543SmrgcompFreeOverlayClient (CompOverlayClientPtr pOcToDel);
244706f2543Smrg
245706f2543SmrgCompOverlayClientPtr
246706f2543SmrgcompFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
247706f2543Smrg
248706f2543SmrgCompOverlayClientPtr
249706f2543SmrgcompCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient);
250706f2543Smrg
251706f2543SmrgBool
252706f2543SmrgcompCreateOverlayWindow (ScreenPtr pScreen);
253706f2543Smrg
254706f2543Smrgvoid
255706f2543SmrgcompDestroyOverlayWindow (ScreenPtr pScreen);
256706f2543Smrg
257706f2543Smrg/*
258706f2543Smrg * compwindow.c
259706f2543Smrg */
260706f2543Smrg
261706f2543Smrg#ifdef COMPOSITE_DEBUG
262706f2543Smrgvoid
263706f2543SmrgcompCheckTree (ScreenPtr pScreen);
264706f2543Smrg#else
265706f2543Smrg#define compCheckTree(s)
266706f2543Smrg#endif
267706f2543Smrg
268706f2543SmrgPictFormatPtr
269706f2543SmrgcompWindowFormat (WindowPtr pWin);
270706f2543Smrg
271706f2543Smrgvoid
272706f2543SmrgcompSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
273706f2543Smrg
274706f2543SmrgBool
275706f2543SmrgcompCheckRedirect (WindowPtr pWin);
276706f2543Smrg
277706f2543SmrgBool
278706f2543SmrgcompPositionWindow (WindowPtr pWin, int x, int y);
279706f2543Smrg
280706f2543SmrgBool
281706f2543SmrgcompRealizeWindow (WindowPtr pWin);
282706f2543Smrg
283706f2543SmrgBool
284706f2543SmrgcompUnrealizeWindow (WindowPtr pWin);
285706f2543Smrg
286706f2543Smrgvoid
287706f2543SmrgcompClipNotify (WindowPtr pWin, int dx, int dy);
288706f2543Smrg
289706f2543Smrgvoid
290706f2543SmrgcompMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
291706f2543Smrg
292706f2543Smrgvoid
293706f2543SmrgcompResizeWindow (WindowPtr pWin, int x, int y,
294706f2543Smrg		  unsigned int w, unsigned int h, WindowPtr pSib);
295706f2543Smrg
296706f2543Smrgvoid
297706f2543SmrgcompChangeBorderWidth (WindowPtr pWin, unsigned int border_width);
298706f2543Smrg
299706f2543Smrgvoid
300706f2543SmrgcompReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
301706f2543Smrg
302706f2543SmrgBool
303706f2543SmrgcompCreateWindow (WindowPtr pWin);
304706f2543Smrg
305706f2543SmrgBool
306706f2543SmrgcompDestroyWindow (WindowPtr pWin);
307706f2543Smrg
308706f2543Smrgvoid
309706f2543SmrgcompSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion);
310706f2543Smrg
311706f2543SmrgRegionPtr
312706f2543SmrgcompGetRedirectBorderClip (WindowPtr pWin);
313706f2543Smrg
314706f2543Smrgvoid
315706f2543SmrgcompCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
316706f2543Smrg
317706f2543Smrgvoid
318706f2543SmrgcompPaintChildrenToWindow (WindowPtr pWin);
319706f2543Smrg
320706f2543SmrgWindowPtr
321706f2543SmrgCompositeRealChildHead (WindowPtr pWin);
322706f2543Smrg
323706f2543Smrgint
324706f2543SmrgDeleteWindowNoInputDevices(pointer value, XID wid);
325706f2543Smrg
326706f2543Smrgint
327706f2543SmrgcompConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
328706f2543Smrg		 int bw, WindowPtr pSib);
329706f2543Smrg
330706f2543Smrgvoid PanoramiXCompositeInit (void);
331706f2543Smrgvoid PanoramiXCompositeReset (void);
332706f2543Smrg
333706f2543Smrg#endif /* _COMPINT_H_ */
334