diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-24 09:54:51 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-11-25 15:16:42 +0000 |
commit | 76b3687739636d4090169e85ea604a4eeb8b6502 (patch) | |
tree | 86dbdb2b5a097c908503321ca2d285e5f4c8e1de | |
parent | 3ed69b49465f0b542d163da905dbc0864e19d5d8 (diff) |
shm: add create() function without a wlr_renderer
This allows compositors which don't use wlr_renderer to still use
wlroots' wl_shm implementation.
-rw-r--r-- | include/wlr/types/wlr_shm.h | 11 | ||||
-rw-r--r-- | types/wlr_shm.c | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/include/wlr/types/wlr_shm.h b/include/wlr/types/wlr_shm.h index ebf4015e..5816c84e 100644 --- a/include/wlr/types/wlr_shm.h +++ b/include/wlr/types/wlr_shm.h @@ -24,6 +24,17 @@ struct wlr_shm; /** * Create the wl_shm global. + * + * Compositors using struct wlr_renderer should use wlr_shm_create_with_renderer() + * instead. + */ +struct wlr_shm *wlr_shm_create(struct wl_display *display, uint32_t version, + const uint32_t *formats, size_t formats_len); + +/** + * Create the wl_shm global. + * + * The pixel formats advertised to clients are taken from the struct wlr_renderer. */ struct wlr_shm *wlr_shm_create_with_renderer(struct wl_display *display, uint32_t version, struct wlr_renderer *renderer); diff --git a/types/wlr_shm.c b/types/wlr_shm.c index 492557f3..ac41e87e 100644 --- a/types/wlr_shm.c +++ b/types/wlr_shm.c @@ -495,8 +495,8 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { free(shm); } -static struct wlr_shm *shm_create(struct wl_display *display, - uint32_t version, const uint32_t *formats, size_t formats_len) { +struct wlr_shm *wlr_shm_create(struct wl_display *display, uint32_t version, + const uint32_t *formats, size_t formats_len) { // ARGB8888 and XRGB8888 must be supported per the wl_shm spec bool has_argb8888 = false, has_xrgb8888 = false; for (size_t i = 0; i < formats_len; i++) { @@ -556,7 +556,7 @@ struct wlr_shm *wlr_shm_create_with_renderer(struct wl_display *display, return NULL; } - return shm_create(display, version, formats, formats_len); + return wlr_shm_create(display, version, formats, formats_len); } static bool shm_has_format(struct wlr_shm *shm, uint32_t shm_format) { |