60 int load(library_t *
handle,
const std::vector<std::tuple<apiproc *, const char *>> &funcs,
bool strict =
true);
65 library_t *
handle(
const std::vector<const char *> &libs);
69#ifdef SUNSHINE_BUILD_PORTAL
76 bool has_saved_token();
81 void clear_saved_token();
88 std::filesystem::path get_saved_token_path();
98 std::filesystem::path get_saved_token_path_for_testing(
const std::filesystem::path &directory,
const std::string &desktop);
106 bool is_portal_service_reachable();
108 inline std::jthread xdg_worker;
109 inline std::once_flag xdg_worker_flag;
141 int open_drm_card_fd(
const std::filesystem::path &path,
int flags = O_RDWR);
152 inline void handle_pacing(std::chrono::steady_clock::time_point &next_frame, std::chrono::nanoseconds delay,
auto &logger) {
153 auto now = std::chrono::steady_clock::now();
155 if (next_frame > now) {
156 std::this_thread::sleep_until(next_frame);
157 logger.first_point(next_frame);
158 logger.second_point_now_and_log();
162 if (next_frame < now) {
163 next_frame = now + delay;
167#if defined(__linux__) && defined(SUNSHINE_BUILD_DRM)
176 void ensure_privileged_drm_worker_started();
181 void drop_drm_worker_privileges();
189 int privileged_open_drm_card_fd(
const char *path);
int close(int __fd)
Release the native resource held by the RAII wrapper.
bool sanitize_process_environment()
Remove environment variables that can load untrusted GUI modules.
Definition misc.cpp:192
int open_drm_card_fd(const std::filesystem::path &path, int flags)
Open a DRM card node, dropping implicit DRM master when possible.
Definition misc.cpp:212
int load(library_t *handle, const std::vector< std::tuple< apiproc *, const char * > > &funcs, bool strict)
Load named functions from an open shared library.
Definition misc.cpp:139
window_system_e window_system
Window system.
Definition misc.cpp:107
library_t * handle(const std::vector< const char * > &libs)
Open the first available shared library from a nonempty list.
Definition misc.cpp:113
void handle_pacing(std::chrono::steady_clock::time_point &next_frame, std::chrono::nanoseconds delay, auto &logger)
Generic frame pacing logic for Linux capture methods.
Definition misc.h:152
void(*)(void) apiproc
Generic GLX procedure pointer returned by the loader.
Definition misc.h:51
window_system_e
Enumerates supported window system options.
Definition misc.h:34
@ X11
X11.
Definition misc.h:36
util::safe_ptr_v2< FILE, int, &fclose > file_t
Boost.Process pipe stream used for child-process I/O.
Definition process.h:36
Declarations for utility functions.
#define KITTY_USING_MOVE_T(move_t, t, init_val, z)
Define a move-only RAII wrapper with caller-provided initial value and destructor body.
Definition utility.h:51