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