d3drm: Implement IDirect3DRMMesh_GetGroupColor.
[wine] / dlls / winex11.drv / init.c
1 /*
2  * X11 graphics driver initialisation functions
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24 #include <string.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winreg.h"
29 #include "x11drv.h"
30 #include "ddrawi.h"
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
34
35 Display *gdi_display;  /* display to use for all GDI functions */
36
37 /* a few dynamic device caps */
38 static int log_pixels_x;  /* pixels per logical inch in x direction */
39 static int log_pixels_y;  /* pixels per logical inch in y direction */
40 static int horz_size;     /* horz. size of screen in millimeters */
41 static int vert_size;     /* vert. size of screen in millimeters */
42 static int palette_size;
43 static int device_init_done;
44
45 static Pixmap stock_bitmap_pixmap;  /* phys bitmap for the default stock bitmap */
46
47 static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
48 static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
49
50 static const struct gdi_dc_funcs x11drv_funcs;
51 static const struct gdi_dc_funcs *xrender_funcs;
52
53 /******************************************************************************
54  *      get_dpi
55  *
56  * get the dpi from the registry
57  */
58 static DWORD get_dpi( void )
59 {
60     DWORD dpi = 96;
61     HKEY hkey;
62
63     if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
64     {
65         DWORD type, size, new_dpi;
66
67         size = sizeof(new_dpi);
68         if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
69         {
70             if(type == REG_DWORD && new_dpi != 0)
71                 dpi = new_dpi;
72         }
73         RegCloseKey(hkey);
74     }
75     return dpi;
76 }
77
78 /**********************************************************************
79  *           device_init
80  *
81  * Perform initializations needed upon creation of the first device.
82  */
83 static void device_init(void)
84 {
85     device_init_done = TRUE;
86
87     /* Initialize XRender */
88     xrender_funcs = X11DRV_XRender_Init();
89
90     /* Init Xcursor */
91     X11DRV_Xcursor_Init();
92
93     palette_size = X11DRV_PALETTE_Init();
94
95     wine_tsx11_lock();
96     stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
97     wine_tsx11_unlock();
98
99     /* Initialize device caps */
100     log_pixels_x = log_pixels_y = get_dpi();
101     horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
102     vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
103 }
104
105 /**********************************************************************
106  *           X11DRV_GDI_Finalize
107  */
108 void X11DRV_GDI_Finalize(void)
109 {
110     X11DRV_PALETTE_Cleanup();
111     /* don't bother to close the display, it often triggers X bugs */
112     /* XCloseDisplay( gdi_display ); */
113 }
114
115
116 static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
117 {
118     X11DRV_PDEVICE *physDev;
119
120     if (!device_init_done) device_init();
121
122     if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
123
124     wine_tsx11_lock();
125     physDev->drawable = drawable;
126     physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
127     XSetGraphicsExposures( gdi_display, physDev->gc, False );
128     XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
129     XFlush( gdi_display );
130     wine_tsx11_unlock();
131     return physDev;
132 }
133
134 /**********************************************************************
135  *           X11DRV_CreateDC
136  */
137 static BOOL X11DRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
138                              LPCWSTR output, const DEVMODEW* initData )
139 {
140     const struct gdi_dc_funcs *glx_funcs = get_glx_driver();
141     X11DRV_PDEVICE *physDev = create_x11_physdev( root_window );
142
143     if (!physDev) return FALSE;
144
145     physDev->depth         = screen_depth;
146     physDev->color_shifts  = &X11DRV_PALETTE_default_shifts;
147     physDev->drawable_rect = virtual_screen_rect;
148     SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
149              virtual_screen_rect.bottom - virtual_screen_rect.top );
150     push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
151     if (xrender_funcs && !xrender_funcs->pCreateDC( pdev, driver, device, output, initData )) return FALSE;
152     if (glx_funcs && !glx_funcs->pCreateDC( pdev, driver, device, output, initData )) return FALSE;
153     return TRUE;
154 }
155
156
157 /**********************************************************************
158  *           X11DRV_CreateCompatibleDC
159  */
160 static BOOL X11DRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
161 {
162     const struct gdi_dc_funcs *glx_funcs = get_glx_driver();
163     X11DRV_PDEVICE *physDev = create_x11_physdev( stock_bitmap_pixmap );
164
165     if (!physDev) return FALSE;
166
167     physDev->depth  = 1;
168     SetRect( &physDev->drawable_rect, 0, 0, 1, 1 );
169     physDev->dc_rect = physDev->drawable_rect;
170     push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
171     if (orig) return TRUE;  /* we already went through Xrender if we have an orig device */
172     if (xrender_funcs && !xrender_funcs->pCreateCompatibleDC( NULL, pdev )) return FALSE;
173     if (glx_funcs && !glx_funcs->pCreateCompatibleDC( NULL, pdev )) return FALSE;
174     return TRUE;
175 }
176
177
178 /**********************************************************************
179  *           X11DRV_DeleteDC
180  */
181 static BOOL X11DRV_DeleteDC( PHYSDEV dev )
182 {
183     X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
184
185     wine_tsx11_lock();
186     XFreeGC( gdi_display, physDev->gc );
187     wine_tsx11_unlock();
188     HeapFree( GetProcessHeap(), 0, physDev );
189     return TRUE;
190 }
191
192
193 void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
194 {
195     RECT rc;
196
197     if (!dev->bounds) return;
198     if (dev->region && GetRgnBox( dev->region, &rc ))
199     {
200         if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc );
201     }
202     else add_bounds_rect( dev->bounds, rect );
203 }
204
205 /***********************************************************************
206  *           X11DRV_SetBoundsRect
207  */
208 static UINT X11DRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
209 {
210     X11DRV_PDEVICE *pdev = get_x11drv_dev( dev );
211
212     if (flags & DCB_DISABLE) pdev->bounds = NULL;
213     else if (flags & DCB_ENABLE) pdev->bounds = rect;
214     return DCB_RESET;  /* we don't have device-specific bounds */
215 }
216
217
218 /***********************************************************************
219  *           GetDeviceCaps    (X11DRV.@)
220  */
221 static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
222 {
223     switch(cap)
224     {
225     case DRIVERVERSION:
226         return 0x300;
227     case TECHNOLOGY:
228         return DT_RASDISPLAY;
229     case HORZSIZE:
230         return horz_size;
231     case VERTSIZE:
232         return vert_size;
233     case HORZRES:
234         return screen_width;
235     case VERTRES:
236         return screen_height;
237     case DESKTOPHORZRES:
238         return virtual_screen_rect.right - virtual_screen_rect.left;
239     case DESKTOPVERTRES:
240         return virtual_screen_rect.bottom - virtual_screen_rect.top;
241     case BITSPIXEL:
242         return screen_bpp;
243     case PLANES:
244         return 1;
245     case NUMBRUSHES:
246         return -1;
247     case NUMPENS:
248         return -1;
249     case NUMMARKERS:
250         return 0;
251     case NUMFONTS:
252         return 0;
253     case NUMCOLORS:
254         /* MSDN: Number of entries in the device's color table, if the device has
255          * a color depth of no more than 8 bits per pixel.For devices with greater
256          * color depths, -1 is returned. */
257         return (screen_depth > 8) ? -1 : (1 << screen_depth);
258     case PDEVICESIZE:
259         return sizeof(X11DRV_PDEVICE);
260     case CURVECAPS:
261         return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
262                 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
263     case LINECAPS:
264         return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
265                 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
266     case POLYGONALCAPS:
267         return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
268                 PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
269     case TEXTCAPS:
270         return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
271                 TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
272                 TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
273     case CLIPCAPS:
274         return CP_REGION;
275     case COLORRES:
276         /* The observed correspondence between BITSPIXEL and COLORRES is:
277          * BITSPIXEL: 8  -> COLORRES: 18
278          * BITSPIXEL: 16 -> COLORRES: 16
279          * BITSPIXEL: 24 -> COLORRES: 24
280          * BITSPIXEL: 32 -> COLORRES: 24 */
281         return (screen_bpp <= 8) ? 18 : min( 24, screen_bpp );
282     case RASTERCAPS:
283         return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
284                 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
285                 (palette_size ? RC_PALETTE : 0));
286     case SHADEBLENDCAPS:
287         return (SB_GRAD_RECT | SB_GRAD_TRI | SB_CONST_ALPHA | SB_PIXEL_ALPHA);
288     case ASPECTX:
289     case ASPECTY:
290         return 36;
291     case ASPECTXY:
292         return 51;
293     case LOGPIXELSX:
294         return log_pixels_x;
295     case LOGPIXELSY:
296         return log_pixels_y;
297     case CAPS1:
298         FIXME("(%p): CAPS1 is unimplemented, will return 0\n", dev->hdc );
299         /* please see wingdi.h for the possible bit-flag values that need
300            to be returned. */
301         return 0;
302     case SIZEPALETTE:
303         return palette_size;
304     case NUMRESERVED:
305     case PHYSICALWIDTH:
306     case PHYSICALHEIGHT:
307     case PHYSICALOFFSETX:
308     case PHYSICALOFFSETY:
309     case SCALINGFACTORX:
310     case SCALINGFACTORY:
311     case VREFRESH:
312     case BLTALIGNMENT:
313         return 0;
314     default:
315         FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
316         return 0;
317     }
318 }
319
320
321 /**********************************************************************
322  *           ExtEscape  (X11DRV.@)
323  */
324 static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
325                       INT out_count, LPVOID out_data )
326 {
327     X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
328
329     switch(escape)
330     {
331     case QUERYESCSUPPORT:
332         if (in_data)
333         {
334             switch (*(const INT *)in_data)
335             {
336             case DCICOMMAND:
337                 return DD_HAL_VERSION;
338             case X11DRV_ESCAPE:
339                 return TRUE;
340             }
341         }
342         break;
343
344     case X11DRV_ESCAPE:
345         if (in_data && in_count >= sizeof(enum x11drv_escape_codes))
346         {
347             switch(*(const enum x11drv_escape_codes *)in_data)
348             {
349             case X11DRV_SET_DRAWABLE:
350                 if (in_count >= sizeof(struct x11drv_escape_set_drawable))
351                 {
352                     const struct x11drv_escape_set_drawable *data = in_data;
353                     physDev->dc_rect = data->dc_rect;
354                     physDev->drawable = data->drawable;
355                     physDev->drawable_rect = data->drawable_rect;
356                     wine_tsx11_lock();
357                     XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
358                     wine_tsx11_unlock();
359                     TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s drawable_rect %s\n",
360                            dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect),
361                            wine_dbgstr_rect(&physDev->drawable_rect) );
362                     return TRUE;
363                 }
364                 break;
365             case X11DRV_START_EXPOSURES:
366                 wine_tsx11_lock();
367                 XSetGraphicsExposures( gdi_display, physDev->gc, True );
368                 wine_tsx11_unlock();
369                 physDev->exposures = 0;
370                 return TRUE;
371             case X11DRV_END_EXPOSURES:
372                 if (out_count >= sizeof(HRGN))
373                 {
374                     HRGN hrgn = 0, tmp = 0;
375
376                     wine_tsx11_lock();
377                     XSetGraphicsExposures( gdi_display, physDev->gc, False );
378                     wine_tsx11_unlock();
379                     if (physDev->exposures)
380                     {
381                         for (;;)
382                         {
383                             XEvent event;
384
385                             wine_tsx11_lock();
386                             XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
387                             wine_tsx11_unlock();
388                             if (event.type == NoExpose) break;
389                             if (event.type == GraphicsExpose)
390                             {
391                                 RECT rect;
392
393                                 rect.left   = event.xgraphicsexpose.x - physDev->dc_rect.left;
394                                 rect.top    = event.xgraphicsexpose.y - physDev->dc_rect.top;
395                                 rect.right  = rect.left + event.xgraphicsexpose.width;
396                                 rect.bottom = rect.top + event.xgraphicsexpose.height;
397                                 if (GetLayout( dev->hdc ) & LAYOUT_RTL)
398                                     mirror_rect( &physDev->dc_rect, &rect );
399
400                                 TRACE( "got %s count %d\n", wine_dbgstr_rect(&rect),
401                                        event.xgraphicsexpose.count );
402
403                                 if (!tmp) tmp = CreateRectRgnIndirect( &rect );
404                                 else SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
405                                 if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR );
406                                 else
407                                 {
408                                     hrgn = tmp;
409                                     tmp = 0;
410                                 }
411                                 if (!event.xgraphicsexpose.count) break;
412                             }
413                             else
414                             {
415                                 ERR( "got unexpected event %d\n", event.type );
416                                 break;
417                             }
418                         }
419                         if (tmp) DeleteObject( tmp );
420                     }
421                     *(HRGN *)out_data = hrgn;
422                     return TRUE;
423                 }
424                 break;
425             default:
426                 break;
427             }
428         }
429         break;
430     }
431     return 0;
432 }
433
434
435 static inline void opengl_error(void)
436 {
437     static int warned;
438     if (!warned++) ERR("No OpenGL support compiled in.\n");
439 }
440
441 /***********************************************************************
442  *              X11DRV_ChoosePixelFormat
443  */
444 static int X11DRV_ChoosePixelFormat( PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd )
445 {
446     opengl_error();
447     return 0;
448 }
449
450 /***********************************************************************
451  *              X11DRV_DescribePixelFormat
452  */
453 static int X11DRV_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESCRIPTOR *ppfd )
454 {
455     opengl_error();
456     return 0;
457 }
458
459 /***********************************************************************
460  *              X11DRV_SetPixelFormat
461  */
462 static BOOL X11DRV_SetPixelFormat( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *ppfd )
463 {
464     opengl_error();
465     return FALSE;
466 }
467
468 /***********************************************************************
469  *              X11DRV_wglCreateContext
470  */
471 static HGLRC X11DRV_wglCreateContext( PHYSDEV dev )
472 {
473     opengl_error();
474     return NULL;
475 }
476
477 /***********************************************************************
478  *              X11DRV_wglCreateContextAttribsARB
479  */
480 static HGLRC X11DRV_wglCreateContextAttribsARB( PHYSDEV dev, HGLRC hShareContext, const int* attribList )
481 {
482     opengl_error();
483     return NULL;
484 }
485
486 /***********************************************************************
487  *              X11DRV_wglGetProcAddress
488  */
489 static PROC X11DRV_wglGetProcAddress( LPCSTR proc )
490 {
491     opengl_error();
492     return NULL;
493 }
494
495 /***********************************************************************
496  *              X11DRV_wglSetPixelFormatWINE
497  */
498 static BOOL X11DRV_wglSetPixelFormatWINE( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *ppfd )
499 {
500     opengl_error();
501     return FALSE;
502 }
503
504
505 static const struct gdi_dc_funcs x11drv_funcs =
506 {
507     NULL,                               /* pAbortDoc */
508     NULL,                               /* pAbortPath */
509     NULL,                               /* pAlphaBlend */
510     NULL,                               /* pAngleArc */
511     X11DRV_Arc,                         /* pArc */
512     NULL,                               /* pArcTo */
513     NULL,                               /* pBeginPath */
514     NULL,                               /* pBlendImage */
515     X11DRV_ChoosePixelFormat,           /* pChoosePixelFormat */
516     X11DRV_Chord,                       /* pChord */
517     NULL,                               /* pCloseFigure */
518     X11DRV_CreateCompatibleDC,          /* pCreateCompatibleDC */
519     X11DRV_CreateDC,                    /* pCreateDC */
520     X11DRV_DeleteDC,                    /* pDeleteDC */
521     NULL,                               /* pDeleteObject */
522     X11DRV_DescribePixelFormat,         /* pDescribePixelFormat */
523     NULL,                               /* pDeviceCapabilities */
524     X11DRV_Ellipse,                     /* pEllipse */
525     NULL,                               /* pEndDoc */
526     NULL,                               /* pEndPage */
527     NULL,                               /* pEndPath */
528     NULL,                               /* pEnumFonts */
529     X11DRV_EnumICMProfiles,             /* pEnumICMProfiles */
530     NULL,                               /* pExcludeClipRect */
531     NULL,                               /* pExtDeviceMode */
532     X11DRV_ExtEscape,                   /* pExtEscape */
533     X11DRV_ExtFloodFill,                /* pExtFloodFill */
534     NULL,                               /* pExtSelectClipRgn */
535     NULL,                               /* pExtTextOut */
536     NULL,                               /* pFillPath */
537     NULL,                               /* pFillRgn */
538     NULL,                               /* pFlattenPath */
539     NULL,                               /* pFontIsLinked */
540     NULL,                               /* pFrameRgn */
541     NULL,                               /* pGdiComment */
542     NULL,                               /* pGdiRealizationInfo */
543     NULL,                               /* pGetBoundsRect */
544     NULL,                               /* pGetCharABCWidths */
545     NULL,                               /* pGetCharABCWidthsI */
546     NULL,                               /* pGetCharWidth */
547     X11DRV_GetDeviceCaps,               /* pGetDeviceCaps */
548     X11DRV_GetDeviceGammaRamp,          /* pGetDeviceGammaRamp */
549     NULL,                               /* pGetFontData */
550     NULL,                               /* pGetFontUnicodeRanges */
551     NULL,                               /* pGetGlyphIndices */
552     NULL,                               /* pGetGlyphOutline */
553     X11DRV_GetICMProfile,               /* pGetICMProfile */
554     X11DRV_GetImage,                    /* pGetImage */
555     NULL,                               /* pGetKerningPairs */
556     X11DRV_GetNearestColor,             /* pGetNearestColor */
557     NULL,                               /* pGetOutlineTextMetrics */
558     NULL,                               /* pGetPixel */
559     NULL,                               /* pGetPixelFormat */
560     X11DRV_GetSystemPaletteEntries,     /* pGetSystemPaletteEntries */
561     NULL,                               /* pGetTextCharsetInfo */
562     NULL,                               /* pGetTextExtentExPoint */
563     NULL,                               /* pGetTextExtentExPointI */
564     NULL,                               /* pGetTextFace */
565     NULL,                               /* pGetTextMetrics */
566     X11DRV_GradientFill,                /* pGradientFill */
567     NULL,                               /* pIntersectClipRect */
568     NULL,                               /* pInvertRgn */
569     X11DRV_LineTo,                      /* pLineTo */
570     NULL,                               /* pModifyWorldTransform */
571     NULL,                               /* pMoveTo */
572     NULL,                               /* pOffsetClipRgn */
573     NULL,                               /* pOffsetViewportOrg */
574     NULL,                               /* pOffsetWindowOrg */
575     X11DRV_PaintRgn,                    /* pPaintRgn */
576     X11DRV_PatBlt,                      /* pPatBlt */
577     X11DRV_Pie,                         /* pPie */
578     NULL,                               /* pPolyBezier */
579     NULL,                               /* pPolyBezierTo */
580     NULL,                               /* pPolyDraw */
581     X11DRV_PolyPolygon,                 /* pPolyPolygon */
582     X11DRV_PolyPolyline,                /* pPolyPolyline */
583     X11DRV_Polygon,                     /* pPolygon */
584     NULL,                               /* pPolyline */
585     NULL,                               /* pPolylineTo */
586     X11DRV_PutImage,                    /* pPutImage */
587     X11DRV_RealizeDefaultPalette,       /* pRealizeDefaultPalette */
588     X11DRV_RealizePalette,              /* pRealizePalette */
589     X11DRV_Rectangle,                   /* pRectangle */
590     NULL,                               /* pResetDC */
591     NULL,                               /* pRestoreDC */
592     X11DRV_RoundRect,                   /* pRoundRect */
593     NULL,                               /* pSaveDC */
594     NULL,                               /* pScaleViewportExt */
595     NULL,                               /* pScaleWindowExt */
596     NULL,                               /* pSelectBitmap */
597     X11DRV_SelectBrush,                 /* pSelectBrush */
598     NULL,                               /* pSelectClipPath */
599     NULL,                               /* pSelectFont */
600     NULL,                               /* pSelectPalette */
601     X11DRV_SelectPen,                   /* pSelectPen */
602     NULL,                               /* pSetArcDirection */
603     NULL,                               /* pSetBkColor */
604     NULL,                               /* pSetBkMode */
605     X11DRV_SetBoundsRect,               /* pSetBoundsRect */
606     X11DRV_SetDCBrushColor,             /* pSetDCBrushColor */
607     X11DRV_SetDCPenColor,               /* pSetDCPenColor */
608     NULL,                               /* pSetDIBitsToDevice */
609     X11DRV_SetDeviceClipping,           /* pSetDeviceClipping */
610     X11DRV_SetDeviceGammaRamp,          /* pSetDeviceGammaRamp */
611     NULL,                               /* pSetLayout */
612     NULL,                               /* pSetMapMode */
613     NULL,                               /* pSetMapperFlags */
614     X11DRV_SetPixel,                    /* pSetPixel */
615     X11DRV_SetPixelFormat,              /* pSetPixelFormat */
616     NULL,                               /* pSetPolyFillMode */
617     NULL,                               /* pSetROP2 */
618     NULL,                               /* pSetRelAbs */
619     NULL,                               /* pSetStretchBltMode */
620     NULL,                               /* pSetTextAlign */
621     NULL,                               /* pSetTextCharacterExtra */
622     NULL,                               /* pSetTextColor */
623     NULL,                               /* pSetTextJustification */
624     NULL,                               /* pSetViewportExt */
625     NULL,                               /* pSetViewportOrg */
626     NULL,                               /* pSetWindowExt */
627     NULL,                               /* pSetWindowOrg */
628     NULL,                               /* pSetWorldTransform */
629     NULL,                               /* pStartDoc */
630     NULL,                               /* pStartPage */
631     X11DRV_StretchBlt,                  /* pStretchBlt */
632     NULL,                               /* pStretchDIBits */
633     NULL,                               /* pStrokeAndFillPath */
634     NULL,                               /* pStrokePath */
635     NULL,                               /* pSwapBuffers */
636     X11DRV_UnrealizePalette,            /* pUnrealizePalette */
637     NULL,                               /* pWidenPath */
638     NULL,                               /* pwglCopyContext */
639     X11DRV_wglCreateContext,            /* pwglCreateContext */
640     X11DRV_wglCreateContextAttribsARB,  /* pwglCreateContextAttribsARB */
641     NULL,                               /* pwglDeleteContext */
642     X11DRV_wglGetProcAddress,           /* pwglGetProcAddress */
643     NULL,                               /* pwglMakeContextCurrentARB */
644     NULL,                               /* pwglMakeCurrent */
645     X11DRV_wglSetPixelFormatWINE,       /* pwglSetPixelFormatWINE */
646     NULL,                               /* pwglShareLists */
647     NULL,                               /* pwglUseFontBitmapsA */
648     NULL,                               /* pwglUseFontBitmapsW */
649     GDI_PRIORITY_GRAPHICS_DRV           /* priority */
650 };
651
652
653 /******************************************************************************
654  *      X11DRV_get_gdi_driver
655  */
656 const struct gdi_dc_funcs * CDECL X11DRV_get_gdi_driver( unsigned int version )
657 {
658     if (version != WINE_GDI_DRIVER_VERSION)
659     {
660         ERR( "version mismatch, gdi32 wants %u but winex11 has %u\n", version, WINE_GDI_DRIVER_VERSION );
661         return NULL;
662     }
663     return &x11drv_funcs;
664 }