diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 15:24:38 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-10 15:24:38 +0100 |
| commit | 88c7b19267e968760fdd350eea77b3199eafe28b (patch) | |
| tree | 06be4cfcb57766a8a1207fff62ca84dce5988589 /src/graphics.cc | |
| parent | 78bb68168b296c3d7d00b2e5b0714510b5ba3999 (diff) | |
adjusting context
Diffstat (limited to 'src/graphics.cc')
| -rw-r--r-- | src/graphics.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/graphics.cc b/src/graphics.cc index 68fee14..d9db4c8 100644 --- a/src/graphics.cc +++ b/src/graphics.cc @@ -1,16 +1,28 @@ #include "graphics.h" -#include <cstring> +#include <EGL/egl.h> #include "utils.h" +#include "wlstate.h" -enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics) { +enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics, + struct wlstate_s* state) { wayc_notnull(graphics); - memset(graphics, 0, sizeof(*graphics)); + wayc_notnull(state); + EGLDisplay display = eglGetDisplay(state->display); + if (display == EGL_NO_DISPLAY) return GRAPHICS_ERROR_DISPLAY; + + graphics->display = display; return GRAPHICS_ERROR_NONE; } void wayc_graphics_deinit(struct graphics_s* graphics) { wayc_notnull(graphics); + + if (graphics->display == nullptr) return; + + eglMakeCurrent(graphics->display, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + eglTerminate(graphics->display); } |
