diff options
| -rw-r--r-- | src/graphics.cc | 10 | ||||
| -rw-r--r-- | src/graphics.h | 20 | ||||
| -rw-r--r-- | src/utils.h | 3 |
3 files changed, 20 insertions, 13 deletions
diff --git a/src/graphics.cc b/src/graphics.cc index eecab73..0e34213 100644 --- a/src/graphics.cc +++ b/src/graphics.cc @@ -46,22 +46,22 @@ enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics, wayc_notnull(state); EGLDisplay display = eglGetDisplay(state->display); - if (display == EGL_NO_DISPLAY) return GRAPHICS_ERROR_DISPLAY; + if (display == EGL_NO_DISPLAY) return GRAPHICS_ERROR_ACQUIRE_DISPLAY; if (!eglInitialize(display, nullptr, nullptr)) { eglTerminate(display); - return GRAPHICS_ERROR_DISPLAY; + return GRAPHICS_ERROR_ACQUIRE_DISPLAY; } if (!eglBindAPI(EGL_OPENGL_API)) { eglTerminate(display); - return GRAPHICS_ERROR_BIND; + return GRAPHICS_ERROR_USE_DESKTOP; } EGLConfig config; if (!wayc_graphics_config(display, &config)) { eglTerminate(display); - return GRAPHICS_ERROR_CONFIG; + return GRAPHICS_ERROR_SELECT_CONFIG; } EGLContext context = @@ -70,7 +70,7 @@ enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics, if (context == EGL_NO_CONTEXT) { eglDestroyContext(display, context); eglTerminate(display); - return GRAPHICS_ERROR_CONTEXT; + return GRAPHICS_ERROR_CREATE_CONTEXT; } graphics->display = display; diff --git a/src/graphics.h b/src/graphics.h index d2028a7..56d16de 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -5,12 +5,12 @@ #include "utils.h" -enum graphics_error_e { +enum graphics_error_e : u8 { GRAPHICS_ERROR_NONE = 0, - GRAPHICS_ERROR_DISPLAY, - GRAPHICS_ERROR_CONFIG, - GRAPHICS_ERROR_BIND, - GRAPHICS_ERROR_CONTEXT, + GRAPHICS_ERROR_ACQUIRE_DISPLAY, + GRAPHICS_ERROR_SELECT_CONFIG, + GRAPHICS_ERROR_USE_DESKTOP, + GRAPHICS_ERROR_CREATE_CONTEXT, }; struct graphics_s { @@ -23,6 +23,12 @@ enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics, struct wlstate_s* state); void wayc_graphics_deinit(struct graphics_s* graphics); +enum renderer_error_e : u8 { + RENDERER_ERROR_NONE = 0, +}; + struct renderer_s { - wl_egl_surface_t surface; -};
\ No newline at end of file + struct graphics_s* graphics; + wl_egl_window_t window; + EGLSurface surface; +}; diff --git a/src/utils.h b/src/utils.h index a7b0702..a4467d3 100644 --- a/src/utils.h +++ b/src/utils.h @@ -2,6 +2,7 @@ #include <stdint.h> #include <wayland-client.h> +#include <wayland-egl-core.h> #include <cstdio> #include <cstdlib> @@ -37,7 +38,7 @@ typedef struct xdg_wm_base* xdg_wm_base_t; typedef struct xdg_surface* xdg_surface_t; typedef struct xdg_toplevel* xdg_toplevel_t; -typedef struct wl_egl_surface* wl_egl_surface_t; +typedef struct wl_egl_window* wl_egl_window_t; static inline u32 wayc_min(u32 a, u32 b) { return a > b ? a : b; } |
