init.c 23.6 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4
/*
 * X11 graphics driver initialisation functions
 *
 * Copyright 1996 Alexandre Julliard
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Alexandre Julliard's avatar
Alexandre Julliard committed
19 20
 */

Patrik Stridvall's avatar
Patrik Stridvall committed
21 22
#include "config.h"

23
#include <stdarg.h>
Alexandre Julliard's avatar
Alexandre Julliard committed
24
#include <string.h>
25

26
#include "windef.h"
27
#include "winbase.h"
28
#include "winreg.h"
29
#include "x11drv.h"
30
#include "wine/debug.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
31

32
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
33

34 35
Display *gdi_display;  /* display to use for all GDI functions */

36 37 38 39 40 41
/* a few dynamic device caps */
static int log_pixels_x;  /* pixels per logical inch in x direction */
static int log_pixels_y;  /* pixels per logical inch in y direction */
static int horz_size;     /* horz. size of screen in millimeters */
static int vert_size;     /* vert. size of screen in millimeters */
static int palette_size;
42
static int device_init_done;
43

44
static Pixmap stock_bitmap_pixmap;  /* phys bitmap for the default stock bitmap */
45 46 47 48

static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};

49
static const struct gdi_dc_funcs x11drv_funcs;
50
static const struct gdi_dc_funcs *xrender_funcs;
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

/******************************************************************************
 *      get_dpi
 *
 * get the dpi from the registry
 */
static DWORD get_dpi( void )
{
    DWORD dpi = 96;
    HKEY hkey;

    if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
    {
        DWORD type, size, new_dpi;

        size = sizeof(new_dpi);
        if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
        {
            if(type == REG_DWORD && new_dpi != 0)
                dpi = new_dpi;
        }
        RegCloseKey(hkey);
    }
    return dpi;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
77
/**********************************************************************
78 79 80
 *	     device_init
 *
 * Perform initializations needed upon creation of the first device.
Alexandre Julliard's avatar
Alexandre Julliard committed
81
 */
82
static void device_init(void)
Alexandre Julliard's avatar
Alexandre Julliard committed
83
{
84
    device_init_done = TRUE;
85

86
    /* Initialize XRender */
87
    xrender_funcs = X11DRV_XRender_Init();
88

89 90 91
    /* Init Xcursor */
    X11DRV_Xcursor_Init();

92
    palette_size = X11DRV_PALETTE_Init();
Alexandre Julliard's avatar
Alexandre Julliard committed
93

94
    stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
Alexandre Julliard's avatar
Alexandre Julliard committed
95

96 97
    /* Initialize device caps */
    log_pixels_x = log_pixels_y = get_dpi();
98 99
    horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
    vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
Alexandre Julliard's avatar
Alexandre Julliard committed
100 101
}

102 103

static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
Alexandre Julliard's avatar
Alexandre Julliard committed
104 105 106
{
    X11DRV_PDEVICE *physDev;

107 108
    if (!device_init_done) device_init();

109
    if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
Alexandre Julliard's avatar
Alexandre Julliard committed
110

111 112
    physDev->drawable = drawable;
    physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
113 114 115
    XSetGraphicsExposures( gdi_display, physDev->gc, False );
    XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
    XFlush( gdi_display );
116 117 118 119 120 121
    return physDev;
}

/**********************************************************************
 *	     X11DRV_CreateDC
 */
122 123
static BOOL X11DRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
                             LPCWSTR output, const DEVMODEW* initData )
124 125 126 127 128
{
    X11DRV_PDEVICE *physDev = create_x11_physdev( root_window );

    if (!physDev) return FALSE;

129
    physDev->depth         = default_visual.depth;
130 131 132
    physDev->color_shifts  = &X11DRV_PALETTE_default_shifts;
    SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
             virtual_screen_rect.bottom - virtual_screen_rect.top );
133
    push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
134 135
    if (xrender_funcs && !xrender_funcs->pCreateDC( pdev, driver, device, output, initData )) return FALSE;
    return TRUE;
