2 * X11 graphics driver initialisation functions
4 * Copyright 1996 Alexandre Julliard
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 INT32
X11DRV_Escape( DC
*dc
, INT32 nEscape
, INT32 cbInput
,
18 SEGPTR lpInData
, SEGPTR lpOutData
);
20 static const DC_FUNCTIONS X11DRV_Funcs
=
22 X11DRV_Arc
, /* pArc */
23 X11DRV_BitBlt
, /* pBitBlt */
24 X11DRV_Chord
, /* pChord */
25 X11DRV_CreateDC
, /* pCreateDC */
26 X11DRV_DeleteDC
, /* pDeleteDC */
27 NULL
, /* pDeleteObject */
28 X11DRV_Ellipse
, /* pEllipse */
29 X11DRV_EnumDeviceFonts
, /* pEnumDeviceFonts */
30 X11DRV_Escape
, /* pEscape */
31 NULL
, /* pExcludeClipRect */
32 NULL
, /* pExcludeVisRect */
33 X11DRV_ExtFloodFill
, /* pExtFloodFill */
34 X11DRV_ExtTextOut
, /* pExtTextOut */
35 X11DRV_GetCharWidth
, /* pGetCharWidth */
36 X11DRV_GetPixel
, /* pGetPixel */
37 X11DRV_GetTextExtentPoint
, /* pGetTextExtentPoint */
38 X11DRV_GetTextMetrics
, /* pGetTextMetrics */
39 NULL
, /* pIntersectClipRect */
40 NULL
, /* pIntersectVisRect */
41 X11DRV_LineTo
, /* pLineTo */
42 X11DRV_MoveToEx
, /* pMoveToEx */
43 NULL
, /* pOffsetClipRgn */
44 NULL
, /* pOffsetViewportOrg (optional) */
45 NULL
, /* pOffsetWindowOrg (optional) */
46 X11DRV_PaintRgn
, /* pPaintRgn */
47 X11DRV_PatBlt
, /* pPatBlt */
48 X11DRV_Pie
, /* pPie */
49 X11DRV_PolyPolygon
, /* pPolyPolygon */
50 X11DRV_Polygon
, /* pPolygon */
51 X11DRV_Polyline
, /* pPolyline */
52 NULL
, /* pRealizePalette */
53 X11DRV_Rectangle
, /* pRectangle */
54 NULL
, /* pRestoreDC */
55 X11DRV_RoundRect
, /* pRoundRect */
57 NULL
, /* pScaleViewportExt (optional) */
58 NULL
, /* pScaleWindowExt (optional) */
59 NULL
, /* pSelectClipRgn */
60 X11DRV_SelectObject
, /* pSelectObject */
61 NULL
, /* pSelectPalette */
62 NULL
, /* pSetBkColor */
63 NULL
, /* pSetBkMode */
64 X11DRV_SetDeviceClipping
, /* pSetDeviceClipping */
65 NULL
, /* pSetDIBitsToDevice */
66 NULL
, /* pSetMapMode (optional) */
67 NULL
, /* pSetMapperFlags */
68 X11DRV_SetPixel
, /* pSetPixel */
69 NULL
, /* pSetPolyFillMode */
71 NULL
, /* pSetRelAbs */
72 NULL
, /* pSetStretchBltMode */
73 NULL
, /* pSetTextAlign */
74 NULL
, /* pSetTextCharacterExtra */
75 NULL
, /* pSetTextColor */
76 NULL
, /* pSetTextJustification */
77 NULL
, /* pSetViewportExt (optional) */
78 NULL
, /* pSetViewportOrg (optional) */
79 NULL
, /* pSetWindowExt (optional) */
80 NULL
, /* pSetWindowOrg (optional) */
81 X11DRV_StretchBlt
, /* pStretchBlt */
82 NULL
/* pStretchDIBits */
85 static DeviceCaps X11DRV_DevCaps
= {
87 /* technology */ DT_RASDISPLAY
,
88 /* size, resolution */ 0, 0, 0, 0, 0,
89 /* device objects */ 1, 16 + 6, 16, 0, 0, 100, 0,
90 /* curve caps */ CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
|
91 CC_WIDE
| CC_STYLED
| CC_WIDESTYLED
| CC_INTERIORS
| CC_ROUNDRECT
,
92 /* line caps */ LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
93 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
,
94 /* polygon caps */ PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
95 PC_SCANLINE
| PC_WIDE
| PC_STYLED
| PC_WIDESTYLED
| PC_INTERIORS
,
97 /* regions */ CP_REGION
,
98 /* raster caps */ RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
|
99 RC_DI_BITMAP
| RC_DIBTODEV
| RC_BIGFONT
| RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
,
100 /* aspects */ 36, 36, 51,
102 /* log pixels */ 0, 0,
104 /* palette size */ 0,
107 /**********************************************************************
110 BOOL32
X11DRV_Init(void)
112 /* FIXME: colormap management should be merged with the X11DRV */
114 if( !COLOR_Init() ) return FALSE
;
116 /* Finish up device caps */
119 TRACE(x11drv
, "Height = %-4i pxl, %-4i mm, Width = %-4i pxl, %-4i mm\n",
120 HeightOfScreen(screen
), HeightMMOfScreen(screen
),
121 WidthOfScreen(screen
), WidthMMOfScreen(screen
) );
124 X11DRV_DevCaps
.version
= 0x300;
125 X11DRV_DevCaps
.horzSize
= WidthMMOfScreen(screen
) * screenWidth
/ WidthOfScreen(screen
);
126 X11DRV_DevCaps
.vertSize
= HeightMMOfScreen(screen
) * screenHeight
/ HeightOfScreen(screen
);
127 X11DRV_DevCaps
.horzRes
= screenWidth
;
128 X11DRV_DevCaps
.vertRes
= screenHeight
;
129 X11DRV_DevCaps
.bitsPixel
= screenDepth
;
131 if( COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL
)
132 X11DRV_DevCaps
.sizePalette
= 0;
135 X11DRV_DevCaps
.rasterCaps
|= RC_PALETTE
;
136 X11DRV_DevCaps
.sizePalette
= DefaultVisual(display
,DefaultScreen(display
))->map_entries
;
139 /* Resolution will be adjusted during the font init */
141 X11DRV_DevCaps
.logPixelsX
= (int)(X11DRV_DevCaps
.horzRes
* 25.4 / X11DRV_DevCaps
.horzSize
);
142 X11DRV_DevCaps
.logPixelsY
= (int)(X11DRV_DevCaps
.vertRes
* 25.4 / X11DRV_DevCaps
.vertSize
);
144 /* Create default bitmap */
146 if (!X11DRV_BITMAP_Init()) return FALSE
;
148 /* Initialize brush dithering */
150 if (!X11DRV_BRUSH_Init()) return FALSE
;
152 /* Initialize fonts and text caps */
154 if (!X11DRV_FONT_Init( &X11DRV_DevCaps
)) return FALSE
;
156 return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs
);
159 /**********************************************************************
162 static BOOL32
X11DRV_CreateDC( DC
*dc
, LPCSTR driver
, LPCSTR device
,
163 LPCSTR output
, const DEVMODE16
* initData
)
165 X11DRV_PDEVICE
*physDev
;
167 physDev
= &dc
->u
.x
; /* for now */
169 memset( physDev
, 0, sizeof(*physDev
) );
170 dc
->physDev
= physDev
;
171 dc
->w
.devCaps
= &X11DRV_DevCaps
;
172 if (dc
->w
.flags
& DC_MEMORY
)
174 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( dc
->w
.hBitmap
,
176 physDev
->drawable
= bmp
->pixmap
;
177 physDev
->gc
= TSXCreateGC( display
, physDev
->drawable
, 0, NULL
);
178 dc
->w
.bitsPerPixel
= bmp
->bitmap
.bmBitsPixel
;
179 dc
->w
.hVisRgn
= CreateRectRgn32( 0, 0, bmp
->bitmap
.bmWidth
,
180 bmp
->bitmap
.bmHeight
);
181 GDI_HEAP_UNLOCK( dc
->w
.hBitmap
);
185 physDev
->drawable
= rootWindow
;
186 physDev
->gc
= TSXCreateGC( display
, physDev
->drawable
, 0, NULL
);
187 dc
->w
.bitsPerPixel
= screenDepth
;
188 dc
->w
.hVisRgn
= CreateRectRgn32( 0, 0, screenWidth
, screenHeight
);
193 TSXFreeGC( display
, physDev
->gc
);
197 TSXSetGraphicsExposures( display
, physDev
->gc
, False
);
198 TSXSetSubwindowMode( display
, physDev
->gc
, IncludeInferiors
);
204 /**********************************************************************
207 static BOOL32
X11DRV_DeleteDC( DC
*dc
)
209 X11DRV_PDEVICE
*physDev
= (X11DRV_PDEVICE
*)dc
->physDev
;
210 TSXFreeGC( display
, physDev
->gc
);
214 /**********************************************************************
217 static INT32
X11DRV_Escape( DC
*dc
, INT32 nEscape
, INT32 cbInput
,
218 SEGPTR lpInData
, SEGPTR lpOutData
)
222 case GETSCALINGFACTOR
:
225 LPPOINT16 lppt
= (LPPOINT16
)PTR_SEG_TO_LIN(lpOutData
);
226 lppt
->x
= lppt
->y
= 0; /* no device scaling */