VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/rootless.h@ 62425

最後變更 在這個檔案從62425是 32163,由 vboxsync 提交於 14 年 前

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • 屬性 svn:eol-style 設為 native
檔案大小: 14.5 KB
 
1/*
2 * External interface to generic rootless mode
3 */
4/*
5 * Copyright (c) 2001 Greg Parker. All Rights Reserved.
6 * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
25 *
26 * Except as contained in this notice, the name(s) of the above copyright
27 * holders shall not be used in advertising or otherwise to promote the sale,
28 * use or other dealings in this Software without prior written authorization.
29 */
30
31#ifdef HAVE_DIX_CONFIG_H
32#include <dix-config.h>
33#endif
34
35#ifndef _ROOTLESS_H
36#define _ROOTLESS_H
37
38#include "rootlessConfig.h"
39#include "mi.h"
40#include "gcstruct.h"
41
42/*
43 Each top-level rootless window has a one-to-one correspondence to a physical
44 on-screen window. The physical window is refered to as a "frame".
45 */
46
47typedef void * RootlessFrameID;
48
49/*
50 * RootlessWindowRec
51 * This structure stores the per-frame data used by the rootless code.
52 * Each top-level X window has one RootlessWindowRec associated with it.
53 */
54typedef struct _RootlessWindowRec {
55 // Position and size includes the window border
56 // Position is in per-screen coordinates
57 int x, y;
58 unsigned int width, height;
59 unsigned int borderWidth;
60 int level;
61
62 RootlessFrameID wid; // implementation specific frame id
63 WindowPtr win; // underlying X window
64
65 // Valid only when drawing (ie. is_drawing is set)
66 char *pixelData;
67 int bytesPerRow;
68
69 PixmapPtr pixmap;
70
71#ifdef ROOTLESS_TRACK_DAMAGE
72 RegionRec damage;
73#endif
74
75 unsigned int is_drawing :1; // Currently drawing?
76 unsigned int is_reorder_pending :1;
77 unsigned int is_offscreen :1;
78 unsigned int is_obscured :1;
79} RootlessWindowRec, *RootlessWindowPtr;
80
81
82/* Offset for screen-local to global coordinate transforms */
83#ifdef ROOTLESS_GLOBAL_COORDS
84extern int rootlessGlobalOffsetX;
85extern int rootlessGlobalOffsetY;
86#endif
87
88/* The minimum number of bytes or pixels for which to use the
89 implementation's accelerated functions. */
90extern unsigned int rootless_CopyBytes_threshold;
91extern unsigned int rootless_FillBytes_threshold;
92extern unsigned int rootless_CompositePixels_threshold;
93extern unsigned int rootless_CopyWindow_threshold;
94
95/* Operations used by CompositePixels */
96enum rl_composite_op_enum {
97 RL_COMPOSITE_SRC = 0,
98 RL_COMPOSITE_OVER,
99};
100
101/* Data formats for depth field and composite functions */
102enum rl_depth_enum {
103 RL_DEPTH_NIL = 0, /* null source when compositing */
104 RL_DEPTH_ARGB8888,
105 RL_DEPTH_RGB555,
106 RL_DEPTH_A8, /* for masks when compositing */
107 RL_DEPTH_INDEX8,
108};
109
110/* Macro to form the composite function for CompositePixels */
111#define RL_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \
112 (((op) << 24) | ((src_depth) << 16) \
113 | ((mask_depth) << 8) | ((dest_depth) << 0))
114
115/* Gravity for window contents during resizing */
116enum rl_gravity_enum {
117 RL_GRAVITY_NONE = 0, /* no gravity, fill everything */
118 RL_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
119 RL_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
120 RL_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
121 RL_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
122};
123
124
125/*------------------------------------------
126 Rootless Implementation Functions
127 ------------------------------------------*/
128
129/*
130 * Create a new frame.
131 * The frame is created unmapped.
132 *
133 * pFrame RootlessWindowPtr for this frame should be completely
134 * initialized before calling except for pFrame->wid, which
135 * is set by this function.
136 * pScreen Screen on which to place the new frame
137 * newX, newY Position of the frame. These will be identical to pFrame-x,
138 * pFrame->y unless ROOTLESS_GLOBAL_COORDS is set.
139 * pNewShape Shape for the frame (in frame-local coordinates). NULL for
140 * unshaped frames.
141 */
142typedef Bool (*RootlessCreateFrameProc)
143 (RootlessWindowPtr pFrame, ScreenPtr pScreen, int newX, int newY,
144 RegionPtr pNewShape);
145
146/*
147 * Destroy a frame.
148 * Drawing is stopped and all updates are flushed before this is called.
149 *
150 * wid Frame id
151 */
152typedef void (*RootlessDestroyFrameProc)
153 (RootlessFrameID wid);
154
155/*
156 * Move a frame on screen.
157 * Drawing is stopped and all updates are flushed before this is called.
158 *
159 * wid Frame id
160 * pScreen Screen to move the new frame to
161 * newX, newY New position of the frame
162 */
163typedef void (*RootlessMoveFrameProc)
164 (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
165
166/*
167 * Resize and move a frame.
168 * Drawing is stopped and all updates are flushed before this is called.
169 *
170 * wid Frame id
171 * pScreen Screen to move the new frame to
172 * newX, newY New position of the frame
173 * newW, newH New size of the frame
174 * gravity Gravity for window contents (rl_gravity_enum). This is always
175 * RL_GRAVITY_NONE unless ROOTLESS_RESIZE_GRAVITY is set.
176 */
177typedef void (*RootlessResizeFrameProc)
178 (RootlessFrameID wid, ScreenPtr pScreen,
179 int newX, int newY, unsigned int newW, unsigned int newH,
180 unsigned int gravity);
181
182/*
183 * Change frame ordering (AKA stacking, layering).
184 * Drawing is stopped before this is called. Unmapped frames are mapped by
185 * setting their ordering.
186 *
187 * wid Frame id
188 * nextWid Frame id of frame that is now above this one or NULL if this
189 * frame is at the top.
190 */
191typedef void (*RootlessRestackFrameProc)
192 (RootlessFrameID wid, RootlessFrameID nextWid);
193
194/*
195 * Change frame's shape.
196 * Drawing is stopped before this is called.
197 *
198 * wid Frame id
199 * pNewShape New shape for the frame (in frame-local coordinates)
200 * or NULL if now unshaped.
201 */
202typedef void (*RootlessReshapeFrameProc)
203 (RootlessFrameID wid, RegionPtr pNewShape);
204
205/*
206 * Unmap a frame.
207 *
208 * wid Frame id
209 */
210typedef void (*RootlessUnmapFrameProc)
211 (RootlessFrameID wid);
212
213/*
214 * Start drawing to a frame.
215 * Prepare a frame for direct access to its backing buffer.
216 *
217 * wid Frame id
218 * pixelData Address of the backing buffer (returned)
219 * bytesPerRow Width in bytes of the backing buffer (returned)
220 */
221typedef void (*RootlessStartDrawingProc)
222 (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
223
224/*
225 * Stop drawing to a frame.
226 * No drawing to the frame's backing buffer will occur until drawing
227 * is started again.
228 *
229 * wid Frame id
230 * flush Flush drawing updates for this frame to the screen. This
231 * will always be FALSE if ROOTLESS_TRACK_DAMAGE is set.
232 */
233typedef void (*RootlessStopDrawingProc)
234 (RootlessFrameID wid, Bool flush);
235
236/*
237 * Flush drawing updates to the screen.
238 * Drawing is stopped before this is called.
239 *
240 * wid Frame id
241 * pDamage Region containing all the changed pixels in frame-lcoal
242 * coordinates. This is clipped to the window's clip. This
243 * will be NULL if ROOTLESS_TRACK_DAMAGE is not set.
244 */
245typedef void (*RootlessUpdateRegionProc)
246 (RootlessFrameID wid, RegionPtr pDamage);
247
248/*
249 * Mark damaged rectangles as requiring redisplay to screen.
250 * This will only be called if ROOTLESS_TRACK_DAMAGE is not set.
251 *
252 * wid Frame id
253 * nrects Number of damaged rectangles
254 * rects Array of damaged rectangles in frame-local coordinates
255 * shift_x, Vector to shift rectangles by
256 * shift_y
257 */
258typedef void (*RootlessDamageRectsProc)
259 (RootlessFrameID wid, int nrects, const BoxRec *rects,
260 int shift_x, int shift_y);
261
262/*
263 * Switch the window associated with a frame. (Optional)
264 * When a framed window is reparented, the frame is resized and set to
265 * use the new top-level parent. If defined this function will be called
266 * afterwards for implementation specific bookkeeping.
267 *
268 * pFrame Frame whose window has switched
269 * oldWin Previous window wrapped by this frame
270 */
271typedef void (*RootlessSwitchWindowProc)
272 (RootlessWindowPtr pFrame, WindowPtr oldWin);
273
274/*
275 * Check if window should be reordered. (Optional)
276 * The underlying window system may animate windows being ordered in.
277 * We want them to be mapped but remain ordered out until the animation
278 * completes. If defined this function will be called to check if a
279 * framed window should be reordered now. If this function returns
280 * FALSE, the window will still be mapped from the X11 perspective, but
281 * the RestackFrame function will not be called for its frame.
282 *
283 * pFrame Frame to reorder
284 */
285typedef Bool (*RootlessDoReorderWindowProc)
286 (RootlessWindowPtr pFrame);
287
288/*
289 * Copy bytes. (Optional)
290 * Source and destinate may overlap and the right thing should happen.
291 *
292 * width Bytes to copy per row
293 * height Number of rows
294 * src Source data
295 * srcRowBytes Width of source in bytes
296 * dst Destination data
297 * dstRowBytes Width of destination in bytes
298 */
299typedef void (*RootlessCopyBytesProc)
300 (unsigned int width, unsigned int height,
301 const void *src, unsigned int srcRowBytes,
302 void *dst, unsigned int dstRowBytes);
303
304/*
305 * Fill memory with 32-bit pattern. (Optional)
306 *
307 * width Bytes to fill per row
308 * height Number of rows
309 * value 32-bit pattern to fill with
310 * dst Destination data
311 * dstRowBytes Width of destination in bytes
312 */
313typedef void (*RootlessFillBytesProc)
314 (unsigned int width, unsigned int height, unsigned int value,
315 void *dst, unsigned int dstRowBytes);
316
317/*
318 * Composite pixels from source and mask to destination. (Optional)
319 *
320 * width, height Size of area to composite to in pizels
321 * function Composite function built with RL_COMPOSITE_FUNCTION
322 * src Source data
323 * srcRowBytes Width of source in bytes (Passing NULL means source
324 * is a single pixel.
325 * mask Mask data
326 * maskRowBytes Width of mask in bytes
327 * dst Destination data
328 * dstRowBytes Width of destination in bytes
329 *
330 * For src and dst, the first element of the array is the color data. If
331 * the second element is non-null it implies there is alpha data (which
332 * may be meshed or planar). Data without alpha is assumed to be opaque.
333 *
334 * An X11 error code is returned.
335 */
336typedef int (*RootlessCompositePixelsProc)
337 (unsigned int width, unsigned int height, unsigned int function,
338 void *src[2], unsigned int srcRowBytes[2],
339 void *mask, unsigned int maskRowBytes,
340 void *dst[2], unsigned int dstRowBytes[2]);
341
342/*
343 * Copy area in frame to another part of frame. (Optional)
344 *
345 * wid Frame id
346 * dstNrects Number of rectangles to copy
347 * dstRects Array of rectangles to copy
348 * dx, dy Number of pixels away to copy area
349 */
350typedef void (*RootlessCopyWindowProc)
351 (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
352 int dx, int dy);
353
354
355typedef void (*RootlessHideWindowProc)
356 (RootlessFrameID wid);
357
358typedef void (*RootlessUpdateColormapProc)
359 (RootlessFrameID wid, ScreenPtr pScreen);
360
361/*
362 * Rootless implementation function list
363 */
364typedef struct _RootlessFrameProcs {
365 RootlessCreateFrameProc CreateFrame;
366 RootlessDestroyFrameProc DestroyFrame;
367
368 RootlessMoveFrameProc MoveFrame;
369 RootlessResizeFrameProc ResizeFrame;
370 RootlessRestackFrameProc RestackFrame;
371 RootlessReshapeFrameProc ReshapeFrame;
372 RootlessUnmapFrameProc UnmapFrame;
373
374 RootlessStartDrawingProc StartDrawing;
375 RootlessStopDrawingProc StopDrawing;
376 RootlessUpdateRegionProc UpdateRegion;
377#ifndef ROOTLESS_TRACK_DAMAGE
378 RootlessDamageRectsProc DamageRects;
379#endif
380
381 /* Optional frame functions */
382 RootlessSwitchWindowProc SwitchWindow;
383 RootlessDoReorderWindowProc DoReorderWindow;
384 RootlessHideWindowProc HideWindow;
385 RootlessUpdateColormapProc UpdateColormap;
386
387 /* Optional acceleration functions */
388 RootlessCopyBytesProc CopyBytes;
389 RootlessFillBytesProc FillBytes;
390 RootlessCompositePixelsProc CompositePixels;
391 RootlessCopyWindowProc CopyWindow;
392} RootlessFrameProcsRec, *RootlessFrameProcsPtr;
393
394
395/*
396 * Initialize rootless mode on the given screen.
397 */
398Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs);
399
400/*
401 * Initialize acceleration for rootless mode on a given screen.
402 * Note: RootlessAccelInit() must be called before DamageSetup()
403 * and RootlessInit() must be called afterwards.
404 */
405Bool RootlessAccelInit(ScreenPtr pScreen);
406
407/*
408 * Return the frame ID for the physical window displaying the given window.
409 *
410 * create If true and the window has no frame, attempt to create one
411 */
412RootlessFrameID RootlessFrameForWindow(WindowPtr pWin, Bool create);
413
414/*
415 * Return the top-level parent of a window.
416 * The root is the top-level parent of itself, even though the root is
417 * not otherwise considered to be a top-level window.
418 */
419WindowPtr TopLevelParent(WindowPtr pWindow);
420
421/*
422 * Prepare a window for direct access to its backing buffer.
423 */
424void RootlessStartDrawing(WindowPtr pWindow);
425
426/*
427 * Finish drawing to a window's backing buffer.
428 *
429 * flush If true and ROOTLESS_TRACK_DAMAGE is set, damaged areas
430 * are flushed to the screen.
431 */
432void RootlessStopDrawing(WindowPtr pWindow, Bool flush);
433
434/*
435 * Alocate a new screen pixmap.
436 * miCreateScreenResources does not do this properly with a null
437 * framebuffer pointer.
438 */
439void RootlessUpdateScreenPixmap(ScreenPtr pScreen);
440
441/*
442 * Reposition all windows on a screen to their correct positions.
443 */
444void RootlessRepositionWindows(ScreenPtr pScreen);
445
446/*
447 * Bring all windows to the front of the native stack
448 */
449void RootlessOrderAllWindows (Bool include_unhitable);
450#endif /* _ROOTLESS_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette