From a3fedae32937f8965c9905e12633fa4de0c3658e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Mar 2024 16:59:09 +0100 Subject: Draw cursor in window capture --- include/capture/xcomposite.h | 4 ++++ include/cursor.h | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 include/cursor.h (limited to 'include') diff --git a/include/capture/xcomposite.h b/include/capture/xcomposite.h index 222ff5b..2a9f3f7 100644 --- a/include/capture/xcomposite.h +++ b/include/capture/xcomposite.h @@ -6,6 +6,7 @@ #include "../vec2.h" #include "../color_conversion.h" #include "../window_texture.h" +#include "../cursor.h" typedef struct { gsr_egl *egl; @@ -33,6 +34,9 @@ typedef struct { WindowTexture window_texture; Atom net_active_window_atom; + + gsr_cursor cursor; + bool clear_next_frame; } gsr_capture_xcomposite; void gsr_capture_xcomposite_init(gsr_capture_xcomposite *self, const gsr_capture_xcomposite_params *params); diff --git a/include/cursor.h b/include/cursor.h new file mode 100644 index 0000000..b1ec6bd --- /dev/null +++ b/include/cursor.h @@ -0,0 +1,26 @@ +#ifndef GSR_CURSOR_H +#define GSR_CURSOR_H + +#include "egl.h" +#include "vec2.h" + +typedef struct { + gsr_egl *egl; + Display *display; + int x_fixes_event_base; + + unsigned int texture_id; + vec2i size; + vec2i hotspot; + vec2i position; + + bool cursor_image_set; +} gsr_cursor; + +int gsr_cursor_init(gsr_cursor *self, gsr_egl *egl, Display *display); +void gsr_cursor_deinit(gsr_cursor *self); + +void gsr_cursor_update(gsr_cursor *self, XEvent *xev); +void gsr_cursor_tick(gsr_cursor *self, Window relative_to); + +#endif /* GSR_CURSOR_H */ -- cgit v1.2.3