From da4925b23e7ebd6df35cdb0ba39ac8cc1701a102 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 16 Aug 2024 19:37:00 +0200 Subject: Allow capture of external monitors on a laptop with dedicated gpu (prime) on x11, fix cursor not visible on some wayland compositors (hyprland) with multiple monitors --- include/egl.h | 17 +++++++++++++++++ include/utils.h | 6 ++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/egl.h b/include/egl.h index 6a44d7e..720be35 100644 --- a/include/egl.h +++ b/include/egl.h @@ -150,9 +150,19 @@ typedef int (*FUNC_eglQueryDmaBufModifiersEXT)(EGLDisplay dpy, int32_t format, i #define GSR_MAX_OUTPUTS 32 +typedef struct { + char *name; + vec2i pos; + vec2i size; + uint32_t connector_id; + gsr_monitor_rotation rotation; +} gsr_x11_output; + typedef struct { Display *dpy; Window window; + gsr_x11_output outputs[GSR_MAX_OUTPUTS]; + int num_outputs; } gsr_x11; typedef struct { @@ -179,6 +189,11 @@ typedef enum { GSR_GL_CONTEXT_TYPE_GLX } gsr_gl_context_type; +typedef enum { + GSR_DISPLAY_SERVER_X11, + GSR_DISPLAY_SERVER_WAYLAND +} gsr_display_server; + typedef struct gsr_egl gsr_egl; struct gsr_egl { void *egl_library; @@ -302,4 +317,6 @@ void gsr_egl_update(gsr_egl *self); /* Does opengl swap with egl or glx, depending on which one is active */ void gsr_egl_swap_buffers(gsr_egl *self); +gsr_display_server gsr_egl_get_display_server(const gsr_egl *egl); + #endif /* GSR_EGL_H */ diff --git a/include/utils.h b/include/utils.h index 3921dad..cadde8f 100644 --- a/include/utils.h +++ b/include/utils.h @@ -7,14 +7,11 @@ #include #include -typedef struct _XRRCrtcInfo XRRCrtcInfo; - typedef struct { const char *name; int name_len; vec2i pos; vec2i size; - XRRCrtcInfo *crt_info; /* Only on x11 */ uint32_t connector_id; /* Only on x11 and drm */ gsr_monitor_rotation rotation; /* Only on x11 and wayland */ uint32_t monitor_identifier; /* Only on drm and wayland */ @@ -30,7 +27,8 @@ typedef struct { double clock_get_monotonic_seconds(void); typedef void (*active_monitor_callback)(const gsr_monitor *monitor, void *userdata); -void for_each_active_monitor_output_x11(Display *display, active_monitor_callback callback, void *userdata); +void for_each_active_monitor_output_x11_not_cached(Display *display, active_monitor_callback callback, void *userdata); +void for_each_active_monitor_output_x11(const gsr_egl *egl, active_monitor_callback callback, void *userdata); void for_each_active_monitor_output(const gsr_egl *egl, gsr_connection_type connection_type, active_monitor_callback callback, void *userdata); bool get_monitor_by_name(const gsr_egl *egl, gsr_connection_type connection_type, const char *name, gsr_monitor *monitor); gsr_monitor_rotation drm_monitor_get_display_server_rotation(const gsr_egl *egl, const gsr_monitor *monitor); -- cgit v1.2.3