Merge branch 'win32.egl.getter' into 'master'

Win32: Add EGLDisplay getter

See merge request GNOME/gtk!3543
This commit is contained in:
Matthias Clasen 2021-05-12 18:42:35 +00:00
commit 95f3f8f3c4
2 changed files with 34 additions and 1 deletions

View File

@ -424,7 +424,6 @@ static EGLDisplay
_gdk_win32_get_egl_display (GdkWin32Display *display)
{
EGLDisplay disp;
gboolean success = FALSE;
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
@ -555,6 +554,37 @@ _gdk_win32_display_init_gl (GdkDisplay *display)
return TRUE;
}
/**
* gdk_win32_display_get_egl_display:
* @display: (type GdkWin32Display): a Win32 display
*
* Retrieves the EGL display connection object for the given GDK display.
*
* Returns: (nullable): the EGL display
*/
gpointer
gdk_win32_display_get_egl_display (GdkDisplay *display)
{
GdkWin32Display *display_win32;
g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);
#ifdef GDK_WIN32_ENABLE_EGL
if (!_gdk_win32_display_init_gl (display))
return NULL;
display_win32 = GDK_WIN32_DISPLAY (display);
if (display_win32->have_wgl)
return NULL;
return display_win32->egl_disp;
#else
/* no EGL support */
return NULL;
#endif
}
/* Setup the legacy context after creating it */
static gboolean
_ensure_legacy_gl_context (HDC hdc,

View File

@ -104,6 +104,9 @@ void gdk_win32_display_remove_filter (GdkWin32Display
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_win32_display_get_primary_monitor (GdkDisplay *display);
GDK_AVAILABLE_IN_4_4
gpointer gdk_win32_display_get_egl_display (GdkDisplay *display);
G_END_DECLS