mi.h revision 35c4bbdf
1/***********************************************************
2
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27                        All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46
47#ifndef MI_H
48#define MI_H
49#include <X11/X.h>
50#include "region.h"
51#include "validate.h"
52#include "window.h"
53#include "gc.h"
54#include <X11/fonts/font.h>
55#include "input.h"
56#include "cursor.h"
57#include "privates.h"
58#include "colormap.h"
59#include "events.h"
60
61#define MiBits	CARD32
62
63typedef struct _miDash *miDashPtr;
64
65#define EVEN_DASH	0
66#define ODD_DASH	~0
67
68/* miarc.c */
69
70extern _X_EXPORT void miWideArc(DrawablePtr pDraw,
71                                GCPtr pGC,
72                                int narcs,
73                                xArc * parcs);
74
75extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
76                                GCPtr /*pGC */ ,
77                                int /*narcs */ ,
78                                xArc *  /*parcs */
79    );
80
81/* mibitblt.c */
82
83extern _X_EXPORT RegionPtr miCopyArea(DrawablePtr /*pSrcDrawable */ ,
84                                      DrawablePtr /*pDstDrawable */ ,
85                                      GCPtr /*pGC */ ,
86                                      int /*xIn */ ,
87                                      int /*yIn */ ,
88                                      int /*widthSrc */ ,
89                                      int /*heightSrc */ ,
90                                      int /*xOut */ ,
91                                      int       /*yOut */
92    );
93
94extern _X_EXPORT RegionPtr miCopyPlane(DrawablePtr /*pSrcDrawable */ ,
95                                       DrawablePtr /*pDstDrawable */ ,
96                                       GCPtr /*pGC */ ,
97                                       int /*srcx */ ,
98                                       int /*srcy */ ,
99                                       int /*width */ ,
100                                       int /*height */ ,
101                                       int /*dstx */ ,
102                                       int /*dsty */ ,
103                                       unsigned long    /*bitPlane */
104    );
105
106extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
107                                 int /*sx */ ,
108                                 int /*sy */ ,
109                                 int /*w */ ,
110                                 int /*h */ ,
111                                 unsigned int /*format */ ,
112                                 unsigned long /*planeMask */ ,
113                                 char * /*pdstLine */
114    );
115
116extern _X_EXPORT void miPutImage(DrawablePtr /*pDraw */ ,
117                                 GCPtr /*pGC */ ,
118                                 int /*depth */ ,
119                                 int /*x */ ,
120                                 int /*y */ ,
121                                 int /*w */ ,
122                                 int /*h */ ,
123                                 int /*leftPad */ ,
124                                 int /*format */ ,
125                                 char * /*pImage */
126    );
127
128/* micopy.c  */
129
130#define miGetCompositeClip(pGC) ((pGC)->pCompositeClip)
131
132typedef void (*miCopyProc) (DrawablePtr pSrcDrawable,
133                            DrawablePtr pDstDrawable,
134                            GCPtr pGC,
135                            BoxPtr pDstBox,
136                            int nbox,
137                            int dx,
138                            int dy,
139                            Bool reverse,
140                            Bool upsidedown, Pixel bitplane, void *closure);
141
142extern _X_EXPORT void
143
144miCopyRegion(DrawablePtr pSrcDrawable,
145             DrawablePtr pDstDrawable,
146             GCPtr pGC,
147             RegionPtr pDstRegion,
148             int dx,
149             int dy, miCopyProc copyProc, Pixel bitPlane, void *closure);
150
151extern _X_EXPORT RegionPtr
152
153miDoCopy(DrawablePtr pSrcDrawable,
154         DrawablePtr pDstDrawable,
155         GCPtr pGC,
156         int xIn,
157         int yIn,
158         int widthSrc,
159         int heightSrc,
160         int xOut,
161         int yOut, miCopyProc copyProc, Pixel bitplane, void *closure);
162
163/* micursor.c */
164
165extern _X_EXPORT void miRecolorCursor(DeviceIntPtr /* pDev */ ,
166                                      ScreenPtr /*pScr */ ,
167                                      CursorPtr /*pCurs */ ,
168                                      Bool      /*displayed */
169    );
170
171/* midash.c */
172
173extern _X_EXPORT void miStepDash(int /*dist */ ,
174                                 int * /*pDashIndex */ ,
175                                 unsigned char * /*pDash */ ,
176                                 int /*numInDashList */ ,
177                                 int *  /*pDashOffset */
178    );
179
180/* mieq.c */
181
182#ifndef INPUT_H
183typedef struct _DeviceRec *DevicePtr;
184#endif
185
186extern _X_EXPORT Bool mieqInit(void
187    );
188
189extern _X_EXPORT void mieqFini(void);
190
191extern _X_EXPORT void mieqEnqueue(DeviceIntPtr /*pDev */ ,
192                                  InternalEvent *       /*e */
193    );
194
195extern _X_EXPORT void mieqSwitchScreen(DeviceIntPtr /* pDev */ ,
196                                       ScreenPtr /*pScreen */ ,
197                                       Bool     /*set_dequeue_screen */
198    );
199
200extern _X_EXPORT void mieqProcessDeviceEvent(DeviceIntPtr /* dev */ ,
201                                             InternalEvent * /* event */ ,
202                                             ScreenPtr  /* screen */
203    );
204
205extern _X_EXPORT void mieqProcessInputEvents(void
206    );
207
208extern DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr /* sdev */ ,
209                                       InternalEvent * /* original */ ,
210                                       InternalEvent *  /* copy */
211    );
212
213/**
214 * Custom input event handler. If you need to process input events in some
215 * other way than the default path, register an input event handler for the
216 * given internal event type.
217 */
218typedef void (*mieqHandler) (int screen, InternalEvent *event,
219                             DeviceIntPtr dev);
220void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
221
222/* miexpose.c */
223
224extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
225                                             DrawablePtr /*pDstDrawable */ ,
226                                             GCPtr /*pGC */ ,
227                                             int /*srcx */ ,
228                                             int /*srcy */ ,
229                                             int /*width */ ,
230                                             int /*height */ ,
231                                             int /*dstx */ ,
232                                             int /*dsty */
233    );
234
235extern _X_EXPORT void miSendExposures(WindowPtr /*pWin */ ,
236                                      RegionPtr /*pRgn */ ,
237                                      int /*dx */ ,
238                                      int       /*dy */
239    );
240
241extern _X_EXPORT void miWindowExposures(WindowPtr /*pWin */ ,
242                                        RegionPtr /*prgn */);
243
244extern _X_EXPORT void miPaintWindow(WindowPtr /*pWin */ ,
245                                    RegionPtr /*prgn */ ,
246                                    int /*what */
247    );
248
249extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ ,
250                                      GCPtr     /*pGC */
251    );
252
253/* mifillrct.c */
254
255extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
256                                     GCPtr /*pGC */ ,
257                                     int /*nrectFill */ ,
258                                     xRectangle *       /*prectInit */
259    );
260
261/* miglblt.c */
262
263extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable,
264                                     GCPtr pGC,
265                                     int x,
266                                     int y,
267                                     unsigned int nglyph,
268                                     CharInfoPtr *ppci,
269                                     void *pglyphBase
270    );
271
272extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable,
273                                      GCPtr pGC,
274                                      int x,
275                                      int y,
276                                      unsigned int nglyph,
277                                      CharInfoPtr *ppci,
278                                      void *pglyphBase
279    );
280
281/* mipoly.c */
282
283extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ ,
284                                    GCPtr /*pgc */ ,
285                                    int /*shape */ ,
286                                    int /*mode */ ,
287                                    int /*count */ ,
288                                    DDXPointPtr /*pPts */
289    );
290
291/* mipolypnt.c */
292
293extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
294                                  GCPtr /*pGC */ ,
295                                  int /*mode */ ,
296                                  int /*npt */ ,
297                                  xPoint *      /*pptInit */
298    );
299
300/* mipolyrect.c */
301
302extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ ,
303                                      GCPtr /*pGC */ ,
304                                      int /*nrects */ ,
305                                      xRectangle *      /*pRects */
306    );
307
308/* mipolyseg.c */
309
310extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ ,
311                                    GCPtr /*pGC */ ,
312                                    int /*nseg */ ,
313                                    xSegment *  /*pSegs */
314    );
315
316/* mipolytext.c */
317
318extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ ,
319                                 GCPtr /*pGC */ ,
320                                 int /*x */ ,
321                                 int /*y */ ,
322                                 int /*count */ ,
323                                 char * /*chars */
324    );
325
326extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ ,
327                                  GCPtr /*pGC */ ,
328                                  int /*x */ ,
329                                  int /*y */ ,
330                                  int /*count */ ,
331                                  unsigned short *      /*chars */
332    );
333
334extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ ,
335                                   GCPtr /*pGC */ ,
336                                   int /*x */ ,
337                                   int /*y */ ,
338                                   int /*count */ ,
339                                   char *       /*chars */
340    );
341
342extern _X_EXPORT void miImageText16(DrawablePtr /*pDraw */ ,
343                                    GCPtr /*pGC */ ,
344                                    int /*x */ ,
345                                    int /*y */ ,
346                                    int /*count */ ,
347                                    unsigned short *    /*chars */
348    );
349
350/* mipushpxl.c */
351
352extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
353                                   PixmapPtr /*pBitMap */ ,
354                                   DrawablePtr /*pDrawable */ ,
355                                   int /*dx */ ,
356                                   int /*dy */ ,
357                                   int /*xOrg */ ,
358                                   int  /*yOrg */
359    );
360
361/* miscrinit.c */
362
363extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
364                                           int width,
365                                           int height,
366                                           int depth,
367                                           int bitsPerPixel,
368                                           int devKind,
369                                           void *pPixData
370    );
371
372extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
373    );
374
375extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
376                                             int width,
377                                             void *pbits
378    );
379
380extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
381                                   void *pbits,
382                                   int xsize,
383                                   int ysize,
384                                   int dpix,
385                                   int dpiy,
386                                   int width,
387                                   int rootDepth,
388                                   int numDepths,
389                                   DepthPtr depths,
390                                   VisualID rootVisual,
391                                   int numVisuals,
392                                   VisualPtr visuals
393    );
394
395/* mivaltree.c */
396
397extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ ,
398                                      RegionPtr /*bounding */ ,
399                                      BoxPtr /*rect */ ,
400                                      int /*x */ ,
401                                      int       /*y */
402    );
403
404extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ ,
405                                    WindowPtr /*pChild */ ,
406                                    VTKind      /*kind */
407    );
408
409extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ ,
410                                 GCPtr /*pGC */ ,
411                                 int /*mode */ ,
412                                 int /*npt */ ,
413                                 DDXPointPtr    /*pPts */
414    );
415
416extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
417                                 GCPtr /*pGC */ ,
418                                 int /*mode */ ,
419                                 int /*npt */ ,
420                                 DDXPointPtr    /*pPts */
421    );
422
423extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
424                                  GCPtr pGC,
425                                  int mode,
426                                  int npt,
427                                  DDXPointPtr pPts);
428
429/* miwindow.c */
430
431extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
432                                          int /*x */ ,
433                                          int /*y */ ,
434                                          int /*w */ ,
435                                          int /*h */ ,
436                                          Bool  /*generateExposures */
437    );
438
439extern _X_EXPORT void miMarkWindow(WindowPtr    /*pWin */
440    );
441
442extern _X_EXPORT Bool miMarkOverlappedWindows(WindowPtr /*pWin */ ,
443                                              WindowPtr /*pFirst */ ,
444                                              WindowPtr *       /*ppLayerWin */
445    );
446
447extern _X_EXPORT void miHandleValidateExposures(WindowPtr       /*pWin */
448    );
449
450extern _X_EXPORT void miMoveWindow(WindowPtr /*pWin */ ,
451                                   int /*x */ ,
452                                   int /*y */ ,
453                                   WindowPtr /*pNextSib */ ,
454                                   VTKind       /*kind */
455    );
456
457extern _X_EXPORT void miResizeWindow(WindowPtr /*pWin */ ,
458                                     int /*x */ ,
459                                     int /*y */ ,
460                                     unsigned int /*w */ ,
461                                     unsigned int /*h */ ,
462                                     WindowPtr    /*pSib */
463    );
464
465extern _X_EXPORT WindowPtr miGetLayerWindow(WindowPtr   /*pWin */
466    );
467
468extern _X_EXPORT void miSetShape(WindowPtr /*pWin */ ,
469                                 int    /*kind */
470    );
471
472extern _X_EXPORT void miChangeBorderWidth(WindowPtr /*pWin */ ,
473                                          unsigned int  /*width */
474    );
475
476extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
477                                             WindowPtr /*pWin */ ,
478                                             Bool       /*fromConfigure */
479    );
480
481extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
482
483extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
484
485/* mizerarc.c */
486
487extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
488                                    GCPtr /*pGC */ ,
489                                    int /*narcs */ ,
490                                    xArc *      /*parcs */
491    );
492
493/* mizerline.c */
494
495extern _X_EXPORT void miZeroLine(DrawablePtr /*dst */ ,
496                                 GCPtr /*pgc */ ,
497                                 int /*mode */ ,
498                                 int /*nptInit */ ,
499                                 DDXPointRec *  /*pptInit */
500    );
501
502extern _X_EXPORT void miZeroDashLine(DrawablePtr /*dst */ ,
503                                     GCPtr /*pgc */ ,
504                                     int /*mode */ ,
505                                     int /*nptInit */ ,
506                                     DDXPointRec *      /*pptInit */
507    );
508
509extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ ,
510                                    GCPtr /*pGC */ ,
511                                    int /*narcs */ ,
512                                    xArc *      /*parcs */
513    );
514
515#endif                          /* MI_H */
516