136 137 138 139 140 141 142 143
}


/**********************************************************************
 *	     X11DRV_CreateCompatibleDC
 */
static BOOL X11DRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
{
144
    X11DRV_PDEVICE *physDev = create_x11_physdev( stock_bitmap_pixmap );
145 146 147 148

    if (!physDev) return FALSE;

    physDev->depth  = 1;
149
    SetRect( &physDev->dc_rect, 0, 0, 1, 1 );
150
    push_dc_driver( pdev, &physDev->dev, &x11drv_funcs );
151
    if (orig) return TRUE;  /* we already went through Xrender if we have an orig device */
152 153
    if (xrender_funcs && !xrender_funcs->pCreateCompatibleDC( NULL, pdev )) return FALSE;
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
154 155 156 157 158 159
}


/**********************************************************************
 *	     X11DRV_DeleteDC
 */
160
static BOOL X11DRV_DeleteDC( PHYSDEV dev )
Alexandre Julliard's avatar
Alexandre Julliard committed
161
{
162 163
    X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );

164
    XFreeGC( gdi_display, physDev->gc );
165
    HeapFree( GetProcessHeap(), 0, physDev );
Alexandre Julliard's avatar
Alexandre Julliard committed
166 167
    return TRUE;
}
Alexandre Julliard's avatar
Alexandre Julliard committed
168

169

170 171 172 173
void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
{
    RECT rc;

174
    if (!dev->bounds) return;
175 176
    if (dev->region && GetRgnBox( dev->region, &rc ))
    {
177
        if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc );
178
    }
179
    else add_bounds_rect( dev->bounds, rect );
180 181
}

182 183 184 185 186 187 188
/***********************************************************************
 *           X11DRV_SetBoundsRect
 */
static UINT X11DRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
    X11DRV_PDEVICE *pdev = get_x11drv_dev( dev );

189 190 191
    if (flags & DCB_DISABLE) pdev->bounds = NULL;
    else if (flags & DCB_ENABLE) pdev->bounds = rect;
    return DCB_RESET;  /* we don't have device-specific bounds */
192 193 194
}


195 196 197
/***********************************************************************
 *           GetDeviceCaps    (X11DRV.@)
 */
