glcontext: Respect ES API when getting gl version from shared context
On context realizations where the shared context has been already realized, the GL version is taken directly from it instead of using the default values. That can lead to errors when the shared context has been realized with GL ES, but the api is not respected. In that case, the context will by default attempt to be realized with GL but the GL ES version, creating an unexpected discrepancy and leading to creating contexts unsuppoted by GTK. For example, in the PinePhone GL 3.2 is unsupported, leading to the creation of a shared GL ES 2.0 context by default. Subsequent contexts will respect the 2.0 version, but not the ES, attempting to create a GL 2.0 context. A GL 2.0 context is both unsupported by GTK and buggy on the PinePhone, leading to crashes after the realization of the context. Respecting the ES API when it is allowed by the context fixes both the creation of an unsupported context and crashes experimented on the PinePhone.
Closes #4763 (closed)
Closes !4570 (closed)