From de019711d19f566aee16dd083aba297b28e0854b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 21 Jul 2023 02:49:02 +0200 Subject: Support wlroots screen capture, which doesn't require kms root access and also captures cursor --- include/egl.h | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/egl.h b/include/egl.h index 920e0f0..58c1861 100644 --- a/include/egl.h +++ b/include/egl.h @@ -7,6 +7,7 @@ #include #include #include +#include "vec2.h" #ifdef _WIN64 typedef signed long long int khronos_intptr_t; @@ -105,6 +106,35 @@ typedef unsigned int (*FUNC_eglExportDMABUFImageQueryMESA)(EGLDisplay dpy, EGLIm typedef unsigned int (*FUNC_eglExportDMABUFImageMESA)(EGLDisplay dpy, EGLImageKHR image, int *fds, int32_t *strides, int32_t *offsets); typedef void (*FUNC_glEGLImageTargetTexture2DOES)(unsigned int target, GLeglImageOES image); +#define GSR_MAX_OUTPUTS 32 + +typedef struct { + Display *dpy; + Window window; +} gsr_x11; + +typedef struct { + uint32_t wl_name; + void *output; + vec2i pos; + vec2i size; + char *name; +} gsr_wayland_output; + +typedef struct { + void *dpy; + void *window; + void *registry; + void *surface; + void *compositor; + void *export_manager; + void *current_frame; + void *frame_callback; + gsr_wayland_output outputs[GSR_MAX_OUTPUTS]; + int num_outputs; + gsr_wayland_output *output_to_capture; +} gsr_wayland; + typedef struct { void *egl_library; void *gl_library; @@ -113,14 +143,8 @@ typedef struct { EGLSurface egl_surface; EGLContext egl_context; - Display *x11_dpy; - Window x11_window; - - void *wayland_dpy; - void *wayland_window; - void *wayland_registry; - void *wayland_surface; - void *wayland_compositor; + gsr_x11 x11; + gsr_wayland wayland; int fd; uint32_t width; @@ -204,6 +228,9 @@ typedef struct { bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland); void gsr_egl_unload(gsr_egl *self); +/* wayland protocol capture, does not include kms capture */ +bool gsr_egl_supports_wayland_capture(gsr_egl *self); +bool gsr_egl_start_capture(gsr_egl *self, const char *monitor_to_capture); void gsr_egl_update(gsr_egl *self); void gsr_egl_cleanup_frame(gsr_egl *self); -- cgit v1.2.3