1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef __Window_H__
#define __Window_H__
#include "Options.h"
#include "Rootless.h"
#include "Pixmaps.h"
#include "validate.h"
typedef struct
{
Window window;
int x;
int y;
unsigned int width;
unsigned int height;
unsigned int borderWidth;
Window siblingAbove;
int backingStore;
#ifdef SHAPE
RegionPtr boundingShape;
RegionPtr clipShape;
#endif /* SHAPE */
void *pPicture;
/*
* Set if the window is mapped
* on the remote server.
*/
int isMapped;
/*
* Set if the window on the remote
* server is redirected by using
* the composite extension.
*/
int isRedirected;
int visibilityState;
RegionPtr corruptedRegion;
int hasTransparentChildren;
int containGlyphs;
int deferredBackgroundExpose;
XID corruptedId;
PixmapPtr synchronizationBitmap;
Time corruptedTimestamp;
SplitResourcePtr splitResource;
} nxagentPrivWindowRec;
typedef nxagentPrivWindowRec *nxagentPrivWindowPtr;
typedef struct
{
unsigned long storingPixmapId;
PixmapPtr pStoringPixmap;
WindowPtr pSavedWindow;
int backingStoreX;
int backingStoreY;
} StoringPixmapRec;
typedef StoringPixmapRec *StoringPixmapPtr;
int nxagentAddItemBSPixmapList(unsigned long, PixmapPtr, WindowPtr, int, int);
int nxagentRemoveItemBSPixmapList(unsigned long);
void nxagentInitBSPixmapList(void);
int nxagentEmptyBSPixmapList(void);
StoringPixmapPtr nxagentFindItemBSPixmapList (unsigned long);
extern int nxagentWindowPrivateIndex;
#define nxagentWindowPriv(pWin) \
((nxagentPrivWindowPtr)((pWin)->devPrivates[nxagentWindowPrivateIndex].ptr))
#define nxagentWindow(pWin) (nxagentWindowPriv(pWin)->window)
/*
* Window is either a child of our root
* or a child of the root of the real X
* server.
*/
#define nxagentWindowParent(pWin) \
(nxagentOption(Rootless) ? \
nxagentRootlessWindowParent(pWin) : \
((pWin)->parent ? \
nxagentWindow((pWin)->parent) : \
nxagentDefaultWindows[pWin->drawable.pScreen->myNum]))
/*
* True if this is a top level window.
*/
#define nxagentWindowTopLevel(pWin) \
(pWin && (pWin -> parent == NULL || \
pWin->parent == nxagentRootlessWindow))
#define nxagentWindowSiblingAbove(pWin) \
((pWin)->prevSib ? nxagentWindow((pWin)->prevSib) : None)
#define nxagentWindowSiblingBelow(pWin) \
((pWin)->nextSib ? nxagentWindow((pWin)->nextSib) : None)
#define nxagentWindowCorruptedRegion(pWin) \
(nxagentWindowPriv(pWin) -> corruptedRegion)
#define nxagentWindowContainGlyphs(pWin) \
(nxagentWindowPriv(pWin) -> containGlyphs)
#define nxagentWindowTimestamp(pWin) \
(nxagentWindowPriv(pWin) -> corruptedTimestamp)
#define nxagentWindowIsVisible(pWin) \
((pWin) -> viewable == 1 && \
(pWin) -> drawable.class != InputOnly && \
(pWin) -> visibility != VisibilityFullyObscured)
#define nxagentDefaultWindowIsVisible() \
(nxagentVisibility != VisibilityFullyObscured)
#define CWParent CWSibling
#define CWStackingOrder CWStackMode
#define CW_Map (1 << 15)
#define CW_Update (1 << 16)
#define CW_Shape (1 << 17)
#define CW_RootlessRestack (1 << 18)
/*
* This force the agent to send exposures
* for all windows.
*/
#define nxagentRefreshScreen() \
do\
{\
nxagentRefreshWindows(WindowTable[0]);\
} while (0)
WindowPtr nxagentWindowPtr(Window window);
extern Atom serverCutProperty;
/*
* If the rectangles in an exposed region exceed
* the number of 4, we let the function decide if
* it is better to send the window extents rather
* than the rectangles in the region.
*/
int nxagentExtentsPredicate(int total);
/*
* Agent's nested window procedures. Look also
* at Rootless.h for the rootless counterparts.
*/
Bool nxagentCreateWindow(WindowPtr pWin);
Bool nxagentDestroyWindow(WindowPtr pWin);
Bool nxagentPositionWindow(WindowPtr pWin, int x, int y);
Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
Bool nxagentRealizeWindow(WindowPtr pWin);
Bool nxagentUnrealizeWindow(WindowPtr pWin);
Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask);
void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed);
void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what);
void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what);
void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion);
void nxagentClipNotify(WindowPtr pWin, int dx, int dy);
void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);
void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent);
void nxagentRefreshWindows(WindowPtr pWin);
void nxagentSetTopLevelEventMask(WindowPtr pWin);
void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn);
void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn);
void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift);
#ifdef VIEWPORT_FRAME
void nxagentUpdateViewportFrame(int x, int y, int w, int h);
#else /* #ifdef VIEWPORT_FRAME */
#define nxagentUpdateViewportFrame(x, y, w, h)
#endif /* #ifdef VIEWPORT_FRAME */
void nxagentUnmapWindows(void);
void nxagentMapDefaultWindows(void);
Bool nxagentSetWindowCursors(void *p0);
/*
* The ConfigureWindow procedure has not
* a pointer in the screen structure.
*/
void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask);
/*
* Used to track nxagent window's visibility.
*/
extern int nxagentVisibility;
extern unsigned long nxagentVisibilityTimeout;
extern Bool nxagentVisibilityStop;
/*
* Return the pointer to the window given the
* remote id. It tries to match the id from
* the last matched window before iterating
* through the hierarchy.
*/
WindowPtr nxagentGetWindowFromID(Window id);
/*
* Handle the shape bitmap for windows.
*/
#ifdef SHAPE
void nxagentShapeWindow(WindowPtr pWin);
#endif
extern Window nxagentConfiguredSynchroWindow;
extern Bool nxagentExposeArrayIsInitialized;
typedef struct _ConfiguredWindow
{
WindowPtr pWin;
struct _ConfiguredWindow *next;
struct _ConfiguredWindow *prev;
unsigned int valuemask;
} ConfiguredWindowStruct;
ConfiguredWindowStruct *nxagentConfiguredWindowList;
typedef struct _StaticResizedWindow
{
WindowPtr pWin;
struct _StaticResizedWindow *next;
struct _StaticResizedWindow *prev;
unsigned long sequence;
int offX;
int offY;
} StaticResizedWindowStruct;
StaticResizedWindowStruct *nxagentStaticResizedWindowList;
void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);
void nxagentFlushConfigureWindow(void);
void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask);
void nxagentDeleteConfiguredWindow(WindowPtr pWin);
void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int offX, int offY);
void nxagentDeleteStaticResizedWindow(unsigned long sequence);
StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence);
void nxagentEmptyAllBackingStoreRegions(void);
#endif /* __Window_H__ */
|