feat: draw frame only when needed, better main loop

This commit is contained in:
2026-02-13 18:36:29 +01:00
parent 2912ebb91c
commit 00f6036041
2 changed files with 59 additions and 51 deletions

View File

@@ -16,6 +16,9 @@ public:
size_t GetHeight() const override;
private:
void render_frame();
private: // wayland listeners
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,
@@ -32,7 +35,7 @@ private:
struct xdg_toplevel *toplevel,
struct wl_array *capabilities);
private:
private: // wayland internals
EGLSurface m_egl_surface;
EGLContext m_egl_context;
GLuint m_program;
@@ -44,9 +47,13 @@ private:
struct xdg_surface_listener m_xsurface_listener;
struct xdg_toplevel_listener m_toplevel_listener;
private:
bool m_running = false;
size_t m_width, m_height;
IFrameListener m_on_frame;
bool m_frame_cb_pending = false;
bool m_redraw_requested = false;
};