Sunshine master
Self-hosted game stream host for Moonlight.
misc.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <fcntl.h>
9#include <filesystem>
10#include <unistd.h>
11#include <vector>
12
13// local includes
14#include "src/utility.h"
15
16#ifndef DOXYGEN
17KITTY_USING_MOVE_T(file_t, int, -1, {
18 if (el >= 0) {
19 close(el);
20 }
21});
22#else
26class file_t;
27#endif
28
32enum class window_system_e {
33 NONE,
34 X11,
35 WAYLAND,
36};
37
39
40namespace dyn {
44 typedef void (*apiproc)(void);
45
46 int load(void *handle, const std::vector<std::tuple<apiproc *, const char *>> &funcs, bool strict = true);
47 void *handle(const std::vector<const char *> &libs);
48
49} // namespace dyn
50
51namespace platf {
69 int open_drm_card_fd(const std::filesystem::path &path, int flags = O_RDWR);
70} // namespace platf
int close(int __fd)
Release the native resource held by the RAII wrapper.
int load(void *handle, const std::vector< std::tuple< apiproc *, const char * > > &funcs, bool strict)
Load persisted state from its backing store.
Definition misc.cpp:135
void * handle(const std::vector< const char * > &libs)
Return the native handle owned by the wrapper.
Definition misc.cpp:109
window_system_e window_system
Window system.
Definition misc.cpp:103
window_system_e
Enumerates supported window system options.
Definition misc.h:32
@ WAYLAND
Wayland.
@ NONE
No window system.
util::safe_ptr_v2< FILE, int, fclose > file_t
Boost.Process pipe stream used for child-process I/O.
Definition process.h:38
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:48