shm: associate a 'cookie' with each buffer

When re-using a buffer from cache, only re-use ones with a matching
cookie.

This prevents contention between multiple terminal windows.
This commit is contained in:
Daniel Eklöf 2019-11-02 00:33:37 +01:00
parent 8df82938b0
commit 00b46455a0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 22 additions and 9 deletions

5
shm.h
View file

@ -7,6 +7,8 @@
#include <wayland-client.h>
struct buffer {
unsigned long cookie;
int width;
int height;
int stride;
@ -19,5 +21,6 @@ struct buffer {
pixman_image_t *pix;
};
struct buffer *shm_get_buffer(struct wl_shm *shm, int width, int height);
struct buffer *shm_get_buffer(
struct wl_shm *shm, int width, int height, unsigned long cookie);
void shm_fini(void);