- Setup libdecor, which is used automatically when available.
TODO: - xdg decorations - threading - thread-safe window manager
This commit is contained in:
@@ -38,7 +38,13 @@ static const cstring& egl_translate_type(EGLint type) {
|
||||
}
|
||||
|
||||
eglcontext::eglcontext(display_server* display)
|
||||
: glcontext(display) {
|
||||
: glcontext(display)
|
||||
, _egldisplay(nullptr)
|
||||
, _eglcontext(nullptr)
|
||||
, _eglconfig(nullptr)
|
||||
, _eglvmajor(0)
|
||||
, _eglvminor(0)
|
||||
, _eglctype(0){
|
||||
|
||||
EGLint config_attrs[] = {
|
||||
EGL_SURFACE_TYPE,
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#include <fennec/core/logger.h>
|
||||
#include <fennec/platform/opengl/egl/context.h>
|
||||
#include <fennec/platform/opengl/egl/surface.h>
|
||||
|
||||
namespace fennec {
|
||||
|
||||
eglsurface::eglsurface(fennec::window* win, eglcontext* ctx, EGLNativeWindowType eglwindow)
|
||||
eglsurface::eglsurface(fennec::window* win, eglcontext* ctx, void* eglwindow)
|
||||
: gfxsurface(win, ctx)
|
||||
, _eglwindow(eglwindow)
|
||||
, _eglsurface(nullptr) {
|
||||
@@ -31,25 +32,32 @@ eglsurface::eglsurface(fennec::window* win, eglcontext* ctx, EGLNativeWindowType
|
||||
_eglsurface = eglCreateWindowSurface(
|
||||
ctx->_egldisplay,
|
||||
ctx->_eglconfig,
|
||||
_eglwindow,
|
||||
reinterpret_cast<EGLNativeWindowType>(_eglwindow),
|
||||
nullptr
|
||||
);
|
||||
|
||||
if (not _eglsurface) {
|
||||
int32_t err = eglGetError();
|
||||
logger::log(format("EGL error: {}", eglErrorString(err)));
|
||||
}
|
||||
assertf(_eglsurface, "Failed to create EGL surface!");
|
||||
|
||||
eglsurface::make_current();
|
||||
}
|
||||
|
||||
eglsurface::~eglsurface() {
|
||||
eglcontext* ctx = static_cast<eglcontext*>(context);
|
||||
eglDestroySurface(ctx->_egldisplay, _eglsurface);
|
||||
assertf(eglDestroySurface(ctx->_egldisplay, _eglsurface), "Error destroying EGL surface!");
|
||||
}
|
||||
|
||||
void eglsurface::make_current() {
|
||||
eglcontext* ctx = static_cast<eglcontext*>(context);
|
||||
eglMakeCurrent(ctx->_egldisplay, _eglsurface, _eglsurface, ctx->_eglcontext);
|
||||
assertf(eglMakeCurrent(ctx->_egldisplay, _eglsurface, _eglsurface, ctx->_eglcontext), "Error setting the current surface!");
|
||||
}
|
||||
|
||||
void eglsurface::swap() {
|
||||
eglcontext* ctx = static_cast<eglcontext*>(context);
|
||||
eglSwapBuffers(ctx->_egldisplay, _eglsurface);
|
||||
assertf(eglSwapBuffers(ctx->_egldisplay, _eglsurface), "Error swapping surface buffers!");
|
||||
}
|
||||
|
||||
} // fennec
|
||||
Reference in New Issue
Block a user