feat: separate wayland implementation

This commit is contained in:
2026-02-13 13:27:06 +01:00
parent 696d55db02
commit ae9de0a22e
11 changed files with 635 additions and 470 deletions

49
include/window/wayland.h Normal file
View File

@@ -0,0 +1,49 @@
#include "window.h"
#include <wayland-client-protocol.h>
#include "xdg-shell-client-protocol.h"
class WaylandWindowImpl : public WindowImpl {
public:
WaylandWindowImpl(size_t width, size_t height);
~WaylandWindowImpl() override;
public:
bool Dispatch() override;
size_t GetWidth() const override;
size_t GetHeight() const override;
private:
static void handle_frame_callback(void *data, struct wl_callback *cb,
uint32_t time);
static void xsurface_handle_configure(void *data, struct xdg_surface *surface,
uint32_t serial);
static void xtoplevel_handle_configure(void *data,
struct xdg_toplevel *toplevel,
int32_t width, int32_t height,
struct wl_array *states);
static void xtoplevel_handle_close(void *data, struct xdg_toplevel *toplevel);
static void xtoplevel_handle_configure_bounds(void *data,
struct xdg_toplevel *toplevel,
int32_t width, int32_t height);
static void xtoplevel_handle_wm_capabilities(void *data,
struct xdg_toplevel *toplevel,
struct wl_array *capabilities);
private:
EGLSurface m_egl_surface;
EGLContext m_egl_context;
GLuint m_program;
struct wl_egl_window *m_egl_window;
struct wl_surface *m_wsurface;
struct xdg_surface *m_xsurface;
struct xdg_toplevel *m_toplevel;
struct wl_callback_listener m_frame_listener;
struct xdg_surface_listener m_xsurface_listener;
struct xdg_toplevel_listener m_toplevel_listener;
bool m_running = false;
size_t m_width, m_height;
};