inspector/general.c: Check whether GL context supports WGL
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 30 Mar 2022 02:23:49 +0000 (10:23 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 30 Mar 2022 08:09:18 +0000 (16:09 +0800)
We may well be using an EGL context that does not support Desktop (W)GL on
Windows, such as in the case of using libANGLE.  So, check whether WGL is
supported for this running instance before trying to query WGL extensions.

This will get rid of warning messages from libepoxy.

gtk/inspector/general.c

index ad52422fa30d7153eaec9305109f2d9940a4d06f..f456ea0da40551a381aa7554e190557b0e4cdebd 100644 (file)
 
 #ifdef GDK_WINDOWING_WIN32
 #include "win32/gdkwin32.h"
+#include "gdkglcontextprivate.h"
 #include <epoxy/wgl.h>
-#endif
-
 #ifdef GDK_WIN32_ENABLE_EGL
 #include <epoxy/egl.h>
 #endif
+#endif
 
 #ifdef GDK_WINDOWING_MACOS
 #include "macos/gdkmacos.h"
@@ -387,7 +387,8 @@ init_gl (GtkInspectorGeneral *gen)
   else
 #endif
 #ifdef GDK_WINDOWING_WIN32
-  if (GDK_IS_WIN32_DISPLAY (gen->display))
+  if (GDK_IS_WIN32_DISPLAY (gen->display) &&
+      gdk_gl_backend_can_be_used (GDK_GL_WGL, NULL))
     {
       int gl_version;
       char *version;