docs: improvements to source code documentation (#1236)

This commit is contained in:
ReenigneArcher
2023-05-07 15:01:44 -04:00
committed by GitHub
parent 97f18d6353
commit 979f7f4e60
71 changed files with 1284 additions and 1430 deletions

View File

@@ -1,6 +1,3 @@
//
// Created by loki on 5/16/21.
//
#include <bitset>
#include <sstream>

View File

@@ -30,7 +30,7 @@ using namespace std::literals;
using namespace std::literals;
//////////////////// Special desclarations
// Special declarations
/**
* NVCC tends to have problems with standard headers.
* Don't include common.h, instead use bare minimum
@@ -78,7 +78,7 @@ static_assert(sizeof(video::color_t) == sizeof(video::color_extern_t), "color ma
extern color_t colors[6];
} // namespace video
//////////////////// End special declarations
// End special declarations
namespace cuda {
auto constexpr INVALID_TEXTURE = std::numeric_limits<cudaTextureObject_t>::max();

View File

@@ -1,5 +1,6 @@
#if !defined(SUNSHINE_PLATFORM_CUDA_H) && defined(SUNSHINE_BUILD_CUDA)
#define SUNSHINE_PLATFORM_CUDA_H
#pragma once
#if defined(SUNSHINE_BUILD_CUDA)
#include <cstdint>
#include <memory>
@@ -89,11 +90,11 @@ namespace cuda {
sws_t(int in_width, int in_height, int out_width, int out_height, int pitch, int threadsPerBlock, ptr_t &&color_matrix);
/**
* in_width, in_height -- The width and height of the captured image in pixels
* out_width, out_height -- the width and height of the NV12 image in pixels
*
* pitch -- The size of a single row of pixels in bytes
*/
* in_width, in_height -- The width and height of the captured image in pixels
* out_width, out_height -- the width and height of the NV12 image in pixels
*
* pitch -- The size of a single row of pixels in bytes
*/
static std::optional<sws_t>
make(int in_width, int in_height, int out_width, int out_height, int pitch);

View File

@@ -1,5 +1,4 @@
#ifndef SUNSHINE_PLATFORM_LINUX_OPENGL_H
#define SUNSHINE_PLATFORM_LINUX_OPENGL_H
#pragma once
#include <optional>
#include <string_view>
@@ -94,8 +93,8 @@ namespace gl {
}
/**
* Copies a part of the framebuffer to texture
*/
* Copies a part of the framebuffer to texture
*/
void
copy(int id, int texture, int offset_x, int offset_y, int width, int height);
};
@@ -352,5 +351,3 @@ namespace egl {
bool
fail();
} // namespace egl
#endif

View File