198
static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
{
    switch(cap)
    {
    case DRIVERVERSION:
        return 0x300;
    case TECHNOLOGY:
        return DT_RASDISPLAY;
    case HORZSIZE:
        return horz_size;
    case VERTSIZE:
        return vert_size;
    case HORZRES:
        return screen_width;
    case VERTRES:
        return screen_height;
214 215 216 217
    case DESKTOPHORZRES:
        return virtual_screen_rect.right - virtual_screen_rect.left;
    case DESKTOPVERTRES:
        return virtual_screen_rect.bottom - virtual_screen_rect.top;
218
    case BITSPIXEL:
219
        return screen_bpp;
220 221 222 223 224 225 226 227 228 229 230 231 232 233
    case PLANES:
        return 1;
    case NUMBRUSHES:
        return -1;
    case NUMPENS:
        return -1;
    case NUMMARKERS:
        return 0;
    case NUMFONTS:
        return 0;
    case NUMCOLORS:
        /* MSDN: Number of entries in the device's color table, if the device has
         * a color depth of no more than 8 bits per pixel.For devices with greater
         * color depths, -1 is returned. */
234
        return (default_visual.depth > 8) ? -1 : (1 << default_visual.depth);
235 236 237 238 239 240 241 242 243 244 245 246
    case PDEVICESIZE:
        return sizeof(X11DRV_PDEVICE);
    case CURVECAPS:
        return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
                CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
    case LINECAPS:
        return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
                LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
    case POLYGONALCAPS:
        return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
                PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
    case TEXTCAPS:
247 248 249
        return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
                TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
                TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
250 251
    case CLIPCAPS:
        return CP_REGION;
252 253 254 255 256 257
    case COLORRES:
        /* The observed correspondence between BITSPIXEL and COLORRES is:
         * BITSPIXEL: 8  -> COLORRES: 18
         * BITSPIXEL: 16 -> COLORRES: 16
         * BITSPIXEL: 24 -> COLORRES: 24
         * BITSPIXEL: 32 -> COLORRES: 24 */
258
        return (screen_bpp <= 8) ? 18 : min( 24, screen_bpp );
259 260 261 262
    case RASTERCAPS:
        return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
                RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
                (palette_size ? RC_PALETTE : 0));
263 264
    case SHADEBLENDCAPS:
        return (SB_GRAD_RECT | SB_GRAD_TRI | SB_CONST_ALPHA | SB_PIXEL_ALPHA);
265 266 267 268 269 270 271 272 273 274
    case ASPECTX:
    case ASPECTY:
        return 36;
    case ASPECTXY:
        return 51;
    case LOGPIXELSX:
        return log_pixels_x;
    case LOGPIXELSY:
        return log_pixels_y;
    case CAPS1:
275
        FIXME("(%p): CAPS1 is unimplemented, will return 0\n", dev->hdc );
276
        /* please see wingdi.h for the possible bit-flag values that need
277
           to be returned. */
278 279 280 281 282 283 284 285 286 287 288
        return 0;
    case SIZEPALETTE:
        return palette_size;
    case NUMRESERVED:
    case PHYSICALWIDTH:
    case PHYSICALHEIGHT:
    case PHYSICALOFFSETX:
    case PHYSICALOFFSETY:
    case SCALINGFACTORX:
    case SCALINGFACTORY:
    case VREFRESH:
289
    case BLTALIGNMENT:
290 291
        return 0;
    default:
292
        FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
293 294 295 296 297
        return 0;
    }
}


298 299 300 301 302 303 304 305 306 307
/***********************************************************************
 *           SelectFont
 */
static HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_flags )
{
    if (default_visual.depth <= 8) *aa_flags = GGO_BITMAP;  /* no anti-aliasing on <= 8bpp */
    dev = GET_NEXT_PHYSDEV( dev, pSelectFont );
    return dev->funcs->pSelectFont( dev, hfont, aa_flags );
}

Alexandre Julliard's avatar
Alexandre Julliard committed
308
/**********************************************************************
309
 *           ExtEscape  (X11DRV.@)
Alexandre Julliard's avatar
Alexandre Julliard committed
310
 */
311
static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
312
                      INT out_count, LPVOID out_data )
Alexandre Julliard's avatar
Alexandre Julliard committed
313
{
314 315
    X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );

316
    switch(escape)
