- Setup libdecor, which is used automatically when available.

TODO:
 - xdg decorations
 - threading
 - thread-safe window manager
This commit is contained in:
2025-12-15 23:40:06 -05:00
parent 97f5bbfe00
commit 520a0e1363
25 changed files with 508 additions and 90 deletions

View File

@@ -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