@@ -143,9 +143,9 @@ namespace platf {
constexpr auto UNKNOWN = 0;
/**
* @brief Initializes the keycode constants for translating
* moonlight keycodes to linux/X11 keycodes
*/
* @brief Initializes the keycode constants for translating
* moonlight keycodes to linux/X11 keycodes.
*/
static constexpr std::array<keycode_t, 0xE3>
init_keycodes() {
std::array<keycode_t, 0xE3> keycodes {};
@@ -1047,16 +1047,16 @@ namespace platf {
}
/**
* @brief XTest absolute mouse move.
* @param input The input_t instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* x_abs_mouse(input, 0, 0);
* ```
*/
* @brief XTest absolute mouse move.
* @param input The input_t instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* x_abs_mouse(input, 0, 0);
* ```
*/
static void
x_abs_mouse(input_t &input, float x, float y) {
#ifdef SUNSHINE_BUILD_X11
@@ -1070,17 +1070,17 @@ namespace platf {
}
/**
* @brief Absolute mouse move.
* @param input The input_t instance to use.
* @param touch_port The touch_port instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* abs_mouse(input, touch_port, 0, 0);
* ```
*/
* @brief Absolute mouse move.
* @param input The input_t instance to use.
* @param touch_port The touch_port instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* abs_mouse(input, touch_port, 0, 0);
* ```
*/
void
abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) {
auto touchscreen = ((input_raw_t *) input.get())->touch_input.get();
@@ -1101,16 +1101,16 @@ namespace platf {
}
/**
* @brief XTest relative mouse move.
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* x_move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
*/
* @brief XTest relative mouse move.
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* x_move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
*/
static void
x_move_mouse(input_t &input, int deltaX, int deltaY) {
#ifdef SUNSHINE_BUILD_X11
@@ -1124,16 +1124,16 @@ namespace platf {
}
/**
* @brief Relative mouse move.
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
*/
* @brief Relative mouse move.
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
*/
void
move_mouse(input_t &input, int deltaX, int deltaY) {
auto mouse = ((input_raw_t *) input.get())->mouse_input.get();
@@ -1154,16 +1154,16 @@ namespace platf {
}
/**
* @brief XTest mouse button press/release.
* @param input The input_t instance to use.
* @param button Which mouse button to emulate.
* @param release Whether the event was a press (false) or a release (true)
*
* EXAMPLES:
* ```cpp
* x_button_mouse(input, 1, false); // Press left mouse button
* ```
*/
* @brief XTest mouse button press/release.
* @param input The input_t instance to use.
* @param button Which mouse button to emulate.
* @param release Whether the event was a press (false) or a release (true)
*
* EXAMPLES:
* ```cpp
* x_button_mouse(input, 1, false); // Press left mouse button
* ```
*/
static void
x_button_mouse(input_t &input, int button, bool release) {
#ifdef SUNSHINE_BUILD_X11
@@ -1197,16 +1197,16 @@ namespace platf {
}
/**
* @brief Mouse button press/release.
* @param input The input_t instance to use.
* @param button Which mouse button to emulate.
* @param release Whether the event was a press (false) or a release (true)
*
* EXAMPLES:
* ```cpp
* button_mouse(input, 1, false); // Press left mouse button
* ```
*/
* @brief Mouse button press/release.
* @param input The input_t instance to use.
* @param button Which mouse button to emulate.
* @param release Whether the event was a press (false) or a release (true)
*
* EXAMPLES:
* ```cpp
* button_mouse(input, 1, false); // Press left mouse button
* ```
*/
void
button_mouse(input_t &input, int button, bool release) {
auto mouse = ((input_raw_t *) input.get())->mouse_input.get();
@@ -1245,17 +1245,17 @@ namespace platf {
}
/**
* @brief XTest mouse scroll.
* @param input The input_t instance to use.
* @param distance How far to scroll
* @param button_pos Which mouse button to emulate for positive scroll.
* @param button_neg Which mouse button to emulate for negative scroll.
*
* EXAMPLES:
* ```cpp
* x_scroll(input, 10, 4, 5);
* ```
*/
* @brief XTest mouse scroll.
* @param input The input_t instance to use.
* @param distance How far to scroll.
* @param button_pos Which mouse button to emulate for positive scroll.
* @param button_neg Which mouse button to emulate for negative scroll.
*
* EXAMPLES:
* ```cpp
* x_scroll(input, 10, 4, 5);
* ```
*/
static void
x_scroll(input_t &input, int distance, int button_pos, int button_neg) {
#ifdef SUNSHINE_BUILD_X11
@@ -1274,15 +1274,15 @@ namespace platf {
}
/**
* @brief Vertical mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll
*
* EXAMPLES:
* ```cpp
* scroll(input, 1200);
* ```
*/
* @brief Vertical mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll.
*
* EXAMPLES:
* ```cpp
* scroll(input, 1200);
* ```
*/
void
scroll(input_t &input, int high_res_distance) {
int distance = high_res_distance / 120;
@@ -1299,15 +1299,15 @@ namespace platf {
}
/**
* @brief Horizontal mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll
*
* EXAMPLES:
* ```cpp
* hscroll(input, 1200);
* ```
*/
* @brief Horizontal mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll.
*
* EXAMPLES:
* ```cpp
* hscroll(input, 1200);
* ```
*/
void
hscroll(input_t &input, int high_res_distance) {
int distance = high_res_distance / 120;
@@ -1333,17 +1333,17 @@ namespace platf {
}
/**
* @brief XTest keyboard emulation.
* @param input The input_t instance to use.
* @param modcode The moonlight key code.
* @param release Whether the event was a press (false) or a release (true)
* @param flags SS_KBE_FLAG_* values
*
* EXAMPLES:
* ```cpp
* x_keyboard(input, 0x5A, false, 0); // Press Z
* ```
*/
* @brief XTest keyboard emulation.
* @param input The input_t instance to use.
* @param modcode The moonlight key code.
* @param release Whether the event was a press (false) or a release (true)
* @param flags SS_KBE_FLAG_* values
*
* EXAMPLES:
* ```cpp
* x_keyboard(input, 0x5A, false, 0); // Press Z
* ```
*/
static void
x_keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
#ifdef SUNSHINE_BUILD_X11
@@ -1368,17 +1368,17 @@ namespace platf {
}
/**
* @brief Keyboard emulation.
* @param input The input_t instance to use.
* @param modcode The moonlight key code.
* @param release Whether the event was a press (false) or a release (true)
* @param flags SS_KBE_FLAG_* values
*
* EXAMPLES:
* ```cpp
* keyboard(input, 0x5A, false, 0); // Press Z
* ```
*/
* @brief Keyboard emulation.
* @param input The input_t instance to use.
* @param modcode The moonlight key code.
* @param release Whether the event was a press (false) or a release (true)
* @param flags SS_KBE_FLAG_* values
*
* EXAMPLES:
* ```cpp
* keyboard(input, 0x5A, false, 0); // Press Z
* ```
*/
void
keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
auto keyboard = ((input_raw_t *) input.get())->keyboard_input.get();
@@ -1407,12 +1407,12 @@ namespace platf {
}
/**
* Takes an UTF-32 encoded string and returns a hex string representation of the bytes (uppercase)
*
* ex: ['👱'] = "1F471" // see UTF encoding at https://www.compart.com/en/unicode/U+1F471
*
* adapted from: https://stackoverflow.com/a/7639754
*/
* Takes an UTF-32 encoded string and returns a hex string representation of the bytes (uppercase)
*
* ex: ['👱'] = "1F471" // see UTF encoding at https://www.compart.com/en/unicode/U+1F471
*
* adapted from: https://stackoverflow.com/a/7639754
*/
std::string
to_hex(const std::basic_string<char32_t> &str) {
std::stringstream ss;
@@ -1427,16 +1427,16 @@ namespace platf {
}
/**
* Here we receive a single UTF-8 encoded char at a time,
* the trick is to convert it to UTF-32 then send CTRL+SHIFT+U+<HEXCODE> in order to produce any
* unicode character, see: https://en.wikipedia.org/wiki/Unicode_input
*
* ex:
* - when receiving UTF-8 [0xF0 0x9F 0x91 0xB1] (which is '👱')
* - we'll convert it to UTF-32 [0x1F471]
* - then type: CTRL+SHIFT+U+1F471
* see the conversion at: https://www.compart.com/en/unicode/U+1F471
*/
* Here we receive a single UTF-8 encoded char at a time,
* the trick is to convert it to UTF-32 then send CTRL+SHIFT+U+{HEXCODE} in order to produce any
* unicode character, see: https://en.wikipedia.org/wiki/Unicode_input
*
* ex:
* - when receiving UTF-8 [0xF0 0x9F 0x91 0xB1] (which is '👱')
* - we'll convert it to UTF-32 [0x1F471]
* - then type: CTRL+SHIFT+U+1F471
* see the conversion at: https://www.compart.com/en/unicode/U+1F471
*/
void
unicode(input_t &input, char *utf8, int size) {
auto kb = ((input_raw_t *) input.get())->keyboard_input.get();
@@ -1549,13 +1549,13 @@ namespace platf {
}
/**
* @brief Initalize a new keyboard and return it.
*
* EXAMPLES:
* ```cpp
* auto my_keyboard = keyboard();
* ```
*/
* @brief Initialize a new keyboard and return it.
*
* EXAMPLES:
* ```cpp
* auto my_keyboard = keyboard();
* ```
*/
evdev_t
keyboard() {
evdev_t dev { libevdev_new() };
@@ -1578,13 +1578,13 @@ namespace platf {
}
/**
* @brief Initalize a new uinput virtual mouse and return it.
*
* EXAMPLES:
* ```cpp
* auto my_mouse = mouse();
* ```
*/
* @brief Initialize a new `uinput` virtual mouse and return it.
*
* EXAMPLES:
* ```cpp
* auto my_mouse = mouse();
* ```
*/
evdev_t
mouse() {
evdev_t dev { libevdev_new() };
@@ -1629,13 +1629,13 @@ namespace platf {
}
/**
* @brief Initalize a new uinput virtual touchscreen and return it.
*
* EXAMPLES:
* ```cpp
* auto my_touchscreen = touchscreen();
* ```
*/
* @brief Initialize a new `uinput` virtual touchscreen and return it.
*
* EXAMPLES:
* ```cpp
* auto my_touchscreen = touchscreen();
* ```
*/
evdev_t
touchscreen() {
evdev_t dev { libevdev_new() };
@@ -1679,13 +1679,13 @@ namespace platf {
}
/**
* @brief Initalize a new uinput virtual X360 gamepad and return it.
*
* EXAMPLES:
* ```cpp
* auto my_x360 = x360();
* ```
*/
* @brief Initialize a new `uinput` virtual X360 gamepad and return it.
*
* EXAMPLES:
* ```cpp
* auto my_x360 = x360();
* ```
*/
evdev_t
x360() {
evdev_t dev { libevdev_new() };
@@ -1756,13 +1756,13 @@ namespace platf {
}
/**
* @brief Initalize the input system and return it.
*
* EXAMPLES:
* ```cpp
* auto my_input = input();
* ```
*/
* @brief Initialize the input system and return it.
*
* EXAMPLES:
* ```cpp
* auto my_input = input();
* ```
*/
input_t
input() {
input_t result { new input_raw_t() };

View File

@@ -552,7 +552,7 @@ namespace platf {
return -1;
}
//TODO: surf_sd = fb->to_sd();
// TODO: surf_sd = fb->to_sd();
auto crct = card.crtc(plane->crtc_id);
kms::print(plane.get(), fb.get(), crct.get());
@@ -999,15 +999,15 @@ namespace platf {
}
/**
* On Wayland, it's not possible to determine the position of the monitor on the desktop with KMS.
* Wayland does allow applications to query attached monitors on the desktop,
* however, the naming scheme is not standardized across implementations.
*
* As a result, correlating the KMS output to the wayland outputs is guess work at best.
* But, it's necessary for absolute mouse coordinates to work.
*
* This is an ugly hack :(
*/
* On Wayland, it's not possible to determine the position of the monitor on the desktop with KMS.
* Wayland does allow applications to query attached monitors on the desktop,
* however, the naming scheme is not standardized across implementations.
*
* As a result, correlating the KMS output to the wayland outputs is guess work at best.
* But, it's necessary for absolute mouse coordinates to work.
*
* This is an ugly hack :(
*/
void
correlate_to_wayland(std::vector<kms::card_descriptor_t> &cds) {
auto monitors = wl::monitors();

View File

@@ -1,5 +1,4 @@
#ifndef SUNSHINE_PLATFORM_MISC_H
#define SUNSHINE_PLATFORM_MISC_H
#pragma once
#include <unistd.h>
#include <vector>
@@ -29,5 +28,3 @@ namespace dyn {
handle(const std::vector<const char *> &libs);
} // namespace dyn
#endif

View File

@@ -12,7 +12,9 @@ using namespace std::literals;
namespace avahi {
/** Error codes used by avahi */
/**
* @brief Error codes used by avahi
*/
enum err_e {
OK = 0, /**< OK */
ERR_FAILURE = -1, /**< Generic error code */
@@ -113,7 +115,9 @@ namespace avahi {
CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter CLIENT_CONNECTING state and wait for the daemon to appear */
};
/** Some flags for publishing functions */
/**
* @brief Some flags for publishing functions
*/
enum PublishFlags {
PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
@@ -434,4 +438,4 @@ namespace platf::publish {
return std::make_unique<deinit_t>(std::thread { avahi::simple_poll_loop, poll.get() });
}
} // namespace platf::publish
} // namespace platf::publish

View File

@@ -7,8 +7,7 @@ extern "C" {
#include <libavcodec/avcodec.h>
#include <va/va.h>
#if !VA_CHECK_VERSION(1, 9, 0)
/* vaSyncBuffer stub allows Sunshine built against libva <2.9.0
to link against ffmpeg on libva 2.9.0 or later */
// vaSyncBuffer stub allows Sunshine built against libva <2.9.0 to link against ffmpeg on libva 2.9.0 or later
VAStatus
vaSyncBuffer(
VADisplay dpy,
@@ -56,10 +55,7 @@ namespace va {
// Needs to be closed manually
int fd;
/*
* Total size of this object (may include regions which are
* not part of the surface).
*/
// Total size of this object (may include regions which are not part of the surface)
uint32_t size;
// Format modifier applied to this object, not sure what that means
uint64_t drm_format_modifier;
@@ -85,7 +81,9 @@ namespace va {
} layers[4];
};
/** Currently defined profiles */
/**
* @brief Currently defined profiles
*/
enum class profile_e {
// Profile ID used for video processing.
ProfileNone = -1,
@@ -135,9 +133,9 @@ namespace va {
IDCT = 3,
MoComp = 4,
Deblocking = 5,
EncSlice = 6, /* slice level encode */
EncPicture = 7, /* pictuer encode, JPEG, etc */
/*
EncSlice = 6, /** slice level encode */
EncPicture = 7, /** picture encode, JPEG, etc */
/**
* For an implementation that supports a low power/high performance variant
* for slice level encode, it can choose to expose the
* VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
@@ -148,7 +146,7 @@ namespace va {
EncSliceLP = 8,
VideoProc = 10, /**< Video pre/post-processing. */
/**
* \brief FEI
* @brief FEI
*
* The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to
* have more controls and trade off quality for speed with their own IPs.
@@ -162,10 +160,10 @@ namespace va {
* and VAEncFEIDistortionBufferType) for FEI entry function.
* If separate PAK is set, two extra input buffers
* (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
**/
*/
FEI = 11,
/**
* \brief Stats
* @brief Stats
*
* A pre-processing function for getting some statistics and motion vectors is added,
* and some extra controls for Encode pipeline are provided. The application can
@@ -179,19 +177,19 @@ namespace va {
* (VAStatsStatisticsParameterBufferType) and one or two output buffers
* (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only)
* and VAStatsMVBufferType) are needed for this entry point.
**/
*/
Stats = 12,
/**
* \brief ProtectedTEEComm
* @brief ProtectedTEEComm
*
* A function for communicating with TEE (Trusted Execution Environment).
**/
*/
ProtectedTEEComm = 13,
/**
* \brief ProtectedContent
* @brief ProtectedContent
*
* A function for protected content to decrypt encrypted content.
**/
*/
ProtectedContent = 14,
};
@@ -475,11 +473,11 @@ namespace va {
};
/**
* This is a private structure of FFmpeg, I need this to manually create
* a VAAPI hardware context
*
* xdisplay will not be used internally by FFmpeg
*/
* This is a private structure of FFmpeg, I need this to manually create
* a VAAPI hardware context
*
* xdisplay will not be used internally by FFmpeg
*/
typedef struct VAAPIDevicePriv {
union {
void *xdisplay;
@@ -489,22 +487,22 @@ namespace va {
} VAAPIDevicePriv;
/**
* VAAPI connection details.
*
* Allocated as AVHWDeviceContext.hwctx
*/
* VAAPI connection details.
*
* Allocated as AVHWDeviceContext.hwctx
*/
typedef struct AVVAAPIDeviceContext {
/**
* The VADisplay handle, to be filled by the user.
*/
* The VADisplay handle, to be filled by the user.
*/
va::VADisplay display;
/**
* Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
* with reference to a table of known drivers, unless the
* AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
* may need to refer to this field when performing any later
* operations using VAAPI with the same VADisplay.
*/
* Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
* with reference to a table of known drivers, unless the
* AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
* may need to refer to this field when performing any later
* operations using VAAPI with the same VADisplay.
*/
unsigned int driver_quirks;
} AVVAAPIDeviceContext;

View File

@@ -1,5 +1,4 @@
#ifndef SUNSHINE_VAAPI_H
#define SUNSHINE_VAAPI_H
#pragma once
#include "misc.h"
#include "src/platform/common.h"
@@ -9,12 +8,12 @@ namespace egl {
}
namespace va {
/**
* Width --> Width of the image
* Height --> Height of the image
* offset_x --> Horizontal offset of the image in the texture
* offset_y --> Vertical offset of the image in the texture
* file_t card --> The file descriptor of the render device used for encoding
*/
* Width --> Width of the image
* Height --> Height of the image
* offset_x --> Horizontal offset of the image in the texture
* offset_y --> Vertical offset of the image in the texture
* file_t card --> The file descriptor of the render device used for encoding
*/
std::shared_ptr<platf::hwdevice_t>
make_hwdevice(int width, int height, bool vram);
std::shared_ptr<platf::hwdevice_t>
@@ -29,4 +28,3 @@ namespace va {
int
init();
} // namespace va
#endif

View File

@@ -1,5 +1,4 @@
#ifndef SUNSHINE_WAYLAND_H
#define SUNSHINE_WAYLAND_H
#pragma once
#include <bitset>
@@ -180,9 +179,9 @@ namespace wl {
class display_t {
public:
/**
* Initialize display with display_name
* If display_name == nullptr -> display_name = std::getenv("WAYLAND_DISPLAY")
*/
* Initialize display with display_name
* If display_name == nullptr -> display_name = std::getenv("WAYLAND_DISPLAY")
*/
int
init(const char *display_name = nullptr);
@@ -246,5 +245,3 @@ namespace wl {
init() { return -1; }
} // namespace wl
#endif
#endif

View File

@@ -1,7 +1,3 @@
//
// Created by loki on 6/21/19.
//
#include "src/platform/common.h"
#include <fstream>
@@ -389,10 +385,10 @@ namespace platf {
mem_type_e mem_type;
/*
* Last X (NOT the streamed monitor!) size.
* This way we can trigger reinitialization if the dimensions changed while streaming
*/
/**
* Last X (NOT the streamed monitor!) size.
* This way we can trigger reinitialization if the dimensions changed while streaming
*/
// int env_width, env_height;
x11_attr_t(mem_type_e mem_type):
@@ -468,11 +464,11 @@ namespace platf {
}
/**
* Called when the display attributes should change.
*/
* Called when the display attributes should change.
*/
void
refresh() {
x11::GetWindowAttributes(xdisplay.get(), xwindow, &xattr); //Update xattr's
x11::GetWindowAttributes(xdisplay.get(), xwindow, &xattr); // Update xattr's
}
capture_e
@@ -521,7 +517,7 @@ namespace platf {
snapshot(const pull_free_image_cb_t &pull_free_image_cb, std::shared_ptr<platf::img_t> &img_out, std::chrono::milliseconds timeout, bool cursor) {
refresh();
//The whole X server changed, so we must reinit everything
// The whole X server changed, so we must reinit everything
if (xattr.width != env_width || xattr.height != env_height) {
BOOST_LOG(warning) << "X dimensions changed in non-SHM mode, request reinit"sv;
return capture_e::reinit;
@@ -657,7 +653,7 @@ namespace platf {
capture_e
snapshot(const pull_free_image_cb_t &pull_free_image_cb, std::shared_ptr<platf::img_t> &img_out, std::chrono::milliseconds timeout, bool cursor) {
//The whole X server changed, so we must reinit everything
// The whole X server changed, so we must reinit everything
if (xattr.width != env_width || xattr.height != env_height) {
BOOST_LOG(warning) << "X dimensions changed in SHM mode, request reinit"sv;
return capture_e::reinit;

View File

@@ -1,5 +1,4 @@
#ifndef SUNSHINE_X11_GRAB
#define SUNSHINE_X11_GRAB
#pragma once
#include <optional>
@@ -34,11 +33,11 @@ namespace platf::x11 {
capture(egl::cursor_t &img);
/**
* Capture and blend the cursor into the image
*
* img <-- destination image
* offsetX, offsetY <--- Top left corner of the virtual screen
*/
* Capture and blend the cursor into the image
*
* img <-- destination image
* offsetX, offsetY <--- Top left corner of the virtual screen
*/
void
blend(img_t &img, int offsetX, int offsetY);
@@ -66,5 +65,3 @@ namespace platf::x11 {
make_display() { return nullptr; }
#endif
} // namespace platf::x11
#endif