b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Xplugin.h -- windowing API for rootless X11 server
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync $Id$
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Permission is hereby granted, free of charge, to any person
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync obtaining a copy of this software and associated documentation files
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (the "Software"), to deal in the Software without restriction,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync including without limitation the rights to use, copy, modify, merge,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync publish, distribute, sublicense, and/or sell copies of the Software,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync and to permit persons to whom the Software is furnished to do so,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync subject to the following conditions:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync The above copyright notice and this permission notice shall be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync included in all copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Except as contained in this notice, the name(s) of the above
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync copyright holders shall not be used in advertising or otherwise to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync promote the sale, use or other dealings in this Software without
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync prior written authorization.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Note that these interfaces are provided solely for the use of the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync X11 server. Any other uses are unsupported and strongly discouraged. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/Xplugin.h,v 1.2 2003/05/02 00:08:49 torrey Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef XPLUGIN_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XPLUGIN_H 1
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <stdint.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* By default we use the X server definition of BoxRec to define xp_box,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync so that the compiler can silently convert between the two. But if
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_NO_X_HEADERS is defined, we'll define it ourselves. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef XP_NO_X_HEADERS
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# include "miscstruct.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync typedef BoxRec xp_box;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#else
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync struct xp_box_struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync short x1, y1, x2, y2;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync };
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync typedef struct xp_box_struct xp_box;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef unsigned int xp_resource_id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef xp_resource_id xp_window_id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef xp_resource_id xp_surface_id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef unsigned int xp_client_id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef unsigned int xp_request_type;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef int xp_error;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef int xp_bool;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Error codes that the functions declared here may return. They all
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync numerically match their X equivalents, i.e. the XP_ can be dropped
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync if <X11/X.h> has been included. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_error_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_Success = 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadRequest = 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadValue = 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadWindow = 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadMatch = 8,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadAccess = 10,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BadImplementation = 17,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Event types generated by the plugin. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_event_type_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* The global display configuration changed somehow. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_DISPLAY_CHANGED = 1 << 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* A window changed state. Argument is xp_window_state_event */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_WINDOW_STATE_CHANGED = 1 << 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* An async request encountered an error. Argument is of type
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_async_error_event */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_ASYNC_ERROR = 1 << 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Sent when a surface is destroyed as a side effect of destroying
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync a window. Arg is of type xp_surface_id. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_SURFACE_DESTROYED = 1 << 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Sent when any GL contexts pointing at the given surface need to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync call xp_update_gl_context () to refresh their state (because the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync window moved or was resized. Arg is of type xp_surface_id. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_SURFACE_CHANGED = 1 << 4,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Sent when a window has been moved. Arg is of type xp_window_id. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_EVENT_WINDOW_MOVED = 1 << 5,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Function type used to receive events. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef void (xp_event_fun) (unsigned int type, const void *arg,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int arg_size, void *user_data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Operation types. Used when reporting errors asynchronously. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_request_type_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_NIL = 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_DESTROY_WINDOW = 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_CONFIGURE_WINDOW = 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_FLUSH_WINDOW = 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_COPY_WINDOW = 4,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_UNLOCK_WINDOW = 5,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_DISABLE_UPDATE = 6,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_REENABLE_UPDATE = 7,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_HIDE_CURSOR = 8,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_SHOW_CURSOR = 9,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_REQUEST_FRAME_DRAW = 10,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Structure used to report an error asynchronously. Passed as the "arg"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync of an XP_EVENT_ASYNC_ERROR event. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct xp_async_error_event_struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_request_type request_type;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_resource_id id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_error error;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct xp_async_error_event_struct xp_async_error_event;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Possible window states. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_window_state_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* The window is not in the global list of possibly-visible windows. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_WINDOW_STATE_OFFSCREEN = 1 << 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Parts of the window may be obscured by other windows. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_WINDOW_STATE_OBSCURED = 1 << 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Structure passed as argument of an XP_EVENT_WINDOW_STATE_CHANGED event. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct xp_window_state_event_struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_window_id id;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int state;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct xp_window_state_event_struct xp_window_state_event;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Function type used to supply a colormap for indexed drawables. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef xp_error (xp_colormap_fun) (void *data, int first_color,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int n_colors, uint32_t *colors);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Window attributes structure. Used when creating and configuring windows.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Also used when configuring surfaces attached to windows. Functions that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync take one of these structures also take a bit mask defining which
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync fields are set to meaningful values. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_window_changes_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_ORIGIN = 1 << 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_SIZE = 1 << 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BOUNDS = XP_ORIGIN | XP_SIZE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_SHAPE = 1 << 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_STACKING = 1 << 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH = 1 << 4,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_COLORMAP = 1 << 5,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_WINDOW_LEVEL = 1 << 6,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct xp_window_changes_struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_ORIGIN */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int x, y;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_SIZE */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int width, height;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int bit_gravity; /* how to resize the backing store */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_SHAPE */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int shape_nrects; /* -1 = remove shape */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_box *shape_rects;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int shape_tx, shape_ty; /* translation for shape */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_STACKING */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int stack_mode;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_window_id sibling; /* may be zero; in ABOVE/BELOW modes
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync it may specify a relative window */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_DEPTH, window-only */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int depth;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_COLORMAP, window-only */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_colormap_fun *colormap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *colormap_data;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* XP_WINDOW_LEVEL, window-only */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int window_level;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct xp_window_changes_struct xp_window_changes;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Values for bit_gravity field */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_bit_gravity_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_GRAVITY_NONE = 0, /* no gravity, fill everything */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Values for stack_mode field */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_window_stack_mode_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_UNMAPPED = 0, /* remove the window */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_MAPPED_ABOVE = 1, /* display the window on top */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_MAPPED_BELOW = 2, /* display the window at bottom */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Data formats for depth field and composite functions */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_depth_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH_NIL = 0, /* null source when compositing */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH_ARGB8888,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH_RGB555,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH_A8, /* for masks when compositing */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_DEPTH_INDEX8,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Options that may be passed to the xp_init () function. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_init_options_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Don't mark that this process can be in the foreground. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_IN_BACKGROUND = 1 << 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Deliver background pointer events to this process. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BACKGROUND_EVENTS = 1 << 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Miscellaneous functions */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Initialize the plugin library. Only the copy/fill/composite functions
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync may be called without having previously called xp_init () */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_init (unsigned int options);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Sets the current set of requested notifications to MASK. When any of
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync these arrive, CALLBACK will be invoked with CALLBACK-DATA. Note that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync calling this function cancels any previously requested notifications
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync that aren't set in MASK. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_select_events (unsigned int mask,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_event_fun *callback,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *callback_data);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Waits for all initiated operations to complete. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_synchronize (void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Causes any display update initiated through the plugin libary to be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync queued until update is reenabled. Note that calls to these functions
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync nest. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_disable_update (void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_reenable_update (void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Cursor functions. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Installs the specified cursor. ARGB-DATA should point to 32-bit
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync premultiplied big-endian ARGB data. The HOT-X,HOT-Y parameters
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync specify the offset to the cursor's hot spot from its top-left
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync corner. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_set_cursor (unsigned int width, unsigned int height,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int hot_x, unsigned int hot_y,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const uint32_t *argb_data,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int rowbytes);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Hide and show the cursor if it's owned by the current process. Calls
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync to these functions nest. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_hide_cursor (void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_show_cursor (void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Window functions. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Create a new window as defined by MASK and VALUES. MASK must contain
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_BOUNDS or an error is raised. The id of the newly created window
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync is stored in *RET-ID if this function returns XP_Success. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_create_window (unsigned int mask,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_window_changes *values,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_window_id *ret_id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Destroys the window identified by ID. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_destroy_window (xp_window_id id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Reconfigures the given window according to MASK and VALUES. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_configure_window (xp_window_id id, unsigned int mask,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_window_changes *values);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Returns true if NATIVE-ID is a window created by the plugin library.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync If so and RET-ID is non-null, stores the id of the window in *RET-ID. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_bool xp_lookup_native_window (unsigned int native_id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_window_id *ret_id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* If ID names a window created by the plugin library, stores it's native
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync window id in *RET-NATIVE-ID. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_get_native_window (xp_window_id id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int *ret_native_id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Locks the rectangle IN-RECT (or, if null, the entire window) of the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync given window's backing store. Any other non-null parameters are filled
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync in as follows:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DEPTH = format of returned data. Currently either XP_DEPTH_ARGB8888
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync or XP_DEPTH_RGB565 (possibly with 8 bit planar alpha). Data is
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync always stored in native byte order.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BITS[0] = pointer to top-left pixel of locked color data
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync BITS[1] = pointer to top-left of locked alpha data, or null if window
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync has no alpha. If the alpha data is meshed, then BITS[1] = BITS[0].
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ROWBYTES[0,1] = size in bytes of each row of color,alpha data
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync OUT-RECT = rectangle specifying the current position and size of the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync locked region relative to the window origin.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Note that an error is raised when trying to lock an already locked
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync window. While the window is locked, the only operations that may
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync be performed on it are to modify, access or flush its marked region. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_lock_window (xp_window_id id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *in_rect,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int *depth,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *bits[2],
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int rowbytes[2],
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_box *out_rect);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Mark that the region specified by SHAPE-NRECTS, SHAPE-RECTS,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SHAPE-TX, and SHAPE-TY in the specified window has been updated, and
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync will need to subsequently be redisplayed. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_mark_window (xp_window_id id, int shape_nrects,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *shape_rects,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int shape_tx, int shape_ty);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Unlocks the specified window. If FLUSH is true, then any marked
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync regions are immediately redisplayed. Note that it's an error to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unlock an already unlocked window. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_unlock_window (xp_window_id id, xp_bool flush);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* If anything is marked in the given window for redisplay, do it now. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_flush_window (xp_window_id id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Moves the contents of the region DX,DY pixels away from that specified
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync by DST_RECTS and DST_NRECTS in the window with SRC-ID to the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync destination region in the window DST-ID. Note that currently source
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync and destination windows must be the same. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_copy_window (xp_window_id src_id, xp_window_id dst_id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int dst_nrects, const xp_box *dst_rects,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int dx, int dy);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Returns true if the given window has any regions marked for
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync redisplay. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_bool xp_is_window_marked (xp_window_id id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* If successful returns a superset of the region marked for update in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync the given window. Use xp_free_region () to release the returned data. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_get_marked_shape (xp_window_id id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int *ret_nrects, xp_box **ret_rects);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void xp_free_shape (int nrects, xp_box *rects);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Searches for the first window below ABOVE-ID containing the point X,Y,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync and returns it's window id in *RET-ID. If no window is found, *RET-ID
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync is set to zero. If ABOVE-ID is zero, finds the topmost window
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync containing the given point. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_find_window (int x, int y, xp_window_id above_id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_window_id *ret_id);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Returns the current origin and size of the window ID in *BOUNDS-RET if
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync successful. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_get_window_bounds (xp_window_id id, xp_box *bounds_ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Window surface functions. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Create a new VRAM surface on the specified window. If successful,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync returns the identifier of the new surface in *RET-SID. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_create_surface (xp_window_id id, xp_surface_id *ret_sid);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Destroys the specified surface. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_destroy_surface (xp_surface_id sid);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Reconfigures the specified surface as defined by MASK and VALUES.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Note that specifying XP_DEPTH is an error. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_configure_surface (xp_surface_id sid, unsigned int mask,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_window_changes *values);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* If successful, places the client identifier of the current process
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync in *RET-CLIENT. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_get_client_id (xp_client_id *ret_client);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Given a valid window,surface combination created by the current
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync process, attempts to allow the specified external client access
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync to that surface. If successful, returns two integers in RET-KEY
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync which the client can use to import the surface into their process. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_export_surface (xp_window_id wid, xp_surface_id sid,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_client_id client,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int ret_key[2]);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Given a two integer key returned from xp_export_surface (), tries
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync to import the surface into the current process. If successful the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync local surface identifier is stored in *SID-RET. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_import_surface (const unsigned int key[2],
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_surface_id *sid_ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* If successful, stores the number of surfaces attached to the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync specified window in *RET. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_get_window_surface_count (xp_window_id id,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int *ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Attaches the CGLContextObj CGL-CTX to the specified surface. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_attach_gl_context (void *cgl_ctx, xp_surface_id sid);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Updates the CGLContextObj CGL-CTX to reflect any recent changes to
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync the surface it's attached to. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_update_gl_context (void *cgl_ctx);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Window frame functions. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Possible arguments to xp_frame_get_rect (). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_frame_rect_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_RECT_TITLEBAR = 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_RECT_TRACKING = 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_RECT_GROWBOX = 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Classes of window frame. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_frame_class_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_DOCUMENT = 1 << 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_DIALOG = 1 << 1,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_MODAL_DIALOG = 1 << 2,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_SYSTEM_MODAL_DIALOG = 1 << 3,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_UTILITY = 1 << 4,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_TOOLBAR = 1 << 5,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_MENU = 1 << 6,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_SPLASH = 1 << 7,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLASS_BORDERLESS = 1 << 8,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Attributes of window frames. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_frame_attr_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_ACTIVE = 0x0001,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_URGENT = 0x0002,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_TITLE = 0x0004,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_PRELIGHT = 0x0008,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_SHADED = 0x0010,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLOSE_BOX = 0x0100,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_COLLAPSE = 0x0200,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_ZOOM = 0x0400,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_ANY_BUTTON = 0x0700,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_CLOSE_BOX_CLICKED = 0x0800,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_COLLAPSE_BOX_CLICKED = 0x1000,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_ZOOM_BOX_CLICKED = 0x2000,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_ANY_CLICKED = 0x3800,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_FRAME_GROW_BOX = 0x4000,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_FRAME_ATTR_IS_SET(a,b) (((a) & (b)) == (b))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_FRAME_ATTR_IS_CLICKED(a,m) ((a) & ((m) << 3))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_FRAME_ATTR_SET_CLICKED(a,m) ((a) |= ((m) << 3))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_FRAME_ATTR_UNSET_CLICKED(a,m) ((a) &= ~((m) << 3))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_FRAME_POINTER_ATTRS (XP_FRAME_PRELIGHT \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync | XP_FRAME_ANY_BUTTON \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync | XP_FRAME_ANY_CLICKED)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_frame_get_rect (int type, int class, const xp_box *outer,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *inner, xp_box *ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_frame_hit_test (int class, int x, int y,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *outer,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *inner, int *ret);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_frame_draw (xp_window_id wid, int class, unsigned int attr,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const xp_box *outer, const xp_box *inner,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int title_len,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const unsigned char *title_bytes);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Memory manipulation functions. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum xp_composite_op_enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_COMPOSITE_SRC = 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XP_COMPOSITE_OVER,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (((op) << 24) | ((src_depth) << 16) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync | ((mask_depth) << 8) | ((dest_depth) << 0))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_COMPOSITE_FUNCTION_OP(f) (((f) >> 24) & 255)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_COMPOSITE_FUNCTION_SRC_DEPTH(f) (((f) >> 16) & 255)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_COMPOSITE_FUNCTION_MASK_DEPTH(f) (((f) >> 8) & 255)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define XP_COMPOSITE_FUNCTION_DEST_DEPTH(f) (((f) >> 0) & 255)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Composite WIDTH by HEIGHT pixels from source and mask to destination
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync using a specified function (if source and destination overlap,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync undefined behavior results).
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync For SRC and DEST, the first element of the array is the color data. If
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync the second element is non-null it implies that there is alpha data
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (which may be meshed or planar). Data without alpha is assumed to be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync opaque.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Passing a null SRC-ROWBYTES pointer implies that the data SRC points
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync to is a single element.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Operations that are not supported will return XP_BadImplementation. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern xp_error xp_composite_pixels (unsigned int width, unsigned int height,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int function,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *src[2], unsigned int src_rowbytes[2],
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *mask, unsigned int mask_rowbytes,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *dest[2], unsigned int dest_rowbytes[2]);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Fill HEIGHT rows of data starting at DST. Each row will have WIDTH
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync bytes filled with the 32-bit pattern VALUE. Each row is DST-ROWBYTES
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync wide in total. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void xp_fill_bytes (unsigned int width,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int height, uint32_t value,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *dst, unsigned int dst_rowbytes);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Copy HEIGHT rows of bytes from SRC to DST. Each row will have WIDTH
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync bytes copied. SRC and DST may overlap, and the right thing will happen. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void xp_copy_bytes (unsigned int width, unsigned int height,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const void *src, unsigned int src_rowbytes,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *dst, unsigned int dst_rowbytes);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Suggestions for the minimum number of bytes or pixels for which it
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync makes sense to use some of the xp_ functions */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern unsigned int xp_fill_bytes_threshold, xp_copy_bytes_threshold,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync xp_composite_area_threshold, xp_scroll_area_threshold;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* XPLUGIN_H */