From 3bf156c9d9598acbee38c49d17cdb7d77e79d520 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Thu, 28 Oct 2021 13:07:25 +0100 Subject: Add basic HiDPI scaling and a subsurface. --- src/client.h | 67 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 20 deletions(-) (limited to 'src/client.h') diff --git a/src/client.h b/src/client.h index 32670af..4814fdb 100644 --- a/src/client.h +++ b/src/client.h @@ -6,38 +6,65 @@ #include "egl.h" #include "gl.h" +struct surface { + struct egl egl; + struct gl gl; + struct wl_surface *wl_surface; + int32_t width; + int32_t height; + bool redraw; +}; + +struct image { + uint8_t *buffer; + uint32_t width; + uint32_t height; +}; + +struct color { + float r; + float g; + float b; + float a; +}; + struct client_state { /* Globals */ struct wl_display *wl_display; struct wl_registry *wl_registry; - struct wl_shm *wl_shm; struct wl_compositor *wl_compositor; + struct wl_subcompositor *wl_subcompositor; struct wl_seat *wl_seat; + struct wl_output *wl_output; struct xdg_wm_base *xdg_wm_base; + + uint32_t wl_display_name; + uint32_t wl_registry_name; + uint32_t wl_compositor_name; + uint32_t wl_subcompositor_name; + uint32_t wl_seat_name; + uint32_t wl_output_name; + uint32_t xdg_wm_base_name; + /* Objects */ - struct wl_surface *wl_surface; struct wl_keyboard *wl_keyboard; - struct xdg_surface *xdg_surface; - struct xdg_toplevel *xdg_toplevel; + /* State */ - float offset; - uint32_t last_frame; - int width; - int height; bool closed; - struct egl egl; - struct gl gl; struct { - uint8_t *buffer; - uint32_t width; - uint32_t height; - } background_image; - struct color { - float r; - float g; - float b; - float a; - } background_color; + struct surface surface; + struct xdg_surface *xdg_surface; + struct xdg_toplevel *xdg_toplevel; + struct image background_image; + struct color background_color; + struct { + struct surface surface; + struct wl_subsurface *wl_subsurface; + struct image image; + } entry; + uint32_t scale; + } window; + /* Keyboard state */ struct xkb_state *xkb_state; struct xkb_context *xkb_context; -- cgit v1.2.3