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