Module: wine Branch: master Commit: e059d565ab192c76c0a150ea7b30b65d624b3713 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e059d565ab192c76c0a150ea7b...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jun 28 16:25:22 2012 +0200
gdi32: Add a null WGL driver.
---
dlls/gdi32/driver.c | 71 ++++++++++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/opengl.c | 7 +++- 2 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 6bea480..ae774b0 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -50,6 +50,7 @@ static struct list drivers = LIST_INIT( drivers ); static struct graphics_driver *display_driver;
const struct gdi_dc_funcs *font_driver = NULL; +static const struct wgl_funcs null_wgl_driver;
static CRITICAL_SECTION driver_section; static CRITICAL_SECTION_DEBUG critsect_debug = @@ -386,6 +387,11 @@ static UINT nulldrv_GetOutlineTextMetrics( PHYSDEV dev, UINT size, LPOUTLINETEXT return 0; }
+static INT nulldrv_GetPixelFormat( HDC hdc ) +{ + return 0; +} + static UINT nulldrv_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, PALETTEENTRY *entries ) { return 0; @@ -660,11 +666,61 @@ static BOOL nulldrv_UnrealizePalette( HPALETTE palette ) return FALSE; }
-static const struct wgl_funcs *nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version ) +static BOOL nulldrv_wglCopyContext( HGLRC src, HGLRC dst, UINT mask ) +{ + return FALSE; +} + +static HGLRC nulldrv_wglCreateContext( HDC hdc ) +{ + return 0; +} + +static HGLRC nulldrv_wglCreateContextAttribsARB( HDC hdc, HGLRC share_ctx, const int *attribs ) +{ + return 0; +} + +static BOOL nulldrv_wglDeleteContext( HGLRC hglrc ) +{ + return FALSE; +} + +static HDC nulldrv_wglGetCurrentDC(void) +{ + return 0; +} + +static PROC nulldrv_wglGetProcAddress( LPCSTR name ) { return NULL; }
+static BOOL nulldrv_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC hglrc ) +{ + return FALSE; +} + +static BOOL nulldrv_wglMakeCurrent( HDC hdc, HGLRC hglrc ) +{ + return FALSE; +} + +static BOOL nulldrv_wglShareLists( HGLRC org, HGLRC dst ) +{ + return FALSE; +} + +static const struct wgl_funcs *nulldrv_wine_get_wgl_driver( PHYSDEV dev, UINT version ) +{ + if (version != WINE_GDI_DRIVER_VERSION) + { + ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_GDI_DRIVER_VERSION ); + return NULL; + } + return &null_wgl_driver; +} + const struct gdi_dc_funcs null_driver = { nulldrv_AbortDoc, /* pAbortDoc */ @@ -801,6 +857,19 @@ const struct gdi_dc_funcs null_driver = GDI_PRIORITY_NULL_DRV /* priority */ };
+static const struct wgl_funcs null_wgl_driver = +{ + nulldrv_GetPixelFormat, /* p_GetPixelFormat */ + nulldrv_wglCopyContext, /* p_wglCopyContext */ + nulldrv_wglCreateContext, /* p_wglCreateContext */ + nulldrv_wglCreateContextAttribsARB, /* p_wglCreateContextAttribsARB */ + nulldrv_wglDeleteContext, /* p_wglDeleteContext */ + nulldrv_wglGetCurrentDC, /* p_wglGetCurrentDC */ + nulldrv_wglGetProcAddress, /* p_wglGetProcAddress */ + nulldrv_wglMakeContextCurrentARB, /* p_wglMakeContextCurrentARB */ + nulldrv_wglMakeCurrent, /* p_wglMakeCurrent */ + nulldrv_wglShareLists, /* p_wglShareLists */ +};
/***************************************************************************** * DRIVER_GetDriverName diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index eb8b79d..952fca9 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -3444,8 +3444,11 @@ static const struct wgl_funcs * glxdrv_wine_get_wgl_driver( PHYSDEV dev, UINT ve ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_GDI_DRIVER_VERSION ); return NULL; } - if (!has_opengl()) return NULL; - return &glxdrv_wgl_funcs; + + if (has_opengl()) return &glxdrv_wgl_funcs; + + dev = GET_NEXT_PHYSDEV( dev, wine_get_wgl_driver ); + return dev->funcs->wine_get_wgl_driver( dev, version ); }
static const struct gdi_dc_funcs glxdrv_funcs =