This way, we can realize it and either print success information about
it or return NULL if that fails.
This makes it more likely that we fail early, which means we can then
initialize EGL.
This refactor achieves the following:
* check GL version against proper matching context version
In particular, for legacy contexts, we now actually check
* make sure the actual version is set, even for legacy contexts
* make sure set_is_legacy() is set properly
Now that all contexts do that, insist that they keep doing it.
And because they keep doing it, we can support querying the GL version
from gdk_gl_context_get_version() without requiring the context to be
made current.
The EGL spec states:
The context returned must be the specified version, or a later
version which is backwards compatible with that version.
Even if a later version is returned, the specified version
must correspond to a defined version of the client API.
GTK has so far been relying on EGL implementations returning a
later version, because that is what Mesa does.
But ANGLE does not do that and only provides the minimum version, which
means Windows EGL has been forced to use a lower EGL version for no
reason.
So fix this and try versions in order from highest to lowest.
... to backends.
That way, frame clocks can be constructed by the backends' surface
implementations and dont need to be passed in as construct arguments.
Also add an assertion that they are indeed constructed.
That way, it doesn't need a specific init function.
Also chain up last, so that the generic initialization code in
GdkSurface::constructed can access a fully initialized macos surface.
That way, it doesn't ned a specific init function.
Also chain up last, so that the generic initialization code can access a
fully initialized wayland surface.
[30/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkmain-win32.c.obj
../gdk/win32/gdkmain-win32.c:146:1: warning: 'gdk_win32_finalize_ole' defined but not used [-Wunused-function]
146 | gdk_win32_finalize_ole (void)
| ^~~~~~~~~~~~~~~~~~~~~~
../gdk/win32/gdkmain-win32.c:113:1: warning: 'gdk_win32_finalize_com' defined but not used [-Wunused-function]
113 | gdk_win32_finalize_com (void)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
A number of warnings are produced:
[23/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkinput-dmanipulation.c.obj
../gdk/win32/gdkinput-dmanipulation.c: In function 'reset_viewport':
../gdk/win32/gdkinput-dmanipulation.c:354:11: warning: variable 'hr' set but not used [-Wunused-but-set-variable]
354 | HRESULT hr;
| ^~
Try to do something sensible instead.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>