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_PolyPolyline
, /* pPolyPolyline */
51 X11DRV_Polygon
, /* pPolygon */
52 X11DRV_Polyline
, /* pPolyline */
53 X11DRV_PolyBezier
, /* pPolyBezier */
54 NULL
, /* pRealizePalette */
55 X11DRV_Rectangle
, /* pRectangle */
56 NULL
, /* pRestoreDC */
57 X11DRV_RoundRect
, /* pRoundRect */
59 NULL
, /* pScaleViewportExt (optional) */
60 NULL
, /* pScaleWindowExt (optional) */
61 NULL
, /* pSelectClipRgn */
62 X11DRV_SelectObject
, /* pSelectObject */
63 NULL
, /* pSelectPalette */
64 X11DRV_SetBkColor
, /* pSetBkColor */
65 NULL
, /* pSetBkMode */
66 X11DRV_SetDeviceClipping
, /* pSetDeviceClipping */
67 NULL
, /* pSetDIBitsToDevice */
68 NULL
, /* pSetMapMode (optional) */
69 NULL
, /* pSetMapperFlags */
70 X11DRV_SetPixel
, /* pSetPixel */
71 NULL
, /* pSetPolyFillMode */
73 NULL
, /* pSetRelAbs */
74 NULL
, /* pSetStretchBltMode */
75 NULL
, /* pSetTextAlign */
76 NULL
, /* pSetTextCharacterExtra */
77 X11DRV_SetTextColor
, /* pSetTextColor */
78 NULL
, /* pSetTextJustification */
79 NULL
, /* pSetViewportExt (optional) */
80 NULL
, /* pSetViewportOrg (optional) */
81 NULL
, /* pSetWindowExt (optional) */
82 NULL
, /* pSetWindowOrg (optional) */
83 X11DRV_StretchBlt
, /* pStretchBlt */
84 NULL
/* pStretchDIBits */
87 static DeviceCaps X11DRV_DevCaps
= {
89 /* technology */ DT_RASDISPLAY
,
90 /* size, resolution */ 0, 0, 0, 0, 0,
91 /* device objects */ 1, 16 + 6, 16, 0, 0, 100, 0,
92 /* curve caps */ CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
|
93 CC_WIDE
| CC_STYLED
| CC_WIDESTYLED
| CC_INTERIORS
| CC_ROUNDRECT
,
94 /* line caps */ LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
95 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
,
96 /* polygon caps */ PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
97 PC_SCANLINE
| PC_WIDE
| PC_STYLED
| PC_WIDESTYLED
| PC_INTERIORS
,
99 /* regions */ CP_REGION
,
100 /* raster caps */ RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
|
101 RC_DI_BITMAP
| RC_DIBTODEV
| RC_BIGFONT
| RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
,
102 /* aspects */ 36, 36, 51,
104 /* log pixels */ 0, 0,
106 /* palette size */ 0,
109 /**********************************************************************
112 BOOL32
X11DRV_Init(void)
114 /* FIXME: colormap management should be merged with the X11DRV */
116 if( !COLOR_Init() ) return FALSE
;
118 /* Finish up device caps */
121 TRACE(x11drv
, "Height = %-4i pxl, %-4i mm, Width = %-4i pxl, %-4i mm\n",
122 HeightOfScreen(screen
), HeightMMOfScreen(screen
),
123 WidthOfScreen(screen
), WidthMMOfScreen(screen
) );
126 X11DRV_DevCaps
.version
= 0x300;
127 X11DRV_DevCaps
.horzSize
= WidthMMOfScreen(screen
) * screenWidth
/ WidthOfScreen(screen
);
128 X11DRV_DevCaps
.vertSize
= HeightMMOfScreen(screen
) * screenHeight
/ HeightOfScreen(screen
);
129 X11DRV_DevCaps
.horzRes
= screenWidth
;
130 X11DRV_DevCaps
.vertRes
= screenHeight
;
131 X11DRV_DevCaps
.bitsPixel
= screenDepth
;
133 if( COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL
)
134 X11DRV_DevCaps
.sizePalette
= 0;
137 X11DRV_DevCaps
.rasterCaps
|= RC_PALETTE
;
138 X11DRV_DevCaps
.sizePalette
= DefaultVisual(display
,DefaultScreen(display
))->map_entries
;
141 /* Resolution will be adjusted during the font init */
143 X11DRV_DevCaps
.logPixelsX
= (int)(X11DRV_DevCaps
.horzRes
* 25.4 / X11DRV_DevCaps
.horzSize
);
144 X11DRV_DevCaps
.logPixelsY
= (int)(X11DRV_DevCaps
.vertRes
* 25.4 / X11DRV_DevCaps
.vertSize
);
146 /* Create default bitmap */
148 if (!X11DRV_BITMAP_Init()) return FALSE
;
150 /* Initialize brush dithering */
152 if (!X11DRV_BRUSH_Init()) return FALSE
;
154 /* Initialize fonts and text caps */
156 if (!X11DRV_FONT_Init( &X11DRV_DevCaps
)) return FALSE
;
158 return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs
);
161 /**********************************************************************
164 static BOOL32
X11DRV_CreateDC( DC
*dc
, LPCSTR driver
, LPCSTR device
,
165 LPCSTR output
, const DEVMODE16
* initData
)
167 X11DRV_PDEVICE
*physDev
;
169 physDev
= &dc
->u
.x
; /* for now */
171 memset( physDev
, 0, sizeof(*physDev
) );
172 dc
->physDev
= physDev
;
173 dc
->w
.devCaps
= &X11DRV_DevCaps
;
174 if (dc
->w
.flags
& DC_MEMORY
)
176 BITMAPOBJ
*bmp
= (BITMAPOBJ
*) GDI_GetObjPtr( dc
->w
.hBitmap
,
178 physDev
->drawable
= bmp
->pixmap
;
179 physDev
->gc
= TSXCreateGC( display
, physDev
->drawable
, 0, NULL
);
180 dc
->w
.bitsPerPixel
= bmp
->bitmap
.bmBitsPixel
;
181 dc
->w
.hVisRgn
= CreateRectRgn32( 0, 0, bmp
->bitmap
.bmWidth
,
182 bmp
->bitmap
.bmHeight
);
183 GDI_HEAP_UNLOCK( dc
->w
.hBitmap
);
187 physDev
->drawable
= rootWindow
;
188 physDev
->gc
= TSXCreateGC( display
, physDev
->drawable
, 0, NULL
);
189 dc
->w
.bitsPerPixel
= screenDepth
;
190 dc
->w
.hVisRgn
= CreateRectRgn32( 0, 0, screenWidth
, screenHeight
);
195 TSXFreeGC( display
, physDev
->gc
);
199 TSXSetGraphicsExposures( display
, physDev
->gc
, False
);
200 TSXSetSubwindowMode( display
, physDev
->gc
, IncludeInferiors
);
206 /**********************************************************************
209 static BOOL32
X11DRV_DeleteDC( DC
*dc
)
211 X11DRV_PDEVICE
*physDev
= (X11DRV_PDEVICE
*)dc
->physDev
;
212 TSXFreeGC( display
, physDev
->gc
);
216 /**********************************************************************
219 static INT32
X11DRV_Escape( DC
*dc
, INT32 nEscape
, INT32 cbInput
,
220 SEGPTR lpInData
, SEGPTR lpOutData
)
224 case GETSCALINGFACTOR
:
227 LPPOINT16 lppt
= (LPPOINT16
)PTR_SEG_TO_LIN(lpOutData
);
228 lppt
->x
= lppt
->y
= 0; /* no device scaling */