Alexandre Julliard's avatar
Alexandre Julliard committed
317
    {
318
    case QUERYESCSUPPORT:
319
        if (in_data && in_count >= sizeof(DWORD))
320
        {
Eric Pouech's avatar
Eric Pouech committed
321
            switch (*(const INT *)in_data)
322
            {
323 324
            case X11DRV_ESCAPE:
                return TRUE;
325 326 327 328
            }
        }
        break;

329 330 331
    case X11DRV_ESCAPE:
        if (in_data && in_count >= sizeof(enum x11drv_escape_codes))
        {
Eric Pouech's avatar
Eric Pouech committed
332
            switch(*(const enum x11drv_escape_codes *)in_data)
333
            {
334 335 336
            case X11DRV_SET_DRAWABLE:
                if (in_count >= sizeof(struct x11drv_escape_set_drawable))
                {
337
                    const struct x11drv_escape_set_drawable *data = in_data;
338
                    physDev->dc_rect = data->dc_rect;
339
                    physDev->drawable = data->drawable;
340 341 342
                    XFreeGC( gdi_display, physDev->gc );
                    physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
                    XSetGraphicsExposures( gdi_display, physDev->gc, False );
343
                    XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
344 345
                    TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s\n",
                           dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect) );
346 347 348
                    return TRUE;
                }
                break;
349 350 351 352 353 354 355 356
            case X11DRV_GET_DRAWABLE:
                if (out_count >= sizeof(struct x11drv_escape_get_drawable))
                {
                    struct x11drv_escape_get_drawable *data = out_data;
                    data->drawable = physDev->drawable;
                    return TRUE;
                }
                break;
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
            case X11DRV_FLUSH_GL_DRAWABLE:
                if (in_count >= sizeof(struct x11drv_escape_flush_gl_drawable))
                {
                    const struct x11drv_escape_flush_gl_drawable *data = in_data;
                    RECT rect = physDev->dc_rect;

                    OffsetRect( &rect, -physDev->dc_rect.left, -physDev->dc_rect.top );
                    /* The GL drawable may be lagged behind if we don't flush first, so
                     * flush the display make sure we copy up-to-date data */
                    XFlush( gdi_display );
                    XSetFunction( gdi_display, physDev->gc, GXcopy );
                    XCopyArea( gdi_display, data->gl_drawable, physDev->drawable, physDev->gc,
                               0, 0, rect.right, rect.bottom,
                               physDev->dc_rect.left, physDev->dc_rect.top );
                    add_device_bounds( physDev, &rect );
                    return TRUE;
                }
                break;
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
            case X11DRV_START_EXPOSURES:
                XSetGraphicsExposures( gdi_display, physDev->gc, True );
                physDev->exposures = 0;
                return TRUE;
            case X11DRV_END_EXPOSURES:
                if (out_count >= sizeof(HRGN))
                {
                    HRGN hrgn = 0, tmp = 0;

                    XSetGraphicsExposures( gdi_display, physDev->gc, False );
                    if (physDev->exposures)
                    {
                        for (;;)
                        {
                            XEvent event;

                            XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
                            if (event.type == NoExpose) break;
                            if (event.type == GraphicsExpose)
                            {
395
                                RECT rect;
396

397 398 399 400
                                rect.left   = event.xgraphicsexpose.x - physDev->dc_rect.left;
                                rect.top    = event.xgraphicsexpose.y - physDev->dc_rect.top;
                                rect.right  = rect.left + event.xgraphicsexpose.width;
                                rect.bottom = rect.top + event.xgraphicsexpose.height;
401
                                if (GetLayout( dev->hdc ) & LAYOUT_RTL)
402 403 404
                                    mirror_rect( &physDev->dc_rect, &rect );

                                TRACE( "got %s count %d\n", wine_dbgstr_rect(&rect),
405 406
                                       event.xgraphicsexpose.count );

407 408
                                if (!tmp) tmp = CreateRectRgnIndirect( &rect );
                                else SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
                                if (hrgn) CombineRgn( hrgn, hrgn, tmp, RGN_OR );
                                else
                                {
                                    hrgn = tmp;
                                    tmp = 0;
                                }
                                if (!event.xgraphicsexpose.count) break;
                            }
                            else
                            {
                                ERR( "got unexpected event %d\n", event.type );
                                break;
                            }
                        }
                        if (tmp) DeleteObject( tmp );
                    }
                    *(HRGN *)out_data = hrgn;
                    return TRUE;
                }
                break;
429 430
            default:
                break;
431 432 433
            }
        }
        break;
Alexandre Julliard's avatar
Alexandre Julliard committed
434 435 436
    }
    return 0;
}
437

438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
/**********************************************************************
 *           X11DRV_wine_get_wgl_driver
 */
static struct opengl_funcs * X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT version )
{
    struct opengl_funcs *ret;

    if (!(ret = get_glx_driver( version )))
    {
        dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver );
        ret = dev->funcs->wine_get_wgl_driver( dev, version );
    }
    return ret;
}

453 454 455 456 457

