Now that we have a reasonably well working SurfaceView implementation,
it is actually cleaner to just implement GLSurfaceView the way AOSP
does. In fact, their code doesn't have any weird dependencies, and
can mostly be used as-is.
The AOSP code is pure Java, which means we had to implement some
EGL wrappers.
This change fixes issues with Wayland (it only ever worked because
the pbuffers were allocated using an XWayland EGLDisplay), and
with resizing (which we simply didn't support), all while getting
rid of quite some (arguably not very readable) LoC.
onTouchEvent was previously incorrectly handled in GLSurfaceView; move it
to View so that it works properly with any of it's descendants.
This is done by reusing the existing setOnTouchListener implementation
and changing it to use GtkEventControllerLegacy which provides motion
events.
Technically some of the code is in WrapperWidget.c since every widget
calls wrapper_widget_set_jobject and we already have related code
there.
The current implementation requires a VA-API driver and a Wayland
compositor with YUV-buffer support. GNOME supports YUV-buffers
since the recent version 45 release
A custom GtkLayoutManager is set to these objects, which calls into the
java handlers when measure or layout is requested.
Androids onMeasure method is quite different from GTKs measure method,
because Android already defines the final size during onMeasure.
Therefore, we call onMeasure from GTKs allocate callback instead of the
measure callback.
Adds a special treatment for the main Looper to not block in java code,
but instead return to glib managed thread loop. Timeouts in the mainloop
are now handled using g_timeout_add_full().
Also defer Activity construction, so that every thing is set up properly
when the constructor runs.
currently, our "not-actually-a-queue" implementation is quite ugly,
hopefully it might be possible to make it look somewhat sane while
not needing to make it as much of a queue as it is on android
NOTE: the main addition in this commit is WIP support for apps which
render on an EGL surface obtained using ANativeWindow_fromSurface
currently, this EGL surface is obtained by creating a 700x700 pixel
window with GLFW (the 700x700 size is hardcoded in several places)
and only Wayland is supported
ideally, we'd want to use a wayland subsurface to position the EGL
surface above the Surface widget it's associated with (and do
whatever for X11)