wvkbd

git clone https://git.tarina.org/wvkbd
Log | Files | Refs | README | LICENSE

commit b65ea995f10e75fa6c499723af68f24bfc0c2334
parent 283a7589100c004d8ffbbbdb42bcd045747c2cda
Author: Stacy Harper <contact@stacyharper.net>
Date:   Wed, 25 Aug 2021 22:06:51 +0200

Simplify ctx initializer

Diffstat:
Mdrw.c | 12------------
Mdrw.h | 2--
Mmain.c | 7+++++--
3 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drw.c b/drw.c @@ -6,18 +6,6 @@ #include "shm_open.h" void -drw_init(struct drw *d, const char *fc_pattern, void *shm) { - d->shm = shm; - d->font_description = pango_font_description_from_string(fc_pattern); -} - -void -drwsurf_init(struct drw *d, struct drwsurf *ds, struct wl_surface *surf) { - ds->ctx = d; - ds->surf = surf; -} - -void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, uint32_t s) { if (ds->buf) { munmap(ds->pool_data, ds->size); diff --git a/drw.h b/drw.h @@ -8,8 +8,6 @@ struct drw; struct drwsurf; struct kbd; -void drw_init(struct drw *d, const char *fc_pattern, void *iface); -void drwsurf_init(struct drw *d, struct drwsurf *ds, struct wl_surface *surf); void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, uint32_t s); void drwsurf_flip(struct drwsurf *ds); diff --git a/main.c b/main.c @@ -438,8 +438,11 @@ main(int argc, char **argv) { /* create surface */ wl_surface = wl_compositor_create_surface(compositor); - drw_init(&draw_ctx, fc_font_pattern, shm); - drwsurf_init(&draw_ctx, &draw_surf, wl_surface); + + draw_ctx.shm = shm; + draw_ctx.font_description = pango_font_description_from_string(fc_font_pattern); + draw_surf.ctx = &draw_ctx; + draw_surf.surf = wl_surface; layer_surface = zwlr_layer_shell_v1_get_layer_surface( layer_shell, draw_surf.surf, wl_output, layer, namespace);