aboutsummaryrefslogtreecommitdiff
path: root/shm.h
diff options
context:
space:
mode:
Diffstat (limited to 'shm.h')
-rw-r--r--shm.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/shm.h b/shm.h
index eb9987ed..aff53d76 100644
--- a/shm.h
+++ b/shm.h
@@ -2,6 +2,7 @@
#include <stdbool.h>
#include <stddef.h>
+#include <sys/types.h>
#include <pixman.h>
#include <wayland-client.h>
@@ -13,20 +14,35 @@ struct buffer {
int height;
int stride;
- bool purge;
-
bool busy;
- size_t size;
- void *mmapped;
+ size_t size; /* Buffer size */
+ void *mmapped; /* Raw data (TODO: rename) */
struct wl_buffer *wl_buf;
pixman_image_t *pix;
+
+ /* Internal */
+ int fd; /* memfd */
+ struct wl_shm_pool *pool;
+
+ void *real_mmapped; /* Address returned from mmap */
+ size_t mmap_size; /* Size of mmap (>= size) */
+ off_t offset; /* Offset into memfd where data begins */
+
+ bool scrollable;
+ bool purge; /* True if this buffer should be destroyed */
};
struct buffer *shm_get_buffer(
- struct wl_shm *shm, int width, int height, unsigned long cookie);
+ struct wl_shm *shm, int width, int height, unsigned long cookie, bool scrollable);
void shm_fini(void);
+void shm_set_max_pool_size(off_t max_pool_size);
+bool shm_can_scroll(const struct buffer *buf);
+bool shm_scroll(struct wl_shm *shm, struct buffer *buf, int rows,
+ int top_margin, int top_keep_rows,
+ int bottom_margin, int bottom_keep_rows);
+
void shm_purge(struct wl_shm *shm, unsigned long cookie);
struct terminal;