static const struct gdi_dc_funcs x11drv_funcs =
{
    NULL,                               /* pAbortDoc */
    NULL,                               /* pAbortPath */
458
    NULL,                               /* pAlphaBlend */
459 460 461 462
    NULL,                               /* pAngleArc */
    X11DRV_Arc,                         /* pArc */
    NULL,                               /* pArcTo */
    NULL,                               /* pBeginPath */
463
    NULL,                               /* pBlendImage */
464 465
    X11DRV_Chord,                       /* pChord */
    NULL,                               /* pCloseFigure */
466
    X11DRV_CreateCompatibleDC,          /* pCreateCompatibleDC */
467 468 469 470 471 472 473 474
    X11DRV_CreateDC,                    /* pCreateDC */
    X11DRV_DeleteDC,                    /* pDeleteDC */
    NULL,                               /* pDeleteObject */
    NULL,                               /* pDeviceCapabilities */
    X11DRV_Ellipse,                     /* pEllipse */
    NULL,                               /* pEndDoc */
    NULL,                               /* pEndPage */
    NULL,                               /* pEndPath */
475
    NULL,                               /* pEnumFonts */
476 477 478 479 480 481
    X11DRV_EnumICMProfiles,             /* pEnumICMProfiles */
    NULL,                               /* pExcludeClipRect */
    NULL,                               /* pExtDeviceMode */
    X11DRV_ExtEscape,                   /* pExtEscape */
    X11DRV_ExtFloodFill,                /* pExtFloodFill */
    NULL,                               /* pExtSelectClipRgn */
482
    NULL,                               /* pExtTextOut */
483 484 485
    NULL,                               /* pFillPath */
    NULL,                               /* pFillRgn */
    NULL,                               /* pFlattenPath */
486
    NULL,                               /* pFontIsLinked */
487 488
    NULL,                               /* pFrameRgn */
    NULL,                               /* pGdiComment */
489
    NULL,                               /* pGdiRealizationInfo */
490
    NULL,                               /* pGetBoundsRect */
491 492
    NULL,                               /* pGetCharABCWidths */
    NULL,                               /* pGetCharABCWidthsI */
493
    NULL,                               /* pGetCharWidth */
494 495
    X11DRV_GetDeviceCaps,               /* pGetDeviceCaps */
    X11DRV_GetDeviceGammaRamp,          /* pGetDeviceGammaRamp */
496 497 498 499
    NULL,                               /* pGetFontData */
    NULL,                               /* pGetFontUnicodeRanges */
    NULL,                               /* pGetGlyphIndices */
    NULL,                               /* pGetGlyphOutline */
500
    X11DRV_GetICMProfile,               /* pGetICMProfile */
501
    X11DRV_GetImage,                    /* pGetImage */
502
    NULL,                               /* pGetKerningPairs */
503
    X11DRV_GetNearestColor,             /* pGetNearestColor */
504
    NULL,                               /* pGetOutlineTextMetrics */
505
    NULL,                               /* pGetPixel */
506
    X11DRV_GetSystemPaletteEntries,     /* pGetSystemPaletteEntries */
507
    NULL,                               /* pGetTextCharsetInfo */
508
    NULL,                               /* pGetTextExtentExPoint */
509 510
    NULL,                               /* pGetTextExtentExPointI */
    NULL,                               /* pGetTextFace */
511
    NULL,                               /* pGetTextMetrics */
512
    X11DRV_GradientFill,                /* pGradientFill */
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
    NULL,                               /* pIntersectClipRect */
    NULL,                               /* pInvertRgn */
    X11DRV_LineTo,                      /* pLineTo */
    NULL,                               /* pModifyWorldTransform */
    NULL,                               /* pMoveTo */
    NULL,                               /* pOffsetClipRgn */
    NULL,                               /* pOffsetViewportOrg */
    NULL,                               /* pOffsetWindowOrg */
    X11DRV_PaintRgn,                    /* pPaintRgn */
    X11DRV_PatBlt,                      /* pPatBlt */
    X11DRV_Pie,                         /* pPie */
    NULL,                               /* pPolyBezier */
    NULL,                               /* pPolyBezierTo */
    NULL,                               /* pPolyDraw */
    X11DRV_PolyPolygon,                 /* pPolyPolygon */
    X11DRV_PolyPolyline,                /* pPolyPolyline */
    X11DRV_Polygon,                     /* pPolygon */
530
    NULL,                               /* pPolyline */
531
    NULL,                               /* pPolylineTo */
532
    X11DRV_PutImage,                    /* pPutImage */
533 534 535 536 537 538 539 540 541
    X11DRV_RealizeDefaultPalette,       /* pRealizeDefaultPalette */
    X11DRV_RealizePalette,              /* pRealizePalette */
    X11DRV_Rectangle,                   /* pRectangle */
    NULL,                               /* pResetDC */
    NULL,                               /* pRestoreDC */
    X11DRV_RoundRect,                   /* pRoundRect */
    NULL,                               /* pSaveDC */
    NULL,                               /* pScaleViewportExt */
    NULL,                               /* pScaleWindowExt */
542
    NULL,                               /* pSelectBitmap */
543 544
    X11DRV_SelectBrush,                 /* pSelectBrush */
    NULL,                               /* pSelectClipPath */
545
    X11DRV_SelectFont,                  /* pSelectFont */
546 547 548
    NULL,                               /* pSelectPalette */
    X11DRV_SelectPen,                   /* pSelectPen */
    NULL,                               /* pSetArcDirection */
549
    NULL,                               /* pSetBkColor */
550
    NULL,                               /* pSetBkMode */
551
    X11DRV_SetBoundsRect,               /* pSetBoundsRect */
552 553
    X11DRV_SetDCBrushColor,             /* pSetDCBrushColor */
    X11DRV_SetDCPenColor,               /* pSetDCPenColor */
554
    NULL,                               /* pSetDIBitsToDevice */
555 556 557 558 559 560 561 562 563 564 565 566
    X11DRV_SetDeviceClipping,           /* pSetDeviceClipping */
    X11DRV_SetDeviceGammaRamp,          /* pSetDeviceGammaRamp */
    NULL,                               /* pSetLayout */
    NULL,                               /* pSetMapMode */
    NULL,                               /* pSetMapperFlags */
    X11DRV_SetPixel,                    /* pSetPixel */
    NULL,                               /* pSetPolyFillMode */
    NULL,                               /* pSetROP2 */
    NULL,                               /* pSetRelAbs */
    NULL,                               /* pSetStretchBltMode */
    NULL,                               /* pSetTextAlign */
    NULL,                               /* pSetTextCharacterExtra */
567
    NULL,                               /* pSetTextColor */
568 569 570 571 572 573 574 575 576 577 578 579 580 581
    NULL,                               /* pSetTextJustification */
    NULL,                               /* pSetViewportExt */
    NULL,                               /* pSetViewportOrg */
    NULL,                               /* pSetWindowExt */
    NULL,                               /* pSetWindowOrg */
    NULL,                               /* pSetWorldTransform */
    NULL,                               /* pStartDoc */
    NULL,                               /* pStartPage */
    X11DRV_StretchBlt,                  /* pStretchBlt */
    NULL,                               /* pStretchDIBits */
    NULL,                               /* pStrokeAndFillPath */
    NULL,                               /* pStrokePath */
    X11DRV_UnrealizePalette,            /* pUnrealizePalette */
    NULL,                               /* pWidenPath */
582
    X11DRV_wine_get_wgl_driver,         /* wine_get_wgl_driver */
583
    GDI_PRIORITY_GRAPHICS_DRV           /* priority */
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
};


/******************************************************************************
 *      X11DRV_get_gdi_driver
 */
const struct gdi_dc_funcs * CDECL X11DRV_get_gdi_driver( unsigned int version )
{
    if (version != WINE_GDI_DRIVER_VERSION)
    {
        ERR( "version mismatch, gdi32 wants %u but winex11 has %u\n", version, WINE_GDI_DRIVER_VERSION );
        return NULL;
    }
    return &x11drv_funcs;
}