Home | History | Annotate | Download | only in extensions
      1 /*
      2  * $Xorg: multibuf.h,v 1.4 2001/02/09 02:03:24 xorgcvs Exp $
      3  *
      4 Copyright 1989, 1998  The Open Group
      5 
      6 Permission to use, copy, modify, distribute, and sell this software and its
      7 documentation for any purpose is hereby granted without fee, provided that
      8 the above copyright notice appear in all copies and that both that
      9 copyright notice and this permission notice appear in supporting
     10 documentation.
     11 
     12 The above copyright notice and this permission notice shall be included in
     13 all copies or substantial portions of the Software.
     14 
     15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 Except as contained in this notice, the name of The Open Group shall not be
     23 used in advertising or otherwise to promote the sale, use or other dealings
     24 in this Software without prior written authorization from The Open Group.
     25  */
     26 
     27 /* $XFree86: xc/include/extensions/multibuf.h,v 3.4 2001/12/14 19:53:28 dawes Exp $ */
     28 
     29 #ifndef _MULTIBUF_H_
     30 #define _MULTIBUF_H_
     31 
     32 #include <X11/Xfuncproto.h>
     33 
     34 #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
     35 
     36 #define MULTIBUFFER_MAJOR_VERSION	1	/* current version numbers */
     37 #define MULTIBUFFER_MINOR_VERSION	1	/* has ClearImageBufferArea */
     38 
     39 #define X_MbufGetBufferVersion		0
     40 #define X_MbufCreateImageBuffers	1
     41 #define X_MbufDestroyImageBuffers	2
     42 #define X_MbufDisplayImageBuffers	3
     43 #define X_MbufSetMBufferAttributes	4
     44 #define X_MbufGetMBufferAttributes	5
     45 #define X_MbufSetBufferAttributes	6
     46 #define X_MbufGetBufferAttributes	7
     47 #define X_MbufGetBufferInfo		8
     48 #define X_MbufCreateStereoWindow	9
     49 #define X_MbufClearImageBufferArea	10
     50 
     51 /*
     52  * update_action field
     53  */
     54 #define MultibufferUpdateActionUndefined	0
     55 #define MultibufferUpdateActionBackground	1
     56 #define MultibufferUpdateActionUntouched	2
     57 #define MultibufferUpdateActionCopied		3
     58 
     59 /*
     60  * update_hint field
     61  */
     62 #define MultibufferUpdateHintFrequent		0
     63 #define MultibufferUpdateHintIntermittent	1
     64 #define MultibufferUpdateHintStatic		2
     65 
     66 /*
     67  * valuemask fields
     68  */
     69 #define MultibufferWindowUpdateHint	(1L << 0)
     70 #define MultibufferBufferEventMask	(1L << 0)
     71 
     72 /*
     73  * mono vs. stereo and left vs. right
     74  */
     75 #define MultibufferModeMono		0
     76 #define MultibufferModeStereo		1
     77 #define MultibufferSideMono		0
     78 #define MultibufferSideLeft	  	1
     79 #define MultibufferSideRight		2
     80 
     81 /*
     82  * clobber state
     83  */
     84 #define MultibufferUnclobbered		0
     85 #define MultibufferPartiallyClobbered	1
     86 #define MultibufferFullyClobbered	2
     87 
     88 /*
     89  * event stuff
     90  */
     91 #define MultibufferClobberNotifyMask	0x02000000
     92 #define MultibufferUpdateNotifyMask	0x04000000
     93 
     94 #define MultibufferClobberNotify	0
     95 #define MultibufferUpdateNotify		1
     96 #define MultibufferNumberEvents		(MultibufferUpdateNotify + 1)
     97 
     98 #define MultibufferBadBuffer		0
     99 #define MultibufferNumberErrors		(MultibufferBadBuffer + 1)
    100 
    101 
    102 #ifndef _MULTIBUF_SERVER_
    103 /*
    104  * Extra definitions that will only be needed in the client
    105  */
    106 typedef XID Multibuffer;
    107 
    108 typedef struct {
    109     int	type;		    /* of event */
    110     unsigned long serial;   /* # of last request processed by server */
    111     int send_event;	    /* true if this came frome a SendEvent request */
    112     Display *display;	    /* Display the event was read from */
    113     Multibuffer buffer;	    /* buffer of event */
    114     int	state;		    /* see Clobbered constants above */
    115 } XmbufClobberNotifyEvent;
    116 
    117 typedef struct {
    118     int	type;		    /* of event */
    119     unsigned long serial;   /* # of last request processed by server */
    120     int send_event;	    /* true if this came frome a SendEvent request */
    121     Display *display;	    /* Display the event was read from */
    122     Multibuffer buffer;	    /* buffer of event */
    123 } XmbufUpdateNotifyEvent;
    124 
    125 
    126 /*
    127  * per-window attributes that can be got
    128  */
    129 typedef struct {
    130     int displayed_index;	/* which buffer is being displayed */
    131     int update_action;		/* Undefined, Background, Untouched, Copied */
    132     int update_hint;		/* Frequent, Intermittent, Static */
    133     int window_mode;		/* Mono, Stereo */
    134     int nbuffers;		/* Number of buffers */
    135     Multibuffer *buffers;	/* Buffers */
    136 } XmbufWindowAttributes;
    137 
    138 /*
    139  * per-window attributes that can be set
    140  */
    141 typedef struct {
    142     int update_hint;		/* Frequent, Intermittent, Static */
    143 } XmbufSetWindowAttributes;
    144 
    145 
    146 /*
    147  * per-buffer attributes that can be got
    148  */
    149 typedef struct {
    150     Window window;		/* which window this belongs to */
    151     unsigned long event_mask;	/* events that have been selected */
    152     int buffer_index;		/* which buffer is this */
    153     int side;			/* Mono, Left, Right */
    154 } XmbufBufferAttributes;
    155 
    156 /*
    157  * per-buffer attributes that can be set
    158  */
    159 typedef struct {
    160     unsigned long event_mask;	/* events that have been selected */
    161 } XmbufSetBufferAttributes;
    162 
    163 
    164 /*
    165  * per-screen buffer info (there will be lists of them)
    166  */
    167 typedef struct {
    168     VisualID visualid;		/* visual usuable at this depth */
    169     int max_buffers;		/* most buffers for this visual */
    170     int depth;			/* depth of buffers to be created */
    171 } XmbufBufferInfo;
    172 
    173 _XFUNCPROTOBEGIN
    174 
    175 extern Bool XmbufQueryExtension(
    176     Display*		/* dpy */,
    177     int*		/* event_base_return */,
    178     int*		/* error_base_return */
    179 );
    180 
    181 extern Status XmbufGetVersion(
    182     Display*		/* dpy */,
    183     int*		/* major_version_return */,
    184     int*		/* minor_version_return */
    185 );
    186 
    187 extern int XmbufCreateBuffers(
    188     Display*		/* dpy */,
    189     Window		/* w */,
    190     int			/* count */,
    191     int			/* update_action */,
    192     int			/* update_hint */,
    193     Multibuffer*	/* buffers */
    194 );
    195 
    196 extern void XmbufDestroyBuffers(
    197     Display*		/* dpy */,
    198     Window		/* window */
    199 );
    200 
    201 extern void XmbufDisplayBuffers(
    202     Display*		/* dpy */,
    203     int			/* count */,
    204     Multibuffer*	/* buffers */,
    205     int			/* min_delay */,
    206     int			/* max_delay */
    207 );
    208 
    209 extern Status XmbufGetWindowAttributes(
    210     Display*			/* dpy */,
    211     Window			/* w */,
    212     XmbufWindowAttributes*	/* attr */
    213 );
    214 
    215 extern void XmbufChangeWindowAttributes(
    216     Display*			/* dpy */,
    217     Window			/* w */,
    218     unsigned long		/* valuemask */,
    219     XmbufSetWindowAttributes*	/* attr */
    220 );
    221 
    222 extern Status XmbufGetBufferAttributes(
    223     Display*			/* dpy */,
    224     Multibuffer			/* b */,
    225     XmbufBufferAttributes*	/* attr */
    226 );
    227 
    228 extern void XmbufChangeBufferAttributes(
    229     Display*			/* dpy */,
    230     Multibuffer			/* b */,
    231     unsigned long		/* valuemask */,
    232     XmbufSetBufferAttributes*	/* attr */
    233 );
    234 
    235 extern Status XmbufGetScreenInfo(
    236     Display*			/* dpy */,
    237     Drawable			/* d */,
    238     int*			/* nmono_return */,
    239     XmbufBufferInfo**		/* mono_info_return */,
    240     int*			/* nstereo_return */,
    241     XmbufBufferInfo**		/* stereo_info_return */
    242 );
    243 
    244 extern Window XmbufCreateStereoWindow(
    245     Display*			/* dpy */,
    246     Window			/* parent */,
    247     int				/* x */,
    248     int				/* y */,
    249     unsigned int		/* width */,
    250     unsigned int		/* height */,
    251     unsigned int		/* border_width */,
    252     int				/* depth */,
    253     unsigned int		/* class */,
    254     Visual*			/* visual */,
    255     unsigned long		/* valuemask */,
    256     XSetWindowAttributes*	/* attr */,
    257     Multibuffer*		/* leftp */,
    258     Multibuffer*		/* rightp */
    259 );
    260 
    261 extern void XmbufClearBufferArea(
    262     Display*			/* dpy */,
    263     Multibuffer			/* buffer */,
    264     int				/* x */,
    265     int				/* y */,
    266     unsigned int		/* width */,
    267     unsigned int		/* height */,
    268     Bool			/* exposures */
    269 );
    270 
    271 _XFUNCPROTOEND
    272 
    273 #else
    274 
    275 #include "scrnintstr.h"
    276 
    277 typedef Bool	(* mbInitFunc)();
    278 
    279 struct _mbufScreen;		/* declared in multibufst.h */
    280 
    281 extern void	RegisterMultibufferInit(
    282     ScreenPtr			/* pScreen */,
    283     Bool (* /* bufMultibufferInit */)(
    284 	ScreenPtr		/* pScreen */,
    285 	struct _mbufScreen *	/* pMBScreen */
    286     )
    287 );
    288 
    289 struct xMbufBufferInfo;		/* declared in multibufst.h */
    290 
    291 extern void	RegisterDoubleBufferHardware(
    292     ScreenPtr			/* pScreen */,
    293     int				/* nInfo */,
    294     struct xMbufBufferInfo *	/* pInfo */,
    295     DevUnion *			/* frameBuffer */,
    296     DevUnion			/* selectPlane */,
    297     void (* /* CopyBufferBitsFunc */ )(),
    298     void (* /* DrawSelectPlaneFunc */ )()
    299 );
    300 
    301 extern int	CreateImageBuffers (
    302     WindowPtr			/* pWin */,
    303     int				/* nbuf */,
    304     XID *			/* ids */,
    305     int				/* action */,
    306     int				/* hint */
    307 );
    308 extern void	DestroyImageBuffers (
    309     WindowPtr			/* pWin */
    310 );
    311 extern int	DisplayImageBuffers (
    312     XID *			/* ids */,
    313     int				/* nbuf */
    314 );
    315 
    316 #endif /* _MULTIBUF_SERVER_ */
    317 #endif /* _MULTIBUF_H_ */
    318