1 | /* Xplugin.h -- windowing API for rootless X11 server
|
---|
2 | $Id$
|
---|
3 |
|
---|
4 | Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
|
---|
5 |
|
---|
6 | Permission is hereby granted, free of charge, to any person
|
---|
7 | obtaining a copy of this software and associated documentation files
|
---|
8 | (the "Software"), to deal in the Software without restriction,
|
---|
9 | including without limitation the rights to use, copy, modify, merge,
|
---|
10 | publish, distribute, sublicense, and/or sell copies of the Software,
|
---|
11 | and to permit persons to whom the Software is furnished to do so,
|
---|
12 | subject to the following conditions:
|
---|
13 |
|
---|
14 | The above copyright notice and this permission notice shall be
|
---|
15 | included in all copies or substantial portions of the Software.
|
---|
16 |
|
---|
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
20 | NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
---|
21 | HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
23 | 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
|
---|
27 | copyright holders shall not be used in advertising or otherwise to
|
---|
28 | promote the sale, use or other dealings in this Software without
|
---|
29 | prior written authorization.
|
---|
30 |
|
---|
31 | Note that these interfaces are provided solely for the use of the
|
---|
32 | X11 server. Any other uses are unsupported and strongly discouraged. */
|
---|
33 | /* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/Xplugin.h,v 1.2 2003/05/02 00:08:49 torrey Exp $ */
|
---|
34 |
|
---|
35 | #ifndef XPLUGIN_H
|
---|
36 | #define XPLUGIN_H 1
|
---|
37 |
|
---|
38 | #include <stdint.h>
|
---|
39 |
|
---|
40 | /* By default we use the X server definition of BoxRec to define xp_box,
|
---|
41 | so that the compiler can silently convert between the two. But if
|
---|
42 | XP_NO_X_HEADERS is defined, we'll define it ourselves. */
|
---|
43 |
|
---|
44 | #ifndef XP_NO_X_HEADERS
|
---|
45 | # include "miscstruct.h"
|
---|
46 | typedef BoxRec xp_box;
|
---|
47 | #else
|
---|
48 | struct xp_box_struct {
|
---|
49 | short x1, y1, x2, y2;
|
---|
50 | };
|
---|
51 | typedef struct xp_box_struct xp_box;
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | typedef unsigned int xp_resource_id;
|
---|
55 | typedef xp_resource_id xp_window_id;
|
---|
56 | typedef xp_resource_id xp_surface_id;
|
---|
57 | typedef unsigned int xp_client_id;
|
---|
58 | typedef unsigned int xp_request_type;
|
---|
59 | typedef int xp_error;
|
---|
60 | typedef int xp_bool;
|
---|
61 |
|
---|
62 |
|
---|
63 | /* Error codes that the functions declared here may return. They all
|
---|
64 | numerically match their X equivalents, i.e. the XP_ can be dropped
|
---|
65 | if <X11/X.h> has been included. */
|
---|
66 |
|
---|
67 | enum xp_error_enum {
|
---|
68 | XP_Success = 0,
|
---|
69 | XP_BadRequest = 1,
|
---|
70 | XP_BadValue = 2,
|
---|
71 | XP_BadWindow = 3,
|
---|
72 | XP_BadMatch = 8,
|
---|
73 | XP_BadAccess = 10,
|
---|
74 | XP_BadImplementation = 17,
|
---|
75 | };
|
---|
76 |
|
---|
77 |
|
---|
78 | /* Event types generated by the plugin. */
|
---|
79 |
|
---|
80 | enum xp_event_type_enum {
|
---|
81 | /* The global display configuration changed somehow. */
|
---|
82 | XP_EVENT_DISPLAY_CHANGED = 1 << 0,
|
---|
83 |
|
---|
84 | /* A window changed state. Argument is xp_window_state_event */
|
---|
85 | XP_EVENT_WINDOW_STATE_CHANGED = 1 << 1,
|
---|
86 |
|
---|
87 | /* An async request encountered an error. Argument is of type
|
---|
88 | xp_async_error_event */
|
---|
89 | XP_EVENT_ASYNC_ERROR = 1 << 2,
|
---|
90 |
|
---|
91 | /* Sent when a surface is destroyed as a side effect of destroying
|
---|
92 | a window. Arg is of type xp_surface_id. */
|
---|
93 | XP_EVENT_SURFACE_DESTROYED = 1 << 3,
|
---|
94 |
|
---|
95 | /* Sent when any GL contexts pointing at the given surface need to
|
---|
96 | call xp_update_gl_context () to refresh their state (because the
|
---|
97 | window moved or was resized. Arg is of type xp_surface_id. */
|
---|
98 | XP_EVENT_SURFACE_CHANGED = 1 << 4,
|
---|
99 |
|
---|
100 | /* Sent when a window has been moved. Arg is of type xp_window_id. */
|
---|
101 | XP_EVENT_WINDOW_MOVED = 1 << 5,
|
---|
102 | };
|
---|
103 |
|
---|
104 | /* Function type used to receive events. */
|
---|
105 |
|
---|
106 | typedef void (xp_event_fun) (unsigned int type, const void *arg,
|
---|
107 | unsigned int arg_size, void *user_data);
|
---|
108 |
|
---|
109 |
|
---|
110 | /* Operation types. Used when reporting errors asynchronously. */
|
---|
111 |
|
---|
112 | enum xp_request_type_enum {
|
---|
113 | XP_REQUEST_NIL = 0,
|
---|
114 | XP_REQUEST_DESTROY_WINDOW = 1,
|
---|
115 | XP_REQUEST_CONFIGURE_WINDOW = 2,
|
---|
116 | XP_REQUEST_FLUSH_WINDOW = 3,
|
---|
117 | XP_REQUEST_COPY_WINDOW = 4,
|
---|
118 | XP_REQUEST_UNLOCK_WINDOW = 5,
|
---|
119 | XP_REQUEST_DISABLE_UPDATE = 6,
|
---|
120 | XP_REQUEST_REENABLE_UPDATE = 7,
|
---|
121 | XP_REQUEST_HIDE_CURSOR = 8,
|
---|
122 | XP_REQUEST_SHOW_CURSOR = 9,
|
---|
123 | XP_REQUEST_FRAME_DRAW = 10,
|
---|
124 | };
|
---|
125 |
|
---|
126 | /* Structure used to report an error asynchronously. Passed as the "arg"
|
---|
127 | of an XP_EVENT_ASYNC_ERROR event. */
|
---|
128 |
|
---|
129 | struct xp_async_error_event_struct {
|
---|
130 | xp_request_type request_type;
|
---|
131 | xp_resource_id id;
|
---|
132 | xp_error error;
|
---|
133 | };
|
---|
134 |
|
---|
135 | typedef struct xp_async_error_event_struct xp_async_error_event;
|
---|
136 |
|
---|
137 |
|
---|
138 | /* Possible window states. */
|
---|
139 |
|
---|
140 | enum xp_window_state_enum {
|
---|
141 | /* The window is not in the global list of possibly-visible windows. */
|
---|
142 | XP_WINDOW_STATE_OFFSCREEN = 1 << 0,
|
---|
143 |
|
---|
144 | /* Parts of the window may be obscured by other windows. */
|
---|
145 | XP_WINDOW_STATE_OBSCURED = 1 << 1,
|
---|
146 | };
|
---|
147 |
|
---|
148 | /* Structure passed as argument of an XP_EVENT_WINDOW_STATE_CHANGED event. */
|
---|
149 |
|
---|
150 | struct xp_window_state_event_struct {
|
---|
151 | xp_window_id id;
|
---|
152 | unsigned int state;
|
---|
153 | };
|
---|
154 |
|
---|
155 | typedef struct xp_window_state_event_struct xp_window_state_event;
|
---|
156 |
|
---|
157 |
|
---|
158 | /* Function type used to supply a colormap for indexed drawables. */
|
---|
159 |
|
---|
160 | typedef xp_error (xp_colormap_fun) (void *data, int first_color,
|
---|
161 | int n_colors, uint32_t *colors);
|
---|
162 |
|
---|
163 |
|
---|
164 | /* Window attributes structure. Used when creating and configuring windows.
|
---|
165 | Also used when configuring surfaces attached to windows. Functions that
|
---|
166 | take one of these structures also take a bit mask defining which
|
---|
167 | fields are set to meaningful values. */
|
---|
168 |
|
---|
169 | enum xp_window_changes_enum {
|
---|
170 | XP_ORIGIN = 1 << 0,
|
---|
171 | XP_SIZE = 1 << 1,
|
---|
172 | XP_BOUNDS = XP_ORIGIN | XP_SIZE,
|
---|
173 | XP_SHAPE = 1 << 2,
|
---|
174 | XP_STACKING = 1 << 3,
|
---|
175 | XP_DEPTH = 1 << 4,
|
---|
176 | XP_COLORMAP = 1 << 5,
|
---|
177 | XP_WINDOW_LEVEL = 1 << 6,
|
---|
178 | };
|
---|
179 |
|
---|
180 | struct xp_window_changes_struct {
|
---|
181 | /* XP_ORIGIN */
|
---|
182 | int x, y;
|
---|
183 |
|
---|
184 | /* XP_SIZE */
|
---|
185 | unsigned int width, height;
|
---|
186 | int bit_gravity; /* how to resize the backing store */
|
---|
187 |
|
---|
188 | /* XP_SHAPE */
|
---|
189 | int shape_nrects; /* -1 = remove shape */
|
---|
190 | xp_box *shape_rects;
|
---|
191 | int shape_tx, shape_ty; /* translation for shape */
|
---|
192 |
|
---|
193 | /* XP_STACKING */
|
---|
194 | int stack_mode;
|
---|
195 | xp_window_id sibling; /* may be zero; in ABOVE/BELOW modes
|
---|
196 | it may specify a relative window */
|
---|
197 | /* XP_DEPTH, window-only */
|
---|
198 | unsigned int depth;
|
---|
199 |
|
---|
200 | /* XP_COLORMAP, window-only */
|
---|
201 | xp_colormap_fun *colormap;
|
---|
202 | void *colormap_data;
|
---|
203 |
|
---|
204 | /* XP_WINDOW_LEVEL, window-only */
|
---|
205 | int window_level;
|
---|
206 | };
|
---|
207 |
|
---|
208 | typedef struct xp_window_changes_struct xp_window_changes;
|
---|
209 |
|
---|
210 | /* Values for bit_gravity field */
|
---|
211 |
|
---|
212 | enum xp_bit_gravity_enum {
|
---|
213 | XP_GRAVITY_NONE = 0, /* no gravity, fill everything */
|
---|
214 | XP_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
|
---|
215 | XP_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
|
---|
216 | XP_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
|
---|
217 | XP_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
|
---|
218 | };
|
---|
219 |
|
---|
220 | /* Values for stack_mode field */
|
---|
221 |
|
---|
222 | enum xp_window_stack_mode_enum {
|
---|
223 | XP_UNMAPPED = 0, /* remove the window */
|
---|
224 | XP_MAPPED_ABOVE = 1, /* display the window on top */
|
---|
225 | XP_MAPPED_BELOW = 2, /* display the window at bottom */
|
---|
226 | };
|
---|
227 |
|
---|
228 | /* Data formats for depth field and composite functions */
|
---|
229 |
|
---|
230 | enum xp_depth_enum {
|
---|
231 | XP_DEPTH_NIL = 0, /* null source when compositing */
|
---|
232 | XP_DEPTH_ARGB8888,
|
---|
233 | XP_DEPTH_RGB555,
|
---|
234 | XP_DEPTH_A8, /* for masks when compositing */
|
---|
235 | XP_DEPTH_INDEX8,
|
---|
236 | };
|
---|
237 |
|
---|
238 | /* Options that may be passed to the xp_init () function. */
|
---|
239 |
|
---|
240 | enum xp_init_options_enum {
|
---|
241 | /* Don't mark that this process can be in the foreground. */
|
---|
242 | XP_IN_BACKGROUND = 1 << 0,
|
---|
243 |
|
---|
244 | /* Deliver background pointer events to this process. */
|
---|
245 | XP_BACKGROUND_EVENTS = 1 << 1,
|
---|
246 | };
|
---|
247 |
|
---|
248 |
|
---|
249 |
|
---|
250 | /* Miscellaneous functions */
|
---|
251 |
|
---|
252 | /* Initialize the plugin library. Only the copy/fill/composite functions
|
---|
253 | may be called without having previously called xp_init () */
|
---|
254 |
|
---|
255 | extern xp_error xp_init (unsigned int options);
|
---|
256 |
|
---|
257 | /* Sets the current set of requested notifications to MASK. When any of
|
---|
258 | these arrive, CALLBACK will be invoked with CALLBACK-DATA. Note that
|
---|
259 | calling this function cancels any previously requested notifications
|
---|
260 | that aren't set in MASK. */
|
---|
261 |
|
---|
262 | extern xp_error xp_select_events (unsigned int mask,
|
---|
263 | xp_event_fun *callback,
|
---|
264 | void *callback_data);
|
---|
265 |
|
---|
266 | /* Waits for all initiated operations to complete. */
|
---|
267 |
|
---|
268 | extern xp_error xp_synchronize (void);
|
---|
269 |
|
---|
270 | /* Causes any display update initiated through the plugin libary to be
|
---|
271 | queued until update is reenabled. Note that calls to these functions
|
---|
272 | nest. */
|
---|
273 |
|
---|
274 | extern xp_error xp_disable_update (void);
|
---|
275 | extern xp_error xp_reenable_update (void);
|
---|
276 |
|
---|
277 |
|
---|
278 |
|
---|
279 | /* Cursor functions. */
|
---|
280 |
|
---|
281 | /* Installs the specified cursor. ARGB-DATA should point to 32-bit
|
---|
282 | premultiplied big-endian ARGB data. The HOT-X,HOT-Y parameters
|
---|
283 | specify the offset to the cursor's hot spot from its top-left
|
---|
284 | corner. */
|
---|
285 |
|
---|
286 | extern xp_error xp_set_cursor (unsigned int width, unsigned int height,
|
---|
287 | unsigned int hot_x, unsigned int hot_y,
|
---|
288 | const uint32_t *argb_data,
|
---|
289 | unsigned int rowbytes);
|
---|
290 |
|
---|
291 | /* Hide and show the cursor if it's owned by the current process. Calls
|
---|
292 | to these functions nest. */
|
---|
293 |
|
---|
294 | extern xp_error xp_hide_cursor (void);
|
---|
295 | extern xp_error xp_show_cursor (void);
|
---|
296 |
|
---|
297 |
|
---|
298 |
|
---|
299 | /* Window functions. */
|
---|
300 |
|
---|
301 | /* Create a new window as defined by MASK and VALUES. MASK must contain
|
---|
302 | XP_BOUNDS or an error is raised. The id of the newly created window
|
---|
303 | is stored in *RET-ID if this function returns XP_Success. */
|
---|
304 |
|
---|
305 | extern xp_error xp_create_window (unsigned int mask,
|
---|
306 | const xp_window_changes *values,
|
---|
307 | xp_window_id *ret_id);
|
---|
308 |
|
---|
309 | /* Destroys the window identified by ID. */
|
---|
310 |
|
---|
311 | extern xp_error xp_destroy_window (xp_window_id id);
|
---|
312 |
|
---|
313 | /* Reconfigures the given window according to MASK and VALUES. */
|
---|
314 |
|
---|
315 | extern xp_error xp_configure_window (xp_window_id id, unsigned int mask,
|
---|
316 | const xp_window_changes *values);
|
---|
317 |
|
---|
318 |
|
---|
319 | /* Returns true if NATIVE-ID is a window created by the plugin library.
|
---|
320 | If so and RET-ID is non-null, stores the id of the window in *RET-ID. */
|
---|
321 |
|
---|
322 | extern xp_bool xp_lookup_native_window (unsigned int native_id,
|
---|
323 | xp_window_id *ret_id);
|
---|
324 |
|
---|
325 | /* If ID names a window created by the plugin library, stores it's native
|
---|
326 | window id in *RET-NATIVE-ID. */
|
---|
327 |
|
---|
328 | extern xp_error xp_get_native_window (xp_window_id id,
|
---|
329 | unsigned int *ret_native_id);
|
---|
330 |
|
---|
331 |
|
---|
332 | /* Locks the rectangle IN-RECT (or, if null, the entire window) of the
|
---|
333 | given window's backing store. Any other non-null parameters are filled
|
---|
334 | in as follows:
|
---|
335 |
|
---|
336 | DEPTH = format of returned data. Currently either XP_DEPTH_ARGB8888
|
---|
337 | or XP_DEPTH_RGB565 (possibly with 8 bit planar alpha). Data is
|
---|
338 | always stored in native byte order.
|
---|
339 |
|
---|
340 | BITS[0] = pointer to top-left pixel of locked color data
|
---|
341 | BITS[1] = pointer to top-left of locked alpha data, or null if window
|
---|
342 | has no alpha. If the alpha data is meshed, then BITS[1] = BITS[0].
|
---|
343 |
|
---|
344 | ROWBYTES[0,1] = size in bytes of each row of color,alpha data
|
---|
345 |
|
---|
346 | OUT-RECT = rectangle specifying the current position and size of the
|
---|
347 | locked region relative to the window origin.
|
---|
348 |
|
---|
349 | Note that an error is raised when trying to lock an already locked
|
---|
350 | window. While the window is locked, the only operations that may
|
---|
351 | be performed on it are to modify, access or flush its marked region. */
|
---|
352 |
|
---|
353 | extern xp_error xp_lock_window (xp_window_id id,
|
---|
354 | const xp_box *in_rect,
|
---|
355 | unsigned int *depth,
|
---|
356 | void *bits[2],
|
---|
357 | unsigned int rowbytes[2],
|
---|
358 | xp_box *out_rect);
|
---|
359 |
|
---|
360 | /* Mark that the region specified by SHAPE-NRECTS, SHAPE-RECTS,
|
---|
361 | SHAPE-TX, and SHAPE-TY in the specified window has been updated, and
|
---|
362 | will need to subsequently be redisplayed. */
|
---|
363 |
|
---|
364 | extern xp_error xp_mark_window (xp_window_id id, int shape_nrects,
|
---|
365 | const xp_box *shape_rects,
|
---|
366 | int shape_tx, int shape_ty);
|
---|
367 |
|
---|
368 | /* Unlocks the specified window. If FLUSH is true, then any marked
|
---|
369 | regions are immediately redisplayed. Note that it's an error to
|
---|
370 | unlock an already unlocked window. */
|
---|
371 |
|
---|
372 | extern xp_error xp_unlock_window (xp_window_id id, xp_bool flush);
|
---|
373 |
|
---|
374 | /* If anything is marked in the given window for redisplay, do it now. */
|
---|
375 |
|
---|
376 | extern xp_error xp_flush_window (xp_window_id id);
|
---|
377 |
|
---|
378 | /* Moves the contents of the region DX,DY pixels away from that specified
|
---|
379 | by DST_RECTS and DST_NRECTS in the window with SRC-ID to the
|
---|
380 | destination region in the window DST-ID. Note that currently source
|
---|
381 | and destination windows must be the same. */
|
---|
382 |
|
---|
383 | extern xp_error xp_copy_window (xp_window_id src_id, xp_window_id dst_id,
|
---|
384 | int dst_nrects, const xp_box *dst_rects,
|
---|
385 | int dx, int dy);
|
---|
386 |
|
---|
387 | /* Returns true if the given window has any regions marked for
|
---|
388 | redisplay. */
|
---|
389 |
|
---|
390 | extern xp_bool xp_is_window_marked (xp_window_id id);
|
---|
391 |
|
---|
392 | /* If successful returns a superset of the region marked for update in
|
---|
393 | the given window. Use xp_free_region () to release the returned data. */
|
---|
394 |
|
---|
395 | extern xp_error xp_get_marked_shape (xp_window_id id,
|
---|
396 | int *ret_nrects, xp_box **ret_rects);
|
---|
397 |
|
---|
398 | extern void xp_free_shape (int nrects, xp_box *rects);
|
---|
399 |
|
---|
400 | /* Searches for the first window below ABOVE-ID containing the point X,Y,
|
---|
401 | and returns it's window id in *RET-ID. If no window is found, *RET-ID
|
---|
402 | is set to zero. If ABOVE-ID is zero, finds the topmost window
|
---|
403 | containing the given point. */
|
---|
404 |
|
---|
405 | extern xp_error xp_find_window (int x, int y, xp_window_id above_id,
|
---|
406 | xp_window_id *ret_id);
|
---|
407 |
|
---|
408 | /* Returns the current origin and size of the window ID in *BOUNDS-RET if
|
---|
409 | successful. */
|
---|
410 | extern xp_error xp_get_window_bounds (xp_window_id id, xp_box *bounds_ret);
|
---|
411 |
|
---|
412 |
|
---|
413 |
|
---|
414 | /* Window surface functions. */
|
---|
415 |
|
---|
416 | /* Create a new VRAM surface on the specified window. If successful,
|
---|
417 | returns the identifier of the new surface in *RET-SID. */
|
---|
418 |
|
---|
419 | extern xp_error xp_create_surface (xp_window_id id, xp_surface_id *ret_sid);
|
---|
420 |
|
---|
421 | /* Destroys the specified surface. */
|
---|
422 |
|
---|
423 | extern xp_error xp_destroy_surface (xp_surface_id sid);
|
---|
424 |
|
---|
425 | /* Reconfigures the specified surface as defined by MASK and VALUES.
|
---|
426 | Note that specifying XP_DEPTH is an error. */
|
---|
427 |
|
---|
428 | extern xp_error xp_configure_surface (xp_surface_id sid, unsigned int mask,
|
---|
429 | const xp_window_changes *values);
|
---|
430 |
|
---|
431 | /* If successful, places the client identifier of the current process
|
---|
432 | in *RET-CLIENT. */
|
---|
433 |
|
---|
434 | extern xp_error xp_get_client_id (xp_client_id *ret_client);
|
---|
435 |
|
---|
436 | /* Given a valid window,surface combination created by the current
|
---|
437 | process, attempts to allow the specified external client access
|
---|
438 | to that surface. If successful, returns two integers in RET-KEY
|
---|
439 | which the client can use to import the surface into their process. */
|
---|
440 |
|
---|
441 | extern xp_error xp_export_surface (xp_window_id wid, xp_surface_id sid,
|
---|
442 | xp_client_id client,
|
---|
443 | unsigned int ret_key[2]);
|
---|
444 |
|
---|
445 | /* Given a two integer key returned from xp_export_surface (), tries
|
---|
446 | to import the surface into the current process. If successful the
|
---|
447 | local surface identifier is stored in *SID-RET. */
|
---|
448 |
|
---|
449 | extern xp_error xp_import_surface (const unsigned int key[2],
|
---|
450 | xp_surface_id *sid_ret);
|
---|
451 |
|
---|
452 | /* If successful, stores the number of surfaces attached to the
|
---|
453 | specified window in *RET. */
|
---|
454 |
|
---|
455 | extern xp_error xp_get_window_surface_count (xp_window_id id,
|
---|
456 | unsigned int *ret);
|
---|
457 |
|
---|
458 | /* Attaches the CGLContextObj CGL-CTX to the specified surface. */
|
---|
459 |
|
---|
460 | extern xp_error xp_attach_gl_context (void *cgl_ctx, xp_surface_id sid);
|
---|
461 |
|
---|
462 | /* Updates the CGLContextObj CGL-CTX to reflect any recent changes to
|
---|
463 | the surface it's attached to. */
|
---|
464 |
|
---|
465 | extern xp_error xp_update_gl_context (void *cgl_ctx);
|
---|
466 |
|
---|
467 |
|
---|
468 |
|
---|
469 | /* Window frame functions. */
|
---|
470 |
|
---|
471 | /* Possible arguments to xp_frame_get_rect (). */
|
---|
472 |
|
---|
473 | enum xp_frame_rect_enum {
|
---|
474 | XP_FRAME_RECT_TITLEBAR = 1,
|
---|
475 | XP_FRAME_RECT_TRACKING = 2,
|
---|
476 | XP_FRAME_RECT_GROWBOX = 3,
|
---|
477 | };
|
---|
478 |
|
---|
479 | /* Classes of window frame. */
|
---|
480 |
|
---|
481 | enum xp_frame_class_enum {
|
---|
482 | XP_FRAME_CLASS_DOCUMENT = 1 << 0,
|
---|
483 | XP_FRAME_CLASS_DIALOG = 1 << 1,
|
---|
484 | XP_FRAME_CLASS_MODAL_DIALOG = 1 << 2,
|
---|
485 | XP_FRAME_CLASS_SYSTEM_MODAL_DIALOG = 1 << 3,
|
---|
486 | XP_FRAME_CLASS_UTILITY = 1 << 4,
|
---|
487 | XP_FRAME_CLASS_TOOLBAR = 1 << 5,
|
---|
488 | XP_FRAME_CLASS_MENU = 1 << 6,
|
---|
489 | XP_FRAME_CLASS_SPLASH = 1 << 7,
|
---|
490 | XP_FRAME_CLASS_BORDERLESS = 1 << 8,
|
---|
491 | };
|
---|
492 |
|
---|
493 | /* Attributes of window frames. */
|
---|
494 |
|
---|
495 | enum xp_frame_attr_enum {
|
---|
496 | XP_FRAME_ACTIVE = 0x0001,
|
---|
497 | XP_FRAME_URGENT = 0x0002,
|
---|
498 | XP_FRAME_TITLE = 0x0004,
|
---|
499 | XP_FRAME_PRELIGHT = 0x0008,
|
---|
500 | XP_FRAME_SHADED = 0x0010,
|
---|
501 | XP_FRAME_CLOSE_BOX = 0x0100,
|
---|
502 | XP_FRAME_COLLAPSE = 0x0200,
|
---|
503 | XP_FRAME_ZOOM = 0x0400,
|
---|
504 | XP_FRAME_ANY_BUTTON = 0x0700,
|
---|
505 | XP_FRAME_CLOSE_BOX_CLICKED = 0x0800,
|
---|
506 | XP_FRAME_COLLAPSE_BOX_CLICKED = 0x1000,
|
---|
507 | XP_FRAME_ZOOM_BOX_CLICKED = 0x2000,
|
---|
508 | XP_FRAME_ANY_CLICKED = 0x3800,
|
---|
509 | XP_FRAME_GROW_BOX = 0x4000,
|
---|
510 | };
|
---|
511 |
|
---|
512 | #define XP_FRAME_ATTR_IS_SET(a,b) (((a) & (b)) == (b))
|
---|
513 | #define XP_FRAME_ATTR_IS_CLICKED(a,m) ((a) & ((m) << 3))
|
---|
514 | #define XP_FRAME_ATTR_SET_CLICKED(a,m) ((a) |= ((m) << 3))
|
---|
515 | #define XP_FRAME_ATTR_UNSET_CLICKED(a,m) ((a) &= ~((m) << 3))
|
---|
516 |
|
---|
517 | #define XP_FRAME_POINTER_ATTRS (XP_FRAME_PRELIGHT \
|
---|
518 | | XP_FRAME_ANY_BUTTON \
|
---|
519 | | XP_FRAME_ANY_CLICKED)
|
---|
520 |
|
---|
521 | extern xp_error xp_frame_get_rect (int type, int class, const xp_box *outer,
|
---|
522 | const xp_box *inner, xp_box *ret);
|
---|
523 | extern xp_error xp_frame_hit_test (int class, int x, int y,
|
---|
524 | const xp_box *outer,
|
---|
525 | const xp_box *inner, int *ret);
|
---|
526 | extern xp_error xp_frame_draw (xp_window_id wid, int class, unsigned int attr,
|
---|
527 | const xp_box *outer, const xp_box *inner,
|
---|
528 | unsigned int title_len,
|
---|
529 | const unsigned char *title_bytes);
|
---|
530 |
|
---|
531 |
|
---|
532 |
|
---|
533 | /* Memory manipulation functions. */
|
---|
534 |
|
---|
535 | enum xp_composite_op_enum {
|
---|
536 | XP_COMPOSITE_SRC = 0,
|
---|
537 | XP_COMPOSITE_OVER,
|
---|
538 | };
|
---|
539 |
|
---|
540 | #define XP_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \
|
---|
541 | (((op) << 24) | ((src_depth) << 16) \
|
---|
542 | | ((mask_depth) << 8) | ((dest_depth) << 0))
|
---|
543 |
|
---|
544 | #define XP_COMPOSITE_FUNCTION_OP(f) (((f) >> 24) & 255)
|
---|
545 | #define XP_COMPOSITE_FUNCTION_SRC_DEPTH(f) (((f) >> 16) & 255)
|
---|
546 | #define XP_COMPOSITE_FUNCTION_MASK_DEPTH(f) (((f) >> 8) & 255)
|
---|
547 | #define XP_COMPOSITE_FUNCTION_DEST_DEPTH(f) (((f) >> 0) & 255)
|
---|
548 |
|
---|
549 | /* Composite WIDTH by HEIGHT pixels from source and mask to destination
|
---|
550 | using a specified function (if source and destination overlap,
|
---|
551 | undefined behavior results).
|
---|
552 |
|
---|
553 | For SRC and DEST, the first element of the array is the color data. If
|
---|
554 | the second element is non-null it implies that there is alpha data
|
---|
555 | (which may be meshed or planar). Data without alpha is assumed to be
|
---|
556 | opaque.
|
---|
557 |
|
---|
558 | Passing a null SRC-ROWBYTES pointer implies that the data SRC points
|
---|
559 | to is a single element.
|
---|
560 |
|
---|
561 | Operations that are not supported will return XP_BadImplementation. */
|
---|
562 |
|
---|
563 | extern xp_error xp_composite_pixels (unsigned int width, unsigned int height,
|
---|
564 | unsigned int function,
|
---|
565 | void *src[2], unsigned int src_rowbytes[2],
|
---|
566 | void *mask, unsigned int mask_rowbytes,
|
---|
567 | void *dest[2], unsigned int dest_rowbytes[2]);
|
---|
568 |
|
---|
569 | /* Fill HEIGHT rows of data starting at DST. Each row will have WIDTH
|
---|
570 | bytes filled with the 32-bit pattern VALUE. Each row is DST-ROWBYTES
|
---|
571 | wide in total. */
|
---|
572 |
|
---|
573 | extern void xp_fill_bytes (unsigned int width,
|
---|
574 | unsigned int height, uint32_t value,
|
---|
575 | void *dst, unsigned int dst_rowbytes);
|
---|
576 |
|
---|
577 | /* Copy HEIGHT rows of bytes from SRC to DST. Each row will have WIDTH
|
---|
578 | bytes copied. SRC and DST may overlap, and the right thing will happen. */
|
---|
579 |
|
---|
580 | extern void xp_copy_bytes (unsigned int width, unsigned int height,
|
---|
581 | const void *src, unsigned int src_rowbytes,
|
---|
582 | void *dst, unsigned int dst_rowbytes);
|
---|
583 |
|
---|
584 | /* Suggestions for the minimum number of bytes or pixels for which it
|
---|
585 | makes sense to use some of the xp_ functions */
|
---|
586 |
|
---|
587 | extern unsigned int xp_fill_bytes_threshold, xp_copy_bytes_threshold,
|
---|
588 | xp_composite_area_threshold, xp_scroll_area_threshold;
|
---|
589 |
|
---|
590 |
|
---|
591 | #endif /* XPLUGIN_H */
|
---|