Release 961222
[wine/multimedia.git] / graphics / x11drv / init.c
blob5ceb7364d59c27d0118c130130cf5c59fa084aa1
1 /*
2 * X11 graphics driver initialisation functions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #include <string.h>
8 #include "x11drv.h"
9 #include "bitmap.h"
10 #include "gdi.h"
13 static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
14 LPCSTR output, const DEVMODE16* initData );
15 static BOOL32 X11DRV_DeleteDC( DC *dc );
17 static const DC_FUNCTIONS X11DRV_Funcs =
19 NULL, /* pArc */
20 X11DRV_BitBlt, /* pBitBlt */
21 NULL, /* pChord */
22 X11DRV_CreateDC, /* pCreateDC */
23 X11DRV_DeleteDC, /* pDeleteDC */
24 NULL, /* pDeleteObject */
25 NULL, /* pEllipse */
26 NULL, /* pEscape */
27 NULL, /* pExcludeClipRect */
28 NULL, /* pExcludeVisRect */
29 NULL, /* pExtFloodFill */
30 NULL, /* pExtTextOut */
31 NULL, /* pFillRgn */
32 NULL, /* pFloodFill */
33 NULL, /* pFrameRgn */
34 X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
35 NULL, /* pGetTextMetrics */
36 NULL, /* pIntersectClipRect */
37 NULL, /* pIntersectVisRect */
38 NULL, /* pInvertRgn */
39 NULL, /* pLineTo */
40 NULL, /* pMoveToEx */
41 NULL, /* pOffsetClipRgn */
42 NULL, /* pOffsetViewportOrg (optional) */
43 NULL, /* pOffsetWindowOrg (optional) */
44 NULL, /* pPaintRgn */
45 X11DRV_PatBlt, /* pPatBlt */
46 NULL, /* pPie */
47 NULL, /* pPolyPolygon */
48 NULL, /* pPolygon */
49 NULL, /* pPolyline */
50 NULL, /* pRealizePalette */
51 NULL, /* pRectangle */
52 NULL, /* pRestoreDC */
53 NULL, /* pRoundRect */
54 NULL, /* pSaveDC */
55 NULL, /* pScaleViewportExt (optional) */
56 NULL, /* pScaleWindowExt (optional) */
57 NULL, /* pSelectClipRgn */
58 NULL, /* pSelectObject */
59 NULL, /* pSelectPalette */
60 NULL, /* pSetBkColor */
61 NULL, /* pSetBkMode */
62 X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
63 NULL, /* pSetDIBitsToDevice */
64 NULL, /* pSetMapMode (optional) */
65 NULL, /* pSetMapperFlags */
66 NULL, /* pSetPixel */
67 NULL, /* pSetPolyFillMode */
68 NULL, /* pSetROP2 */
69 NULL, /* pSetRelAbs */
70 NULL, /* pSetStretchBltMode */
71 NULL, /* pSetTextAlign */
72 NULL, /* pSetTextCharacterExtra */
73 NULL, /* pSetTextColor */
74 NULL, /* pSetTextJustification */
75 NULL, /* pSetViewportExt (optional) */
76 NULL, /* pSetViewportOrg (optional) */
77 NULL, /* pSetWindowExt (optional) */
78 NULL, /* pSetWindowOrg (optional) */
79 X11DRV_StretchBlt, /* pStretchBlt */
80 NULL, /* pStretchDIBits */
81 NULL /* pTextOut */
84 static DeviceCaps X11DRV_DevCaps;
86 /**********************************************************************
87 * X11DRV_Init
89 BOOL32 X11DRV_Init(void)
91 return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
95 /**********************************************************************
96 * X11DRV_CreateDC
98 static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
99 LPCSTR output, const DEVMODE16* initData )
101 X11DRV_PDEVICE *physDev;
103 if (!X11DRV_DevCaps.version) DC_FillDevCaps( &X11DRV_DevCaps );
105 physDev = &dc->u.x; /* for now */
107 memset( physDev, 0, sizeof(*physDev) );
108 dc->physDev = physDev;
109 dc->w.devCaps = &X11DRV_DevCaps;
110 if (dc->w.flags & DC_MEMORY)
112 BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( dc->w.hBitmap,
113 BITMAP_MAGIC );
114 physDev->drawable = bmp->pixmap;
115 physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
116 dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
117 dc->w.hVisRgn = CreateRectRgn32( 0, 0, bmp->bitmap.bmWidth,
118 bmp->bitmap.bmHeight );
120 else
122 physDev->drawable = rootWindow;
123 physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
124 dc->w.bitsPerPixel = screenDepth;
125 dc->w.hVisRgn = CreateRectRgn32( 0, 0, screenWidth, screenHeight);
128 if (!dc->w.hVisRgn)
130 XFreeGC( display, physDev->gc );
131 return FALSE;
134 XSetGraphicsExposures( display, physDev->gc, False );
135 XSetSubwindowMode( display, physDev->gc, IncludeInferiors );
137 return TRUE;
141 /**********************************************************************
142 * X11DRV_DeleteDC
144 static BOOL32 X11DRV_DeleteDC( DC *dc )
146 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
147 XFreeGC( display, physDev->gc );
148 return TRUE;