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 _X_EXPORT void mieqAddCallbackOnDrained(CallbackProcPtr callback,
209                                                void *param);
210 
211 extern _X_EXPORT void mieqRemoveCallbackOnDrained(CallbackProcPtr callback,
212                                                   void *param);
213 
214 extern DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr /* sdev */ ,
215                                        InternalEvent * /* original */ ,
216                                        InternalEvent *  /* copy */
217     );
218 
219 /**
220  * Custom input event handler. If you need to process input events in some
221  * other way than the default path, register an input event handler for the
222  * given internal event type.
223  */
224 typedef void (*mieqHandler) (int screen, InternalEvent *event,
225                              DeviceIntPtr dev);
226 void _X_EXPORT mieqSetHandler(int event, mieqHandler handler);
227 
228 /* miexpose.c */
229 
230 extern _X_EXPORT RegionPtr miHandleExposures(DrawablePtr /*pSrcDrawable */ ,
231                                              DrawablePtr /*pDstDrawable */ ,
232                                              GCPtr /*pGC */ ,
233                                              int /*srcx */ ,
234                                              int /*srcy */ ,
235                                              int /*width */ ,
236                                              int /*height */ ,
237                                              int /*dstx */ ,
238                                              int /*dsty */
239     );
240 
241 extern _X_EXPORT void miSendExposures(WindowPtr /*pWin */ ,
242                                       RegionPtr /*pRgn */ ,
243                                       int /*dx */ ,
244                                       int       /*dy */
245     );
246 
247 extern _X_EXPORT void miWindowExposures(WindowPtr /*pWin */ ,
248                                         RegionPtr /*prgn */);
249 
250 extern _X_EXPORT void miPaintWindow(WindowPtr /*pWin */ ,
251                                     RegionPtr /*prgn */ ,
252                                     int /*what */
253     );
254 
255 extern _X_EXPORT void miClearDrawable(DrawablePtr /*pDraw */ ,
256                                       GCPtr     /*pGC */
257     );
258 
259 /* mifillrct.c */
260 
261 extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
262                                      GCPtr /*pGC */ ,
263                                      int /*nrectFill */ ,
264                                      xRectangle *       /*prectInit */
265     );
266 
267 /* miglblt.c */
268 
269 extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable,
270                                      GCPtr pGC,
271                                      int x,
272                                      int y,
273                                      unsigned int nglyph,
274                                      CharInfoPtr *ppci,
275                                      void *pglyphBase
276     );
277 
278 extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable,
279                                       GCPtr pGC,
280                                       int x,
281                                       int y,
282                                       unsigned int nglyph,
283                                       CharInfoPtr *ppci,
284                                       void *pglyphBase
285     );
286 
287 /* mipoly.c */
288 
289 extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ ,
290                                     GCPtr /*pgc */ ,
291                                     int /*shape */ ,
292                                     int /*mode */ ,
293                                     int /*count */ ,
294                                     DDXPointPtr /*pPts */
295     );
296 
297 /* mipolypnt.c */
298 
299 extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
300                                   GCPtr /*pGC */ ,
301                                   int /*mode */ ,
302                                   int /*npt */ ,
303                                   xPoint *      /*pptInit */
304     );
305 
306 /* mipolyrect.c */
307 
308 extern _X_EXPORT void miPolyRectangle(DrawablePtr /*pDraw */ ,
309                                       GCPtr /*pGC */ ,
310                                       int /*nrects */ ,
311                                       xRectangle *      /*pRects */
312     );
313 
314 /* mipolyseg.c */
315 
316 extern _X_EXPORT void miPolySegment(DrawablePtr /*pDraw */ ,
317                                     GCPtr /*pGC */ ,
318                                     int /*nseg */ ,
319                                     xSegment *  /*pSegs */
320     );
321 
322 /* mipolytext.c */
323 
324 extern _X_EXPORT int miPolyText8(DrawablePtr /*pDraw */ ,
325                                  GCPtr /*pGC */ ,
326                                  int /*x */ ,
327                                  int /*y */ ,
328                                  int /*count */ ,
329                                  char * /*chars */
330     );
331 
332 extern _X_EXPORT int miPolyText16(DrawablePtr /*pDraw */ ,
333                                   GCPtr /*pGC */ ,
334                                   int /*x */ ,
335                                   int /*y */ ,
336                                   int /*count */ ,
337                                   unsigned short *      /*chars */
338     );
339 
340 extern _X_EXPORT void miImageText8(DrawablePtr /*pDraw */ ,
341                                    GCPtr /*pGC */ ,
342                                    int /*x */ ,
343                                    int /*y */ ,
344                                    int /*count */ ,
345                                    char *       /*chars */
346     );
347 
348 extern _X_EXPORT void miImageText16(DrawablePtr /*pDraw */ ,
349                                     GCPtr /*pGC */ ,
350                                     int /*x */ ,
351                                     int /*y */ ,
352                                     int /*count */ ,
353                                     unsigned short *    /*chars */
354     );
355 
356 /* mipushpxl.c */
357 
358 extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
359                                    PixmapPtr /*pBitMap */ ,
360                                    DrawablePtr /*pDrawable */ ,
361                                    int /*dx */ ,
362                                    int /*dy */ ,
363                                    int /*xOrg */ ,
364                                    int  /*yOrg */
365     );
366 
367 /* miscrinit.c */
368 
369 extern _X_EXPORT void
370 miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
371                  unsigned int subWindowMode);
372 
373 extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
374                                            int width,
375                                            int height,
376                                            int depth,
377                                            int bitsPerPixel,
378                                            int devKind,
379                                            void *pPixData
380     );
381 
382 extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
383     );
384 
385 extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
386                                              int width,
387                                              void *pbits
388     );
389 
390 extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
391                                    void *pbits,
392                                    int xsize,
393                                    int ysize,
394                                    int dpix,
395                                    int dpiy,
396                                    int width,
397                                    int rootDepth,
398                                    int numDepths,
399                                    DepthPtr depths,
400                                    VisualID rootVisual,
401                                    int numVisuals,
402                                    VisualPtr visuals
403     );
404 
405 /* mivaltree.c */
406 
407 extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ ,
408                                       RegionPtr /*bounding */ ,
409                                       BoxPtr /*rect */ ,
410                                       int /*x */ ,
411                                       int       /*y */
412     );
413 
414 extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ ,
415                                     WindowPtr /*pChild */ ,
416                                     VTKind      /*kind */
417     );
418 
419 extern _X_EXPORT void miWideLine(DrawablePtr /*pDrawable */ ,
420                                  GCPtr /*pGC */ ,
421                                  int /*mode */ ,
422                                  int /*npt */ ,
423                                  DDXPointPtr    /*pPts */
424     );
425 
426 extern _X_EXPORT void miWideDash(DrawablePtr /*pDrawable */ ,
427                                  GCPtr /*pGC */ ,
428                                  int /*mode */ ,
429                                  int /*npt */ ,
430                                  DDXPointPtr    /*pPts */
431     );
432 
433 extern _X_EXPORT void miPolylines(DrawablePtr pDrawable,
434                                   GCPtr pGC,
435                                   int mode,
436                                   int npt,
437                                   DDXPointPtr pPts);
438 
439 /* miwindow.c */
440 
441 extern _X_EXPORT void miClearToBackground(WindowPtr /*pWin */ ,
442                                           int /*x */ ,
443                                           int /*y */ ,
444                                           int /*w */ ,
445                                           int /*h */ ,
446                                           Bool  /*generateExposures */
447     );
448 
449 extern _X_EXPORT void miMarkWindow(WindowPtr    /*pWin */
450     );
451 
452 extern _X_EXPORT Bool miMarkOverlappedWindows(WindowPtr /*pWin */ ,
453                                               WindowPtr /*pFirst */ ,
454                                               WindowPtr *       /*ppLayerWin */
455     );
456 
457 extern _X_EXPORT void miHandleValidateExposures(WindowPtr       /*pWin */
458     );
459 
460 extern _X_EXPORT void miMoveWindow(WindowPtr /*pWin */ ,
461                                    int /*x */ ,
462                                    int /*y */ ,
463                                    WindowPtr /*pNextSib */ ,
464                                    VTKind       /*kind */
465     );
466 
467 extern _X_EXPORT void miResizeWindow(WindowPtr /*pWin */ ,
468                                      int /*x */ ,
469                                      int /*y */ ,
470                                      unsigned int /*w */ ,
471                                      unsigned int /*h */ ,
472                                      WindowPtr    /*pSib */
473     );
474 
475 extern _X_EXPORT WindowPtr miGetLayerWindow(WindowPtr   /*pWin */
476     );
477 
478 extern _X_EXPORT void miSetShape(WindowPtr /*pWin */ ,
479                                  int    /*kind */
480     );
481 
482 extern _X_EXPORT void miChangeBorderWidth(WindowPtr /*pWin */ ,
483                                           unsigned int  /*width */
484     );
485 
486 extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
487                                              WindowPtr /*pWin */ ,
488                                              Bool       /*fromConfigure */
489     );
490 
491 extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
492 
493 extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
494 
495 /* mizerarc.c */
496 
497 extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
498                                     GCPtr /*pGC */ ,
499                                     int /*narcs */ ,
500                                     xArc *      /*parcs */
501     );
502 
503 /* mizerline.c */
504 
505 extern _X_EXPORT void miZeroLine(DrawablePtr /*dst */ ,
506                                  GCPtr /*pgc */ ,
507                                  int /*mode */ ,
508                                  int /*nptInit */ ,
509                                  DDXPointRec *  /*pptInit */
510     );
511 
512 extern _X_EXPORT void miZeroDashLine(DrawablePtr /*dst */ ,
513                                      GCPtr /*pgc */ ,
514                                      int /*mode */ ,
515                                      int /*nptInit */ ,
516                                      DDXPointRec *      /*pptInit */
517     );
518 
519 extern _X_EXPORT void miPolyFillArc(DrawablePtr /*pDraw */ ,
520                                     GCPtr /*pGC */ ,
521                                     int /*narcs */ ,
522                                     xArc *      /*parcs */
523     );
524 
525 #endif                          /* MI_H */
526