Release 960824
[wine/multimedia.git] / graphics / x11drv / init.c
blob5933d73470b09cf59dbd803ed815524bd827511a
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 DEVMODE* initData );
15 static BOOL32 X11DRV_DeleteDC( DC *dc );
17 static const DC_FUNCTIONS X11DRV_Funcs =
19 NULL, /* pArc */
20 NULL, /* 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, /* pOffsetViewportOrgEx */
43 NULL, /* pOffsetWindowOrgEx */
44 NULL, /* pPaintRgn */
45 NULL, /* 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, /* pScaleViewportExtEx */
56 NULL, /* pScaleWindowExtEx */
57 NULL, /* pSelectClipRgn */
58 NULL, /* pSelectObject */
59 NULL, /* pSelectPalette */
60 NULL, /* pSetBkColor */
61 NULL, /* pSetBkMode */
62 NULL, /* pSetDIBitsToDevice */
63 NULL, /* pSetMapMode */
64 NULL, /* pSetMapperFlags */
65 NULL, /* pSetPixel */
66 NULL, /* pSetPolyFillMode */
67 NULL, /* pSetROP2 */
68 NULL, /* pSetRelAbs */
69 NULL, /* pSetStretchBltMode */
70 NULL, /* pSetTextAlign */
71 NULL, /* pSetTextCharacterExtra */
72 NULL, /* pSetTextColor */
73 NULL, /* pSetTextJustification */
74 NULL, /* pSetViewportExtEx */
75 NULL, /* pSetViewportOrgEx */
76 NULL, /* pSetWindowExtEx */
77 NULL, /* pSetWindowOrgEx */
78 NULL, /* pStretchBlt */
79 NULL, /* pStretchDIBits */
80 NULL /* pTextOut */
83 static DeviceCaps X11DRV_DevCaps;
85 /**********************************************************************
86 * X11DRV_Init
88 BOOL32 X11DRV_Init(void)
90 return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
94 /**********************************************************************
95 * X11DRV_CreateDC
97 static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
98 LPCSTR output, const DEVMODE* initData )
100 X11DRV_PDEVICE *physDev;
102 if (!X11DRV_DevCaps.version) DC_FillDevCaps( &X11DRV_DevCaps );
104 physDev = &dc->u.x; /* for now */
106 memset( physDev, 0, sizeof(*physDev) );
107 dc->physDev = physDev;
108 dc->w.devCaps = &X11DRV_DevCaps;
109 if (dc->w.flags & DC_MEMORY)
111 BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( dc->w.hBitmap,
112 BITMAP_MAGIC );
113 physDev->drawable = bmp->pixmap;
114 physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
115 dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
116 dc->w.hVisRgn = CreateRectRgn( 0, 0, bmp->bitmap.bmWidth,
117 bmp->bitmap.bmHeight );
119 else
121 physDev->drawable = rootWindow;
122 physDev->gc = XCreateGC( display, physDev->drawable, 0, NULL );
123 dc->w.bitsPerPixel = screenDepth;
124 dc->w.hVisRgn = CreateRectRgn( 0, 0, screenWidth, screenHeight );
127 if (!dc->w.hVisRgn)
129 XFreeGC( display, physDev->gc );
130 return FALSE;
133 XSetGraphicsExposures( display, physDev->gc, False );
134 XSetSubwindowMode( display, physDev->gc, IncludeInferiors );
136 return TRUE;
140 /**********************************************************************
141 * X11DRV_DeleteDC
143 static BOOL32 X11DRV_DeleteDC( DC *dc )
145 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
146 XFreeGC( display, physDev->gc );
147 return TRUE;