glcontext: Deprecate gdk_gl_context_set_use_es()

Make it call gdk_gl_context_set_allowed_apis().

Also port callers to use this function.
This commit is contained in:
Benjamin Otte 2021-10-07 18:13:36 +02:00
parent c6dd3c11fa
commit 8c1f7f7531
3 changed files with 19 additions and 4 deletions

View File

@ -1246,6 +1246,8 @@ gdk_gl_context_get_allowed_apis (GdkGLContext *self)
* You should check the return value of [method@Gdk.GLContext.get_use_es]
* after calling [method@Gdk.GLContext.realize] to decide whether to use
* the OpenGL or OpenGL ES API, extensions, or shaders.
*
* Deprecated: 4.6: Use gdk_gl_context_set_allowed_apis() instead.
*/
void
gdk_gl_context_set_use_es (GdkGLContext *context,
@ -1256,8 +1258,21 @@ gdk_gl_context_set_use_es (GdkGLContext *context,
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
g_return_if_fail (!priv->realized);
if (priv->use_es != use_es)
priv->use_es = use_es;
switch (use_es)
{
case -1:
gdk_gl_context_set_allowed_apis (context, DEFAULT_ALLOWED_APIS);
break;
case 0:
gdk_gl_context_set_allowed_apis (context, GDK_GL_API_GL);
break;
case 1:
gdk_gl_context_set_allowed_apis (context, GDK_GL_API_GLES);
break;
default:
/* Just ignore the call */
break;
}
}
/**

View File

@ -95,7 +95,7 @@ void gdk_gl_context_set_allowed_apis (GdkGLContext *
GdkGLAPI apis);
GDK_AVAILABLE_IN_4_6
GdkGLAPI gdk_gl_context_get_allowed_apis (GdkGLContext *self);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_6_FOR(gdk_gl_context_set_allowed_apis)
void gdk_gl_context_set_use_es (GdkGLContext *context,
int use_es);
GDK_AVAILABLE_IN_ALL

View File

@ -319,7 +319,7 @@ gtk_gl_area_real_create_context (GtkGLArea *area)
return NULL;
}
gdk_gl_context_set_use_es (context, priv->use_es);
gdk_gl_context_set_allowed_apis (context, priv->use_es ? GDK_GL_API_GLES : GDK_GL_API_GL);
gdk_gl_context_set_required_version (context,
priv->required_gl_version / 10,
priv->required_gl_version % 10);