winex11: Recreate the GL drawable when changing the window parent.
[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     stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
96
97     /* Initialize device caps */
98     log_pixels_x = log_pixels_y = get_dpi();
99     horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
100     vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
101 }
102
103
104 static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
105 {
106     X11DRV_PDEVICE *physDev;
107
108     if (!device_init_done) device_init();
109
110     if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
111
112     physDev->drawable = drawable;
113     physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
114     XSetGraphicsExposures( gdi_display, physDev->gc, False );
115     XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
116     XFlush( gdi_display );
117     return physDev;
118 }
119
120 /**********************************************************************
121  *           X11DRV_CreateDC
122  */
123 static BOOL X11DRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
124                              LPCWSTR output, const DEVMODEW* initData )
125 {
126     X11DRV_PDEVICE *physDev = create_x11_physdev( root_window );
127
128     if (!physDev) return FALSE;
129
130     physDev->depth         = default_visual.depth;
131     physDev->color_shifts  = &X11DRV_PALETTE_default_shifts;
132     SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
133              virtual_screen_rect.bottom - virtual_screen_rect.top );
134     push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
135     if (xrender_funcs && !xrender_funcs->pCreateDC( pdev, driver, device, output, initData )) return FALSE;
136     return TRUE;
137 }
138
139
140 /**********************************************************************
141  *           X11DRV_CreateCompatibleDC
142  */
143 static BOOL X11DRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
144 {
145     X11DRV_PDEVICE *physDev = create_x11_physdev( stock_bitmap_pixmap );
146
147     if (!physDev) return FALSE;
148
149     physDev->depth  = 1;
150     SetRect( &physDev->dc_rect, 0, 0, 1, 1 );
151     push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
152     if (orig) return TRUE;  /* we already went through Xrender if we have an orig device */
153     if (xrender_funcs && !xrender_funcs->pCreateCompatibleDC( NULL, pdev )) return FALSE;
154     return TRUE;
155 }
156
157
158 /**********************************************************************
159  *           X11DRV_DeleteDC
160  */
161 static BOOL X11DRV_DeleteDC( PHYSDEV dev )
162 {
163     X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
164
165     XFreeGC( gdi_display, physDev->gc );
166     HeapFree( GetProcessHeap(), 0, physDev );
167     return TRUE;
168 }
169
170
171 void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
172 {
173     RECT rc;
174
175     if (!dev->bounds) return;
176     if (dev->region && GetRgnBox( dev->region, &rc ))
177     {
178         if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc );
179     }
180     else add_bounds_rect( dev->bounds, rect );
181 }
182
183 /***********************************************************************
184  *           X11DRV_SetBoundsRect
185  */
186 static UINT X11DRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
187 {
188     X11DRV_PDEVICE *pdev = get_x11drv_dev( dev );
189
190     if (flags & DCB_DISABLE) pdev->bounds = NULL;
191     else if (flags & DCB_ENABLE) pdev->bounds = rect;
192     return DCB_RESET;  /* we don't have device-specific bounds */
193 }
194
195
196 /***********************************************************************
197  *           GetDeviceCaps    (X11DRV.@)
198  */
199 static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
200 {
201     switch(cap)
202     {
203     case DRIVERVERSION:
204         return 0x300;
205     case TECHNOLOGY:
206         return DT_RASDISPLAY;
207     case HORZSIZE:
208         return horz_size;
209     case VERTSIZE:
210         return vert_size;
211     case HORZRES:
212         return screen_width;
213     case VERTRES:
214         return screen_height;
215     case DESKTOPHORZRES:
216         return virtual_screen_rect.right - virtual_screen_rect.left;
217     case DESKTOPVERTRES:
218         return virtual_screen_rect.bottom - virtual_screen_rect.top;
219     case BITSPIXEL:
220         return screen_bpp;
221     case PLANES:
222         return 1;
223     case NUMBRUSHES:
224         return -1;
225     case NUMPENS:
226         return -1;
227     case NUMMARKERS:
228         return 0;
229     case NUMFONTS:
230         return 0;
231     case NUMCOLORS:
232         /* MSDN: Number of entries in the device's color table, if the device has
233          * a color depth of no more than 8 bits per pixel.For devices with greater
234          * color depths, -1 is returned. */
235         return (default_visual.depth > 8) ? -1 : (1 << default_visual.depth);
236     case PDEVICESIZE:
237         return sizeof(X11DRV_PDEVICE);
238     case CURVECAPS:
239         return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
240                 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
241     case LINECAPS:
242         return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
243                 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
244     case POLYGONALCAPS:
245         return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
246                 PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
247     case TEXTCAPS:
248         return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
249                 TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
250                 TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
251     case CLIPCAPS:
252         return CP_REGION;
253     case COLORRES:
254         /* The observed correspondence between BITSPIXEL and COLORRES is:
255          * BITSPIXEL: 8  -> COLORRES: 18
256          * BITSPIXEL: 16 -> COLORRES: 16
257          * BITSPIXEL: 24 -> COLORRES: 24
258          * BITSPIXEL: 32 -> COLORRES: 24 */
259         return (screen_bpp <= 8) ? 18 : min( 24, screen_bpp );
260     case RASTERCAPS:
261         return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
262                 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
263                 (palette_size ? RC_PALETTE : 0));
264     case SHADEBLENDCAPS:
265         return (SB_GRAD_RECT | SB_GRAD_TRI | SB_CONST_ALPHA | SB_PIXEL_ALPHA);
266     case ASPECTX:
267     case ASPECTY:
268         return 36;
269     case ASPECTXY:
270         return 51;
271     case LOGPIXELSX:
272         return log_pixels_x;
273     case LOGPIXELSY:
274         return log_pixels_y;
275     case CAPS1:
276         FIXME("(%p): CAPS1 is unimplemented, will return 0\n", dev->hdc );
277         /* please see wingdi.h for the possible bit-flag values that need
278            to be returned. */
279         return 0;
280     case SIZEPALETTE:
281         return palette_size;
282     case NUMRESERVED:
283     case PHYSICALWIDTH:
284     case PHYSICALHEIGHT:
285     case PHYSICALOFFSETX:
286     case PHYSICALOFFSETY:
287     case SCALINGFACTORX:
288     case SCALINGFACTORY:
289     case VREFRESH:
290     case BLTALIGNMENT:
291         return 0;
292     default:
293         FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
294         return 0;
295     }
296 }
297
298
299 /**********************************************************************
300  *           ExtEscape  (X11DRV.@)
301  */
302 static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
303                       INT out_count, LPVOID out_data )
304 {
305     X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
306
307     switch(escape)
308     {
309     case QUERYESCSUPPORT:
310         if (in_data)
311         {
312             switch (*(const INT *)in_data)
313             {
314             case DCICOMMAND:
315                 return DD_HAL_VERSION;
316             case X11DRV_ESCAPE:
317                 return TRUE;
318             }
319         }
320         break;
321
322     case X11DRV_ESCAPE:
323         if (in_data && in_count >= sizeof(enum x11drv_escape_codes))
324         {
325             switch(*(const enum x11drv_escape_codes *)in_data)
326             {
327             case X11DRV_SET_DRAWABLE:
328                 if (in_count >= sizeof(struct x11drv_escape_set_drawable))
329                 {
330                     const struct x11drv_escape_set_drawable *data = in_data;
331                     physDev->dc_rect = data->dc_rect;
332                     physDev->drawable = data->drawable;
333                     XFreeGC( gdi_display, physDev->gc );
334                     physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
335                     XSetGraphicsExposures( gdi_display, physDev->gc, False );
336                     XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
337                     TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s\n",
338                            dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect) );
339                     return TRUE;
340                 }
341                 break;
342             case X11DRV_GET_DRAWABLE:
343                 if (out_count >= sizeof(struct x11drv_escape_get_drawable))
344                 {
345                     struct x11drv_escape_get_drawable *data = out_data;
346                     data->drawable = physDev->drawable;
347                     return TRUE;
348                 }
349                 break;
350             case X11DRV_FLUSH_GL_DRAWABLE:
351                 if (in_count >= sizeof(struct x11drv_escape_flush_gl_drawable))
352                 {
353                     const struct x11drv_escape_flush_gl_drawable *data = in_data;
354                     RECT rect = physDev->dc_rect;
355
356                     OffsetRect( &rect, -physDev->dc_rect.left, -physDev->dc_rect.top );
357                     /* The GL drawable may be lagged behind if we don't flush first, so
358                      * flush the display make sure we copy up-to-date data */
359                     XFlush( gdi_display );
360                     XSetFunction( gdi_display, physDev->gc, GXcopy );
361                     XCopyArea( gdi_display, data->gl_drawable, physDev->drawable, physDev->gc,
362                                0, 0, rect.right, rect.bottom,
363                                physDev->dc_rect.left, physDev->dc_rect.top );
364                     add_device_bounds( physDev, &rect );
365                     return TRUE;
366                 }
367                 break;
368             case X11DRV_START_EXPOSURES:
369                 XSetGraphicsExposures( gdi_display, physDev->gc, True );
370                 physDev->exposures = 0;
371                 return TRUE;
372             case X11DRV_END_EXPOSURES:
373                 if (out_count >= sizeof(HRGN))
374                 {
375                     HRGN hrgn = 0, tmp = 0;
376
377                     XSetGraphicsExposures( gdi_display, physDev->gc, False );
378                     if (physDev->exposures)
379                     {
380                         for (;;)
381                         {
382                             XEvent event;
383
384                             XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
385                             if (event.type == NoExpose) break;
386                             if (event.type == GraphicsExpose)
387                             {
388                                 RECT rect;
389
390                                 rect.left   = event.xgraphicsexpose.x - physDev->dc_rect.left;
391                                 rect.top    = event.xgraphicsexpose.y - physDev->dc_rect.top;
392                                 rect.right  = rect.left + event.xgraphicsexpose.width;
393                                 rect.bottom = rect.top + event.xgraphicsexpose.height;
394                                 if (GetLayout( dev->hdc ) & LAYOUT_RTL)
395                                     mirror_rect( &physDev->dc_rect, &rect );
396
397                                 TRACE( "got %s count %d\n", wine_dbgstr_rect(&rect),
398                                        event.xgraphicsexpose.count );
399
400                                 if (!tmp) tmp = CreateRectRgnIndirect( &rect );
401                                 else SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
402                                 if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR );
403                                 else
404                                 {
405                                     hrgn = tmp;
406                                     tmp = 0;
407                                 }
408                                 if (!event.xgraphicsexpose.count) break;
409                             }
410                             else
411                             {
412                                 ERR( "got unexpected event %d\n", event.type );
413                                 break;
414                             }
415                         }
416                         if (tmp) DeleteObject( tmp );
417                     }
418                     *(HRGN *)out_data = hrgn;
419                     return TRUE;
420                 }
421                 break;
422             default:
423                 break;
424             }
425         }
426         break;
427     }
428     return 0;
429 }
430
431 /**********************************************************************
432  *           X11DRV_wine_get_wgl_driver
433  */
434 static struct opengl_funcs * X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT version )
435 {
436     struct opengl_funcs *ret;
437
438     if (!(ret = get_glx_driver( version )))
439     {
440         dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
441         ret = dev->funcs->wine_get_wgl_driver( dev, version );
442     }
443     return ret;
444 }
445
446
447 static const struct gdi_dc_funcs x11drv_funcs =
448 {
449     NULL,                               /* pAbortDoc */
450     NULL,                               /* pAbortPath */
451     NULL,                               /* pAlphaBlend */
452     NULL,                               /* pAngleArc */
453     X11DRV_Arc,                         /* pArc */
454     NULL,                               /* pArcTo */
455     NULL,                               /* pBeginPath */
456     NULL,                               /* pBlendImage */
457     X11DRV_Chord,                       /* pChord */
458     NULL,                               /* pCloseFigure */
459     X11DRV_CreateCompatibleDC,          /* pCreateCompatibleDC */
460     X11DRV_CreateDC,                    /* pCreateDC */
461     X11DRV_DeleteDC,                    /* pDeleteDC */
462     NULL,                               /* pDeleteObject */
463     NULL,                               /* pDeviceCapabilities */
464     X11DRV_Ellipse,                     /* pEllipse */
465     NULL,                               /* pEndDoc */
466     NULL,                               /* pEndPage */
467     NULL,                               /* pEndPath */
468     NULL,                               /* pEnumFonts */
469     X11DRV_EnumICMProfiles,             /* pEnumICMProfiles */
470     NULL,                               /* pExcludeClipRect */
471     NULL,                               /* pExtDeviceMode */
472     X11DRV_ExtEscape,                   /* pExtEscape */
473     X11DRV_ExtFloodFill,                /* pExtFloodFill */
474     NULL,                               /* pExtSelectClipRgn */
475     NULL,                               /* pExtTextOut */
476     NULL,                               /* pFillPath */
477     NULL,                               /* pFillRgn */
478     NULL,                               /* pFlattenPath */
479     NULL,                               /* pFontIsLinked */
480     NULL,                               /* pFrameRgn */
481     NULL,                               /* pGdiComment */
482     NULL,                               /* pGdiRealizationInfo */
483     NULL,                               /* pGetBoundsRect */
484     NULL,                               /* pGetCharABCWidths */
485     NULL,                               /* pGetCharABCWidthsI */
486     NULL,                               /* pGetCharWidth */
487     X11DRV_GetDeviceCaps,               /* pGetDeviceCaps */
488     X11DRV_GetDeviceGammaRamp,          /* pGetDeviceGammaRamp */
489     NULL,                               /* pGetFontData */
490     NULL,                               /* pGetFontUnicodeRanges */
491     NULL,                               /* pGetGlyphIndices */
492     NULL,                               /* pGetGlyphOutline */
493     X11DRV_GetICMProfile,               /* pGetICMProfile */
494     X11DRV_GetImage,                    /* pGetImage */
495     NULL,                               /* pGetKerningPairs */
496     X11DRV_GetNearestColor,             /* pGetNearestColor */
497     NULL,                               /* pGetOutlineTextMetrics */
498     NULL,                               /* pGetPixel */
499     X11DRV_GetSystemPaletteEntries,     /* pGetSystemPaletteEntries */
500     NULL,                               /* pGetTextCharsetInfo */
501     NULL,                               /* pGetTextExtentExPoint */
502     NULL,                               /* pGetTextExtentExPointI */
503     NULL,                               /* pGetTextFace */
504     NULL,                               /* pGetTextMetrics */
505     X11DRV_GradientFill,                /* pGradientFill */
506     NULL,                               /* pIntersectClipRect */
507     NULL,                               /* pInvertRgn */
508     X11DRV_LineTo,                      /* pLineTo */
509     NULL,                               /* pModifyWorldTransform */
510     NULL,                               /* pMoveTo */
511     NULL,                               /* pOffsetClipRgn */
512     NULL,                               /* pOffsetViewportOrg */
513     NULL,                               /* pOffsetWindowOrg */
514     X11DRV_PaintRgn,                    /* pPaintRgn */
515     X11DRV_PatBlt,                      /* pPatBlt */
516     X11DRV_Pie,                         /* pPie */
517     NULL,                               /* pPolyBezier */
518     NULL,                               /* pPolyBezierTo */
519     NULL,                               /* pPolyDraw */
520     X11DRV_PolyPolygon,                 /* pPolyPolygon */
521     X11DRV_PolyPolyline,                /* pPolyPolyline */
522     X11DRV_Polygon,                     /* pPolygon */
523     NULL,                               /* pPolyline */
524     NULL,                               /* pPolylineTo */
525     X11DRV_PutImage,                    /* pPutImage */
526     X11DRV_RealizeDefaultPalette,       /* pRealizeDefaultPalette */
527     X11DRV_RealizePalette,              /* pRealizePalette */
528     X11DRV_Rectangle,                   /* pRectangle */
529     NULL,                               /* pResetDC */
530     NULL,                               /* pRestoreDC */
531     X11DRV_RoundRect,                   /* pRoundRect */
532     NULL,                               /* pSaveDC */
533     NULL,                               /* pScaleViewportExt */
534     NULL,                               /* pScaleWindowExt */
535     NULL,                               /* pSelectBitmap */
536     X11DRV_SelectBrush,                 /* pSelectBrush */
537     NULL,                               /* pSelectClipPath */
538     NULL,                               /* pSelectFont */
539     NULL,                               /* pSelectPalette */
540     X11DRV_SelectPen,                   /* pSelectPen */
541     NULL,                               /* pSetArcDirection */
542     NULL,                               /* pSetBkColor */
543     NULL,                               /* pSetBkMode */
544     X11DRV_SetBoundsRect,               /* pSetBoundsRect */
545     X11DRV_SetDCBrushColor,             /* pSetDCBrushColor */
546     X11DRV_SetDCPenColor,               /* pSetDCPenColor */
547     NULL,                               /* pSetDIBitsToDevice */
548     X11DRV_SetDeviceClipping,           /* pSetDeviceClipping */
549     X11DRV_SetDeviceGammaRamp,          /* pSetDeviceGammaRamp */
550     NULL,                               /* pSetLayout */
551     NULL,                               /* pSetMapMode */
552     NULL,                               /* pSetMapperFlags */
553     X11DRV_SetPixel,                    /* pSetPixel */
554     NULL,                               /* pSetPolyFillMode */
555     NULL,                               /* pSetROP2 */
556     NULL,                               /* pSetRelAbs */
557     NULL,                               /* pSetStretchBltMode */
558     NULL,                               /* pSetTextAlign */
559     NULL,                               /* pSetTextCharacterExtra */
560     NULL,                               /* pSetTextColor */
561     NULL,                               /* pSetTextJustification */
562     NULL,                               /* pSetViewportExt */
563     NULL,                               /* pSetViewportOrg */
564     NULL,                               /* pSetWindowExt */
565     NULL,                               /* pSetWindowOrg */
566     NULL,                               /* pSetWorldTransform */
567     NULL,                               /* pStartDoc */
568     NULL,                               /* pStartPage */
569     X11DRV_StretchBlt,                  /* pStretchBlt */
570     NULL,                               /* pStretchDIBits */
571     NULL,                               /* pStrokeAndFillPath */
572     NULL,                               /* pStrokePath */
573     X11DRV_UnrealizePalette,            /* pUnrealizePalette */
574     NULL,                               /* pWidenPath */
575     X11DRV_wine_get_wgl_driver,         /* wine_get_wgl_driver */
576     GDI_PRIORITY_GRAPHICS_DRV           /* priority */
577 };
578
579
580 /******************************************************************************
581  *      X11DRV_get_gdi_driver
582  */
583 const struct gdi_dc_funcs * CDECL X11DRV_get_gdi_driver( unsigned int version )
584 {
585     if (version != WINE_GDI_DRIVER_VERSION)
586     {
587         ERR( "version mismatch, gdi32 wants %u but winex11 has %u\n", version, WINE_GDI_DRIVER_VERSION );
588         return NULL;
589     }
590     return &x11drv_funcs;
591 }