aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-06-30 15:27:45 -0700
committerGitHub <noreply@github.com>2018-06-30 15:27:45 -0700
commit015ebc5750c4224d4796bba0e6deeb20c8d8a777 (patch)
tree2897ecafe78c4ca7686f63a68392aed70db40e70 /include
parent02dfa9101ec7fd8328ed329d2f2faa815b1ad61c (diff)
parentcc9b198f9e4e00e59773e78ab8afe1c4c0fd1ee1 (diff)
Merge pull request #1069 from emersion/screencopy
Add wlr-screencopy-unstable-v1 support
Diffstat (limited to 'include')
-rw-r--r--include/rootston/desktop.h2
-rw-r--r--include/wlr/render/interface.h2
-rw-r--r--include/wlr/render/wlr_renderer.h9
-rw-r--r--include/wlr/types/wlr_screencopy_v1.h39
4 files changed, 50 insertions, 2 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index dfe070ca..88c5ca90 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -22,6 +22,7 @@
#include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
+#include <wlr/types/wlr_screencopy_v1.h>
#include "rootston/view.h"
#include "rootston/config.h"
#include "rootston/output.h"
@@ -54,6 +55,7 @@ struct roots_desktop {
struct wlr_linux_dmabuf *linux_dmabuf;
struct wlr_layer_shell *layer_shell;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
+ struct wlr_screencopy_manager_v1 *screencopy;
struct wl_listener new_output;
struct wl_listener layout_change;
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index fb427c89..1b138ea3 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -34,7 +34,7 @@ struct wlr_renderer_impl {
int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt,
- uint32_t stride, uint32_t width, uint32_t height,
+ uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
void *data);
bool (*format_supported)(struct wlr_renderer *renderer,
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index c715e4b0..0650bf1b 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -7,6 +7,10 @@
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_box.h>
+enum wlr_renderer_read_pixels_flags {
+ WLR_RENDERER_READ_PIXELS_Y_INVERT = 1,
+};
+
struct wlr_renderer_impl;
struct wlr_renderer {
@@ -87,9 +91,12 @@ int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *renderer, int format,
/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.
+ *
+ * If `flags` is not NULl, the caller indicates that it accepts frame flags
+ * defined in `enum wlr_renderer_read_pixels_flags`.
*/
bool wlr_renderer_read_pixels(struct wlr_renderer *r, enum wl_shm_format fmt,
- uint32_t stride, uint32_t width, uint32_t height,
+ uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data);
/**
* Checks if a format is supported.
diff --git a/include/wlr/types/wlr_screencopy_v1.h b/include/wlr/types/wlr_screencopy_v1.h
new file mode 100644
index 00000000..892687aa
--- /dev/null
+++ b/include/wlr/types/wlr_screencopy_v1.h
@@ -0,0 +1,39 @@
+#ifndef WLR_TYPES_WLR_SCREENCOPY_V1_H
+#define WLR_TYPES_WLR_SCREENCOPY_V1_H
+
+#include <wayland-server.h>
+
+struct wlr_screencopy_manager_v1 {
+ struct wl_global *global;
+ struct wl_list resources; // wl_resource
+ struct wl_list frames; // wlr_screencopy_frame_v1::link
+
+ struct wl_listener display_destroy;
+
+ void *data;
+};
+
+struct wlr_screencopy_frame_v1 {
+ struct wl_resource *resource;
+ struct wlr_screencopy_manager_v1 *manager;
+ struct wl_list link;
+
+ enum wl_shm_format format;
+ struct wlr_box box;
+ int stride;
+
+ struct wl_shm_buffer *buffer;
+ struct wl_listener buffer_destroy;
+
+ struct wlr_output *output;
+ struct wl_listener output_swap_buffers;
+
+ void *data;
+};
+
+struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create(
+ struct wl_display *display);
+void wlr_screencopy_manager_v1_destroy(
+ struct wlr_screencopy_manager_v1 *screencopy);
+
+#endif