1 /***********************************************************
2 
3 Copyright 1987, 1998  The Open Group
4 
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
24 
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26 
27                         All Rights Reserved
28 
29 Permission to use, copy, modify, and distribute this software and its
30 documentation for any purpose and without fee is hereby granted,
31 provided that the above copyright notice appear in all copies and that
32 both that copyright notice and this permission notice appear in
33 supporting documentation, and that the name of Digital not be
34 used in advertising or publicity pertaining to distribution of the
35 software without specific, written prior permission.
36 
37 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43 SOFTWARE.
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 
63 typedef struct _miDash *miDashPtr;
64 
65 #define EVEN_DASH	0
66 #define ODD_DASH	~0
67 
68 /* miarc.c */
69 
70 extern _X_EXPORT void miWideArc(DrawablePtr pDraw,
71                                 GCPtr pGC,
72                                 int narcs,
73                                 xArc * parcs);
74 
75 extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
76                                 GCPtr /*pGC */ ,
77                                 int /*narcs */ ,
78                                 xArc *  /*parcs */
79     );
80 
81 /* mibitblt.c */
82 
83 extern _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 
94 extern _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 
106 extern _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 
116 extern _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 
132 typedef 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 
142 extern _X_EXPORT void
143 
144 miCopyRegion(DrawablePtr pSrcDrawable,
145              DrawablePtr pDstDrawable,
146              GCPtr pGC,
147              RegionPtr pDstRegion,
148              int dx,
149              int dy, miCopyProc copyProc, Pixel bitPlane, void *closure);
150 
151 extern _X_EXPORT RegionPtr
152 
153 miDoCopy(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 
165 extern _X_EXPORT void miRecolorCursor(DeviceIntPtr /* pDev */ ,
166                                       ScreenPtr /*pScr */ ,
167                                       CursorPtr /*pCurs */ ,
168                                       Bool      /*displayed */
169     );
170 
171 /* midash.c */
172 
173 extern _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
183 typedef struct _DeviceRec *DevicePtr;
184 #endif
185 
186 extern _X_EXPORT Bool mieqInit(void
187     );
188 
189 extern _X_EXPORT void mieqFini(void);
190 
191 extern _X_EXPORT void mieqEnqueue(DeviceIntPtr /*pDev */ ,
192                                   InternalEvent *       /*e */
193     );
194 
195 extern _X_EXPORT void mieqSwitchScreen(DeviceIntPtr /* pDev */ ,
196                                        ScreenPtr /*pScreen */ ,
197                                        Bool     /*set_dequeue_screen */
198     );
199 
200 extern _X_EXPORT void mieqProcessDeviceEvent(DeviceIntPtr /* dev */ ,
201                                              InternalEvent * /* event */ ,
202                                              ScreenPtr  /* screen */
203     );
204 
205 extern _X_EXPORT void mieqProcessInputEvents(void
206     );
207 
208 extern 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  */
218 typedef void (*mieqHandler) (int screen, InternalEvent *event,
219                              DeviceIntPtr dev);
220 void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
221 
222 /* miexpose.c */
223 
224 extern _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 
235 extern _X_EXPORT void miSendExposures(WindowPtr /*pWin */ ,
236                                       RegionPtr /*pRgn */ ,
237                                       int /*dx */ ,
238                                       int       /*dy */
239     );
240 
241 extern _X_EXPORT void miWindowExposures(WindowPtr /*pWin */ ,
242                                         RegionPtr /*prgn */);
243 
244 extern _X_EXPORT void miPaintWindow(WindowPtr /*pWin */ ,
245                                     RegionPtr /*prgn */ ,
246                                     int /*what */
247     );
248 
249 extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ ,
250                                       GCPtr     /*pGC */
251     );
252 
253 /* mifillrct.c */
254 
255 extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
256                                      GCPtr /*pGC */ ,
257                                      int /*nrectFill */ ,
258                                      xRectangle *       /*prectInit */
259     );
260 
261 /* miglblt.c */
262 
263 extern _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 
272 extern _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 
283 extern _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 
293 extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
294                                   GCPtr /*pGC */ ,
295                                   int /*mode */ ,
296                                   int /*npt */ ,
297                                   xPoint *      /*pptInit */
298     );
299 
300 /* mipolyrect.c */
301 
302 extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ ,
303                                       GCPtr /*pGC */ ,
304                                       int /*nrects */ ,
305                                       xRectangle *      /*pRects */
306     );
307 
308 /* mipolyseg.c */
309 
310 extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ ,
311                                     GCPtr /*pGC */ ,
312                                     int /*nseg */ ,
313                                     xSegment *  /*pSegs */
314     );
315 
316 /* mipolytext.c */
317 
318 extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ ,
319                                  GCPtr /*pGC */ ,
320                                  int /*x */ ,
321                                  int /*y */ ,
322                                  int /*count */ ,
323                                  char * /*chars */
324     );
325 
326 extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ ,
327                                   GCPtr /*pGC */ ,
328                                   int /*x */ ,
329                                   int /*y */ ,
330                                   int /*count */ ,
331                                   unsigned short *      /*chars */
332     );
333 
334 extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ ,
335                                    GCPtr /*pGC */ ,
336                                    int /*x */ ,
337                                    int /*y */ ,
338                                    int /*count */ ,
339                                    char *       /*chars */
340     );
341 
342 extern _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 
352 extern _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 
363 extern _X_EXPORT void
364 miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
365                  unsigned int subWindowMode);
366 
367 extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
368                                            int width,
369                                            int height,
370                                            int depth,
371                                            int bitsPerPixel,
372                                            int devKind,
373                                            void *pPixData
374     );
375 
376 extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
377     );
378 
379 extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
380                                              int width,
381                                              void *pbits
382     );
383 
384 extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
385                                    void *pbits,
386                                    int xsize,
387                                    int ysize,
388                                    int dpix,
389                                    int dpiy,
390                                    int width,
391                                    int rootDepth,
392                                    int numDepths,
393                                    DepthPtr depths,
394                                    VisualID rootVisual,
395                                    int numVisuals,
396                                    VisualPtr visuals
397     );
398 
399 /* mivaltree.c */
400 
401 extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ ,
402                                       RegionPtr /*bounding */ ,
403                                       BoxPtr /*rect */ ,
404                                       int /*x */ ,
405                                       int       /*y */
406     );
407 
408 extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ ,
409                                     WindowPtr /*pChild */ ,
410                                     VTKind      /*kind */
411     );
412 
413 extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ ,
414                                  GCPtr /*pGC */ ,
415                                  int /*mode */ ,
416                                  int /*npt */ ,
417                                  DDXPointPtr    /*pPts */
418     );
419 
420 extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
421                                  GCPtr /*pGC */ ,
422                                  int /*mode */ ,
423                                  int /*npt */ ,
424                                  DDXPointPtr    /*pPts */
425     );
426 
427 extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
428                                   GCPtr pGC,
429                                   int mode,
430                                   int npt,
431                                   DDXPointPtr pPts);
432 
433 /* miwindow.c */
434 
435 extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
436                                           int /*x */ ,
437                                           int /*y */ ,
438                                           int /*w */ ,
439                                           int /*h */ ,
440                                           Bool  /*generateExposures */
441     );
442 
443 extern _X_EXPORT void miMarkWindow(WindowPtr    /*pWin */
444     );
445 
446 extern _X_EXPORT Bool miMarkOverlappedWindows(WindowPtr /*pWin */ ,
447                                               WindowPtr /*pFirst */ ,
448                                               WindowPtr *       /*ppLayerWin */
449     );
450 
451 extern _X_EXPORT void miHandleValidateExposures(WindowPtr       /*pWin */
452     );
453 
454 extern _X_EXPORT void miMoveWindow(WindowPtr /*pWin */ ,
455                                    int /*x */ ,
456                                    int /*y */ ,
457                                    WindowPtr /*pNextSib */ ,
458                                    VTKind       /*kind */
459     );
460 
461 extern _X_EXPORT void miResizeWindow(WindowPtr /*pWin */ ,
462                                      int /*x */ ,
463                                      int /*y */ ,
464                                      unsigned int /*w */ ,
465                                      unsigned int /*h */ ,
466                                      WindowPtr    /*pSib */
467     );
468 
469 extern _X_EXPORT WindowPtr miGetLayerWindow(WindowPtr   /*pWin */
470     );
471 
472 extern _X_EXPORT void miSetShape(WindowPtr /*pWin */ ,
473                                  int    /*kind */
474     );
475 
476 extern _X_EXPORT void miChangeBorderWidth(WindowPtr /*pWin */ ,
477                                           unsigned int  /*width */
478     );
479 
480 extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
481                                              WindowPtr /*pWin */ ,
482                                              Bool       /*fromConfigure */
483     );
484 
485 extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
486 
487 extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
488 
489 /* mizerarc.c */
490 
491 extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
492                                     GCPtr /*pGC */ ,
493                                     int /*narcs */ ,
494                                     xArc *      /*parcs */
495     );
496 
497 /* mizerline.c */
498 
499 extern _X_EXPORT void miZeroLine(DrawablePtr /*dst */ ,
500                                  GCPtr /*pgc */ ,
501                                  int /*mode */ ,
502                                  int /*nptInit */ ,
503                                  DDXPointRec *  /*pptInit */
504     );
505 
506 extern _X_EXPORT void miZeroDashLine(DrawablePtr /*dst */ ,
507                                      GCPtr /*pgc */ ,
508                                      int /*mode */ ,
509                                      int /*nptInit */ ,
510                                      DDXPointRec *      /*pptInit */
511     );
512 
513 extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ ,
514                                     GCPtr /*pGC */ ,
515                                     int /*narcs */ ,
516                                     xArc *      /*parcs */
517     );
518 
519 #endif                          /* MI_H */
520