From 6a35abb6ca683d35d5eefd55081c29af4893fec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 18 Mar 2020 16:52:33 +0100 Subject: [PATCH] shm: new functions: shm_cookie_*() These functions return a SHM cookie given a terminal instance. --- render.c | 4 ---- shm.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/render.c b/render.c index a18f90fe..26ca92d3 100644 --- a/render.c +++ b/render.c @@ -39,10 +39,6 @@ static struct { static void fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data); -#define shm_cookie_grid(term) ((unsigned long)((uintptr_t)term + 0)) -#define shm_cookie_search(term) ((unsigned long)((uintptr_t)term + 1)) -#define shm_cookie_csd(term, n) ((unsigned long)((uintptr_t)term + 2 + (n))) /* Should be placed last */ - struct renderer * render_init(struct fdm *fdm, struct wayland *wayl) { diff --git a/shm.h b/shm.h index 18da7a1f..eb9987ed 100644 --- a/shm.h +++ b/shm.h @@ -28,3 +28,8 @@ struct buffer *shm_get_buffer( void shm_fini(void); void shm_purge(struct wl_shm *shm, unsigned long cookie); + +struct terminal; +static inline unsigned long shm_cookie_grid(const struct terminal *term) { return (unsigned long)((uintptr_t)term + 0); } +static inline unsigned long shm_cookie_search(const struct terminal *term) { return (unsigned long)((uintptr_t)term + 1); } +static inline unsigned long shm_cookie_csd(const struct terminal *term, int n) { return (unsigned long)((uintptr_t)term + 2 + (n)); }