diff options
author | Benjamin Otte <otte@redhat.com> | 2021-08-24 21:27:49 +0200 |
---|---|---|
committer | Benjamin Otte <otte.benjamin@googlemail.com> | 2021-08-24 19:55:22 +0000 |
commit | 95931a7e6c5c3e8cf9d410863c4d7b58e020af1b (patch) | |
tree | d4e695662a53733a2750d25ff5a17ab478f71274 | |
parent | d9daaed43fbbf47a0afd65bd636d3e4e50e7a33b (diff) | |
download | gtk+-wip/otte/for-master.tar.gz |
wayland: Better error on eglGetDisplay() failurewip/otte/for-master
Goals:
1. Provide as much information as possible in the error message, so
users can try to fix their system themselves.
2. Try to formulate the error message in a way that explains that this
is not something GTK can fix, but a lower layer problem.
Related: #4193
-rw-r--r-- | gdk/wayland/gdkglcontext-wayland.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c index 7e6dd07225..2cf7285fe5 100644 --- a/gdk/wayland/gdkglcontext-wayland.c +++ b/gdk/wayland/gdkglcontext-wayland.c @@ -32,6 +32,7 @@ #include "gdkprivate-wayland.h" #include "gdkinternals.h" +#include "gdk-private.h" #include "gdksurfaceprivate.h" #include "gdkprofilerprivate.h" @@ -474,14 +475,28 @@ gdk_wayland_display_init_gl (GdkDisplay *display, G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME; G_GNUC_UNUSED gint64 start_time2; + if (!epoxy_has_egl ()) + { + gboolean sandboxed = gdk_running_in_sandbox (); + + g_set_error_literal (error, GDK_GL_ERROR, + GDK_GL_ERROR_NOT_AVAILABLE, + sandboxed ? _("libEGL not available in this sandbox") + : _("libEGL not available")); + return NULL; + } + start_time2 = GDK_PROFILER_CURRENT_TIME; dpy = get_egl_display (display_wayland); gdk_profiler_end_mark (start_time, "get_egl_display", NULL); if (dpy == NULL) { + gboolean sandboxed = gdk_running_in_sandbox (); + g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE, - _("Failed to create EGL display")); + sandboxed ? _("Sandbox does not provide an OpenGL implementation") + : _("No OpenGL implementation available")); return NULL; } |