2018-12-12 22:29:57 +01:00
|
|
|
#ifndef XDPW_H
|
|
|
|
#define XDPW_H
|
|
|
|
|
|
|
|
#include <wayland-client.h>
|
2020-12-21 12:23:14 +01:00
|
|
|
#ifdef HAVE_LIBSYSTEMD
|
2018-12-12 22:29:57 +01:00
|
|
|
#include <systemd/sd-bus.h>
|
2020-12-21 12:23:14 +01:00
|
|
|
#elif HAVE_LIBELOGIND
|
2020-03-06 20:41:53 +01:00
|
|
|
#include <elogind/sd-bus.h>
|
2020-12-21 12:25:47 +01:00
|
|
|
#elif HAVE_BASU
|
|
|
|
#include <basu/sd-bus.h>
|
2020-03-06 20:41:53 +01:00
|
|
|
#endif
|
2020-04-16 10:21:55 +02:00
|
|
|
|
|
|
|
#include "screencast_common.h"
|
2022-08-22 23:15:02 +02:00
|
|
|
#include "screenshot_common.h"
|
2021-03-03 10:29:56 +01:00
|
|
|
#include "config.h"
|
2020-03-10 20:46:37 +01:00
|
|
|
|
|
|
|
struct xdpw_state {
|
2020-04-16 10:21:55 +02:00
|
|
|
struct wl_list xdpw_sessions;
|
2020-03-10 20:46:37 +01:00
|
|
|
sd_bus *bus;
|
|
|
|
struct wl_display *wl_display;
|
|
|
|
struct pw_loop *pw_loop;
|
2020-04-16 10:21:55 +02:00
|
|
|
struct xdpw_screencast_context screencast;
|
|
|
|
uint32_t screencast_source_types; // bitfield of enum source_types
|
|
|
|
uint32_t screencast_cursor_modes; // bitfield of enum cursor_modes
|
|
|
|
uint32_t screencast_version;
|
2022-08-22 23:15:02 +02:00
|
|
|
uint32_t screenshot_version;
|
2021-03-03 10:29:56 +01:00
|
|
|
struct xdpw_config *config;
|
2020-12-23 19:47:10 +01:00
|
|
|
int timer_poll_fd;
|
|
|
|
struct wl_list timers;
|
|
|
|
struct xdpw_timer *next_timer;
|
2020-03-10 20:46:37 +01:00
|
|
|
};
|
2018-12-12 22:29:57 +01:00
|
|
|
|
2018-12-13 18:03:44 +01:00
|
|
|
struct xdpw_request {
|
|
|
|
sd_bus_slot *slot;
|
|
|
|
};
|
|
|
|
|
2019-12-09 12:55:12 +01:00
|
|
|
struct xdpw_session {
|
2020-04-16 10:21:55 +02:00
|
|
|
struct wl_list link;
|
2019-12-09 12:55:12 +01:00
|
|
|
sd_bus_slot *slot;
|
2020-04-16 10:21:55 +02:00
|
|
|
char *session_handle;
|
|
|
|
struct xdpw_screencast_instance *screencast_instance;
|
2019-12-09 12:55:12 +01:00
|
|
|
};
|
|
|
|
|
2020-12-23 19:47:10 +01:00
|
|
|
typedef void (*xdpw_event_loop_timer_func_t)(void *data);
|
|
|
|
|
|
|
|
struct xdpw_timer {
|
|
|
|
struct xdpw_state *state;
|
|
|
|
xdpw_event_loop_timer_func_t func;
|
|
|
|
void *user_data;
|
|
|
|
struct timespec at;
|
|
|
|
struct wl_list link; // xdpw_state::timers
|
|
|
|
};
|
|
|
|
|
2019-07-24 16:59:40 +02:00
|
|
|
enum {
|
|
|
|
PORTAL_RESPONSE_SUCCESS = 0,
|
|
|
|
PORTAL_RESPONSE_CANCELLED = 1,
|
|
|
|
PORTAL_RESPONSE_ENDED = 2
|
|
|
|
};
|
|
|
|
|
2020-04-16 10:21:55 +02:00
|
|
|
int xdpw_screenshot_init(struct xdpw_state *state);
|
2021-03-03 10:29:56 +01:00
|
|
|
int xdpw_screencast_init(struct xdpw_state *state);
|
2018-12-12 22:29:57 +01:00
|
|
|
|
2020-04-16 10:21:55 +02:00
|
|
|
struct xdpw_request *xdpw_request_create(sd_bus *bus, const char *object_path);
|
|
|
|
void xdpw_request_destroy(struct xdpw_request *req);
|
2018-12-13 18:03:44 +01:00
|
|
|
|
2020-04-16 10:21:55 +02:00
|
|
|
struct xdpw_session *xdpw_session_create(struct xdpw_state *state, sd_bus *bus, char *object_path);
|
|
|
|
void xdpw_session_destroy(struct xdpw_session *req);
|
2019-12-09 12:55:12 +01:00
|
|
|
|
2020-12-23 19:47:10 +01:00
|
|
|
struct xdpw_timer *xdpw_add_timer(struct xdpw_state *state,
|
|
|
|
uint64_t delay_ns, xdpw_event_loop_timer_func_t func, void *data);
|
|
|
|
|
|
|
|
void xdpw_destroy_timer(struct xdpw_timer *timer);
|
|
|
|
|
2018-12-12 22:29:57 +01:00
|
|
|
#endif
|