From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/Makefile.in | 1 + dlls/win32u/dc.c | 32 --------------------- dlls/win32u/opengl.c | 63 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 dlls/win32u/opengl.c
diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in index c64f6bc6fb9..b849f0c202d 100644 --- a/dlls/win32u/Makefile.in +++ b/dlls/win32u/Makefile.in @@ -39,6 +39,7 @@ SOURCES = \ mapping.c \ menu.c \ message.c \ + opengl.c \ opentype.c \ painting.c \ palette.c \ diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 3f6a501041a..a2f76ffec71 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -36,8 +36,6 @@ #include "winternl.h" #include "winerror.h" #include "ntgdi_private.h" -#include "wine/wgl.h" -#include "wine/wgl_driver.h"
#include "wine/debug.h"
@@ -1473,33 +1471,3 @@ BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WC release_dc_ptr(dc); return ret; } - -/*********************************************************************** - * __wine_get_wgl_driver (win32u.@) - */ -const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) -{ - BOOL is_display, is_memdc; - DC *dc; - - if (version != WINE_WGL_DRIVER_VERSION) - { - ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n", - version, WINE_WGL_DRIVER_VERSION ); - return NULL; - } - - if (!(dc = get_dc_obj( hdc ))) return NULL; - if (dc->attr->disabled) - { - GDI_ReleaseObj( hdc ); - return NULL; - } - is_display = dc->is_display; - is_memdc = get_gdi_object_type( hdc ) == NTGDI_OBJ_MEMDC; - GDI_ReleaseObj( hdc ); - - if (is_display) return user_driver->pwine_get_wgl_driver( version ); - if (is_memdc) return dibdrv_get_wgl_driver(); - return (void *)-1; -} diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c new file mode 100644 index 00000000000..0c4b77876d8 --- /dev/null +++ b/dlls/win32u/opengl.c @@ -0,0 +1,63 @@ +/* + * Copyright 2025 Rémi Bernon for CodeWeavers + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include <pthread.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "ntgdi_private.h" +#include "win32u_private.h" +#include "ntuser_private.h" + +#include "wine/wgl.h" +#include "wine/wgl_driver.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wgl); + +/*********************************************************************** + * __wine_get_wgl_driver (win32u.@) + */ +const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) +{ + DWORD is_disabled, is_display, is_memdc; + DC *dc; + + if (version != WINE_WGL_DRIVER_VERSION) + { + ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n", + version, WINE_WGL_DRIVER_VERSION ); + return NULL; + } + + if (!(dc = get_dc_ptr( hdc ))) return NULL; + is_memdc = get_gdi_object_type( hdc ) == NTGDI_OBJ_MEMDC; + is_display = dc->is_display; + is_disabled = dc->attr->disabled; + release_dc_ptr( dc ); + + if (is_disabled) return NULL; + if (is_display) return user_driver->pwine_get_wgl_driver( version ); + if (is_memdc) return dibdrv_get_wgl_driver(); + return (void *)-1; +}