diff --git a/src/input/common.cpp b/src/input/common.cpp index 64c2aa9dee2..2cb00413bda 100644 --- a/src/input/common.cpp +++ b/src/input/common.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/common.cpp + * @brief Definitions for common input. + */ #include "common.h" #include "init.h" @@ -10,35 +14,16 @@ using namespace std::literals; namespace input { - /** - * @brief Converts a little-endian netfloat to a native endianness float. - * @param f Netfloat value. - * @return Float value. - */ float from_netfloat(netfloat f) { return boost::endian::endian_load(f); } - /** - * @brief Converts a little-endian netfloat to a native endianness float and clamps it. - * @param f Netfloat value. - * @param min The minimium value for clamping. - * @param max The maximum value for clamping. - * @return Clamped float value. - */ float from_clamped_netfloat(netfloat f, float min, float max) { return std::clamp(from_netfloat(f), min, max); } - /** - * @brief Multiplies a polar coordinate pair by a cartesian scaling factor. - * @param r The radial coordinate. - * @param angle The angular coordinate (radians). - * @param scalar The scalar cartesian coordinate pair. - * @return The scaled radial coordinate. - */ float multiply_polar_by_cartesian_scalar(float r, float angle, const std::pair &scalar) { // Convert polar to cartesian coordinates @@ -53,17 +38,10 @@ namespace input { return std::sqrt(std::pow(x, 2) + std::pow(y, 2)); } - /** - * @brief Scales the ellipse axes according to the provided size. - * @param val The major and minor axis pair. - * @param rotation The rotation value from the touch/pen event. - * @param scalar The scalar cartesian coordinate pair. - * @return The major and minor axis pair. - */ std::pair scale_client_contact_area(const std::pair &val, uint16_t rotation, const std::pair &scalar) { // If the rotation is unknown, we'll just scale both axes equally by using - // a 45 degree angle for our scaling calculations + // a 45-degree angle for our scaling calculations float angle = rotation == LI_ROT_UNKNOWN ? (M_PI / 4) : (rotation * (M_PI / 180)); // If we have a major but not a minor axis, treat the touch as circular diff --git a/src/input/common.h b/src/input/common.h index 14757cfd8f5..86988f5004b 100644 --- a/src/input/common.h +++ b/src/input/common.h @@ -1,3 +1,7 @@ +/** + * @file src/input/common.h + * @brief Declarations for common input. + */ #pragma once #include @@ -38,25 +42,25 @@ namespace input { }; /** - * @brief Converts a little-endian netfloat to a native endianness float and clamps it. + * @brief Convert a little-endian netfloat to a native endianness float and clamps it. * @param f Netfloat value. * @param min The minimium value for clamping. * @param max The maximum value for clamping. - * @return Clamped float value. + * @return Clamped native endianess float value. */ float from_clamped_netfloat(netfloat f, float min, float max); /** - * @brief Converts a little-endian netfloat to a native endianness float. + * @brief Convert a little-endian netfloat to a native endianness float. * @param f Netfloat value. - * @return Float value. + * @return The native endianness float value. */ float from_netfloat(netfloat f); /** - * @brief Multiplies a polar coordinate pair by a cartesian scaling factor. + * @brief Multiply a polar coordinate pair by a cartesian scaling factor. * @param r The radial coordinate. * @param angle The angular coordinate (radians). * @param scalar The scalar cartesian coordinate pair. @@ -66,7 +70,7 @@ namespace input { multiply_polar_by_cartesian_scalar(float r, float angle, const std::pair &scalar); /** - * @brief Scales the ellipse axes according to the provided size. + * @brief Scale the ellipse axes according to the provided size. * @param val The major and minor axis pair. * @param rotation The rotation value from the touch/pen event. * @param scalar The scalar cartesian coordinate pair. diff --git a/src/input/gamepad.cpp b/src/input/gamepad.cpp index d4215a99fe2..00929368e8e 100644 --- a/src/input/gamepad.cpp +++ b/src/input/gamepad.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/gamepad.cpp + * @brief Definitions for common gamepad input. + */ #include "gamepad.h" #include "common.h" #include "init.h" @@ -55,10 +59,6 @@ namespace input::gamepad { << "--end controller packet--"sv; } - /** - * @brief Prints a controller arrival packet. - * @param packet The controller arrival packet. - */ void print(PSS_CONTROLLER_ARRIVAL_PACKET packet) { BOOST_LOG(debug) @@ -70,10 +70,6 @@ namespace input::gamepad { << "--end controller arrival packet--"sv; } - /** - * @brief Prints a controller touch packet. - * @param packet The controller touch packet. - */ void print(PSS_CONTROLLER_TOUCH_PACKET packet) { BOOST_LOG(debug) @@ -87,10 +83,6 @@ namespace input::gamepad { << "--end controller touch packet--"sv; } - /** - * @brief Prints a controller motion packet. - * @param packet The controller motion packet. - */ void print(PSS_CONTROLLER_MOTION_PACKET packet) { BOOST_LOG(verbose) @@ -103,10 +95,6 @@ namespace input::gamepad { << "--end controller motion packet--"sv; } - /** - * @brief Prints a controller battery packet. - * @param packet The controller battery packet. - */ void print(PSS_CONTROLLER_BATTERY_PACKET packet) { BOOST_LOG(verbose) @@ -117,11 +105,6 @@ namespace input::gamepad { << "--end controller battery packet--"sv; } - /** - * @brief Called to pass a controller arrival message to the platform backend. - * @param input The input context pointer. - * @param packet The controller arrival packet. - */ void passthrough(std::shared_ptr &input, PSS_CONTROLLER_ARRIVAL_PACKET packet) { if (!config::input.controller) { @@ -158,11 +141,6 @@ namespace input::gamepad { (*input->gamepads)[packet->controllerNumber].id = id; } - /** - * @brief Called to pass a controller touch message to the platform backend. - * @param input The input context pointer. - * @param packet The controller touch packet. - */ void passthrough(std::shared_ptr &input, PSS_CONTROLLER_TOUCH_PACKET packet) { if (!config::input.controller) { @@ -192,11 +170,6 @@ namespace input::gamepad { platf::gamepad_touch(PlatformInput::getInstance(), touch); } - /** - * @brief Called to pass a controller motion message to the platform backend. - * @param input The input context pointer. - * @param packet The controller motion packet. - */ void passthrough(std::shared_ptr &input, PSS_CONTROLLER_MOTION_PACKET packet) { if (!config::input.controller) { @@ -343,11 +316,6 @@ namespace input::gamepad { gamepad.gamepad_state = gamepad_state; } - /** - * @brief Called to pass a controller battery message to the platform backend. - * @param input The input context pointer. - * @param packet The controller battery packet. - */ void passthrough(std::shared_ptr &input, PSS_CONTROLLER_BATTERY_PACKET packet) { if (!config::input.controller) { @@ -374,12 +342,6 @@ namespace input::gamepad { platf::gamepad_battery(PlatformInput::getInstance(), battery); } - /** - * @brief Batch two controller touch messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PSS_CONTROLLER_TOUCH_PACKET dest, PSS_CONTROLLER_TOUCH_PACKET src) { // Only batch hover or move events @@ -415,12 +377,6 @@ namespace input::gamepad { return batch_result_e::batched; } - /** - * @brief Batch two controller state messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PNV_MULTI_CONTROLLER_PACKET dest, PNV_MULTI_CONTROLLER_PACKET src) { // Do not allow batching if the active controllers change @@ -444,12 +400,6 @@ namespace input::gamepad { return batch_result_e::batched; } - /** - * @brief Batch two controller motion messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PSS_CONTROLLER_MOTION_PACKET dest, PSS_CONTROLLER_MOTION_PACKET src) { // We can only batch entries for the same controller, but allow batching attempts to continue diff --git a/src/input/gamepad.h b/src/input/gamepad.h index db1a3b9b808..e00c8607920 100644 --- a/src/input/gamepad.h +++ b/src/input/gamepad.h @@ -1,3 +1,7 @@ +/** + * @file src/input/gamepad.h + * @brief Declarations for common gamepad input. + */ #pragma once #include "platform_input.h" @@ -133,7 +137,7 @@ namespace input::gamepad { * @brief Batch two controller touch messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PSS_CONTROLLER_TOUCH_PACKET dest, PSS_CONTROLLER_TOUCH_PACKET src); @@ -142,7 +146,7 @@ namespace input::gamepad { * @brief Batch two controller state messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PNV_MULTI_CONTROLLER_PACKET dest, PNV_MULTI_CONTROLLER_PACKET src); @@ -151,7 +155,7 @@ namespace input::gamepad { * @brief Batch two controller motion messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PSS_CONTROLLER_MOTION_PACKET dest, PSS_CONTROLLER_MOTION_PACKET src); diff --git a/src/input/init.h b/src/input/init.h index 4064578fd8b..5a0a40ddb19 100644 --- a/src/input/init.h +++ b/src/input/init.h @@ -1,11 +1,15 @@ +/** + * @file src/input/init.h + * @brief Declarations for common input initialization. + */ #pragma once namespace input { struct input_t; enum class batch_result_e { - batched, // This entry was batched with the source entry - not_batchable, // Not eligible to batch but continue attempts to batch - terminate_batch, // Stop trying to batch with this entry + batched, ///< Batched with the source entry + not_batchable, ///< Not eligible to batch but continue attempts to batch + terminate_batch, ///< Stop trying to batch }; } // namespace input diff --git a/src/input/keyboard.cpp b/src/input/keyboard.cpp index 7d715155c92..7993a432c59 100644 --- a/src/input/keyboard.cpp +++ b/src/input/keyboard.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/keyboard.cpp + * @brief Definitions for common keyboard input. + */ #include "keyboard.h" #include "init.h" @@ -55,11 +59,9 @@ namespace input::keyboard { } /** - * Apply shortcut based on VKEY - * On success - * return > 0 - * On nothing - * return 0 + * @brief Apply shortcut based on VKEY. + * @param keyCode The VKEY code. + * @return 0 if no shortcut applied, > 0 if shortcut applied. */ inline int apply_shortcut(short keyCode) { @@ -93,7 +95,7 @@ namespace input::keyboard { } /** - * Update flags for keyboard shortcut combo's + * @brief Update flags for keyboard shortcut combos */ inline void update_shortcutFlags(int *flags, short keyCode, bool release) { @@ -277,4 +279,4 @@ namespace input::keyboard { cancel() { task_pool.cancel(key_press_repeat_id); } -} // namespace input::keyboard \ No newline at end of file +} // namespace input::keyboard diff --git a/src/input/keyboard.h b/src/input/keyboard.h index 59abdb8bf6c..10263b589b0 100644 --- a/src/input/keyboard.h +++ b/src/input/keyboard.h @@ -1,3 +1,7 @@ +/** + * @file src/input/keyboard.h + * @brief Declarations for common keyboard input. + */ #pragma once #include diff --git a/src/input/mouse.cpp b/src/input/mouse.cpp index 5fbb882d51b..bde7067361b 100644 --- a/src/input/mouse.cpp +++ b/src/input/mouse.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/mouse.cpp + * @brief Definitions for common mouse input. + */ #include "mouse.h" #include "init.h" @@ -121,6 +125,7 @@ namespace input::mouse { mouse_press[button] = !release; } + /** * When Moonlight sends mouse input through absolute coordinates, * it's possible that BUTTON_RIGHT is pressed down immediately after releasing BUTTON_LEFT. @@ -166,11 +171,6 @@ namespace input::mouse { platf::button_mouse(PlatformInput::getInstance(), button, release); } - /** - * @brief Called to pass a vertical scroll message the platform backend. - * @param input The input context pointer. - * @param packet The scroll packet. - */ void passthrough(std::shared_ptr &input, PNV_SCROLL_PACKET packet) { if (!config::input.mouse) { @@ -190,11 +190,6 @@ namespace input::mouse { } } - /** - * @brief Called to pass a horizontal scroll message the platform backend. - * @param input The input context pointer. - * @param packet The scroll packet. - */ void passthrough(std::shared_ptr &input, PSS_HSCROLL_PACKET packet) { if (!config::input.mouse) { @@ -214,12 +209,6 @@ namespace input::mouse { } } - /** - * @brief Batch two relative mouse messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PNV_REL_MOUSE_MOVE_PACKET dest, PNV_REL_MOUSE_MOVE_PACKET src) { short deltaX, deltaY; @@ -238,12 +227,6 @@ namespace input::mouse { return batch_result_e::batched; } - /** - * @brief Batch two absolute mouse messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PNV_ABS_MOUSE_MOVE_PACKET dest, PNV_ABS_MOUSE_MOVE_PACKET src) { // Batching must only happen if the reference width and height don't change @@ -256,12 +239,6 @@ namespace input::mouse { return batch_result_e::batched; } - /** - * @brief Batch two vertical scroll messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PNV_SCROLL_PACKET dest, PNV_SCROLL_PACKET src) { short scrollAmt; @@ -277,12 +254,6 @@ namespace input::mouse { return batch_result_e::batched; } - /** - * @brief Batch two horizontal scroll messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PSS_HSCROLL_PACKET dest, PSS_HSCROLL_PACKET src) { short scrollAmt; diff --git a/src/input/mouse.h b/src/input/mouse.h index 2e5039289a7..8e531c934e6 100644 --- a/src/input/mouse.h +++ b/src/input/mouse.h @@ -1,3 +1,7 @@ +/** + * @file src/input/mouse.h + * @brief Declarations for common mouse input. + */ #pragma once #include @@ -62,7 +66,7 @@ namespace input::mouse { * @brief Batch two relative mouse messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PNV_REL_MOUSE_MOVE_PACKET dest, PNV_REL_MOUSE_MOVE_PACKET src); @@ -71,7 +75,7 @@ namespace input::mouse { * @brief Batch two absolute mouse messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PNV_ABS_MOUSE_MOVE_PACKET dest, PNV_ABS_MOUSE_MOVE_PACKET src); @@ -80,7 +84,7 @@ namespace input::mouse { * @brief Batch two vertical scroll messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PNV_SCROLL_PACKET dest, PNV_SCROLL_PACKET src); @@ -89,7 +93,7 @@ namespace input::mouse { * @brief Batch two horizontal scroll messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PSS_HSCROLL_PACKET dest, PSS_HSCROLL_PACKET src); @@ -98,7 +102,7 @@ namespace input::mouse { reset(platf::input_t &platf_input); /** - * Move the mouse slightly to force a video frame render + * @brief Move the mouse slightly to force a video frame render * @param platf_input */ void diff --git a/src/input/pen.cpp b/src/input/pen.cpp index 943186f1cf8..ca4efc4375d 100644 --- a/src/input/pen.cpp +++ b/src/input/pen.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/pen.cpp + * @brief Definitions for common pen input. + */ #include extern "C" { #include @@ -28,10 +32,6 @@ extern "C" { using namespace std::literals; namespace input::pen { - /** - * @brief Prints a pen packet. - * @param packet The pen packet. - */ void print(PSS_PEN_PACKET packet) { BOOST_LOG(debug) @@ -49,11 +49,6 @@ namespace input::pen { << "--end pen packet--"sv; } - /** - * @brief Called to pass a pen message to the platform backend. - * @param input The input context pointer. - * @param packet The pen packet. - */ void passthrough(std::shared_ptr &input, PSS_PEN_PACKET packet) { if (!config::input.mouse) { @@ -108,12 +103,6 @@ namespace input::pen { platf::pen_update(input->client_context.get(), abs_port, pen); } - /** - * @brief Batch two pen messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PSS_PEN_PACKET dest, PSS_PEN_PACKET src) { // Only batch hover or move events diff --git a/src/input/pen.h b/src/input/pen.h index 91d22feeb7e..7506a5b04a9 100644 --- a/src/input/pen.h +++ b/src/input/pen.h @@ -1,3 +1,7 @@ +/** + * @file src/input/pen.h + * @brief Declarations for common pen input. + */ #pragma once #include @@ -32,7 +36,7 @@ namespace input::pen { * @brief Batch two pen messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PSS_PEN_PACKET dest, PSS_PEN_PACKET src); diff --git a/src/input/platform_input.cpp b/src/input/platform_input.cpp index 36cc681a9a2..da4923bb174 100644 --- a/src/input/platform_input.cpp +++ b/src/input/platform_input.cpp @@ -1,3 +1,7 @@ +/** + * @file src/input/platform_input.cpp + * @brief Definitions for common platform input. + */ #include "platform_input.h" platf::input_t PlatformInput::_instance; diff --git a/src/input/platform_input.h b/src/input/platform_input.h index de347be7cd2..00c11be237a 100644 --- a/src/input/platform_input.h +++ b/src/input/platform_input.h @@ -1,3 +1,7 @@ +/** + * @file src/input/platform_input.h + * @brief Declarations for common platform input. + */ #pragma once #include "src/platform/common.h" diff --git a/src/input/processor.cpp b/src/input/processor.cpp index e59bd658038..829268e46f6 100644 --- a/src/input/processor.cpp +++ b/src/input/processor.cpp @@ -1,6 +1,6 @@ /** * @file src/input/processor.cpp - * @brief todo + * @brief Definitions for common processor input. */ // define uint32_t for @@ -97,7 +97,7 @@ namespace input { * @brief Batch two input messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PNV_INPUT_HEADER dest, PNV_INPUT_HEADER src) { @@ -232,11 +232,6 @@ namespace input { } } - /** - * @brief Called on the control stream thread to queue an input message. - * @param input The input context pointer. - * @param input_data The input message. - */ void passthrough(std::shared_ptr &input, std::vector &&input_data) { { diff --git a/src/input/processor.h b/src/input/processor.h index 0c1ac525cdb..84d288ab658 100644 --- a/src/input/processor.h +++ b/src/input/processor.h @@ -1,6 +1,6 @@ /** * @file src/input/processor.h - * @brief Declarations for gamepad, keyboard, and mouse input handling. + * @brief Declarations for common processor input. */ #pragma once @@ -37,11 +37,10 @@ namespace input { struct input_t { enum shortkey_e { - CTRL = 0x1, - ALT = 0x2, - SHIFT = 0x4, - - SHORTCUT = CTRL | ALT | SHIFT + CTRL = 0x1, ///< Control/Command key + ALT = 0x2, ///< Alt key + SHIFT = 0x4, ///< Shift key + SHORTCUT = CTRL | ALT | SHIFT ///< Shortcut combo }; input_t( diff --git a/src/input/touch.cpp b/src/input/touch.cpp index ae4239bd32f..0d006200f70 100644 --- a/src/input/touch.cpp +++ b/src/input/touch.cpp @@ -1,13 +1,12 @@ +/** + * @file src/input/touch.cpp + * @brief Definitions for common touch input. + */ #include "touch.h" #include "init.h" #include "processor.h" namespace input::touch { - - /** - * @brief Prints a touch packet. - * @param packet The touch packet. - */ void print(PSS_TOUCH_PACKET packet) { BOOST_LOG(debug) @@ -23,13 +22,6 @@ namespace input::touch { << "--end touch packet--"sv; } - /** - * @brief Converts client coordinates on the specified surface into screen coordinates. - * @param input The input context. - * @param val The cartesian coordinate pair to convert. - * @param size The size of the client's surface containing the value. - * @return The host-relative coordinate pair if a touchport is available. - */ std::optional> client_to_touchport(std::shared_ptr &input, const std::pair &val, const std::pair &size) { auto &touch_port_event = input->touch_port_event; @@ -57,11 +49,6 @@ namespace input::touch { return std::pair { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv }; } - /** - * @brief Called to pass a touch message to the platform backend. - * @param input The input context pointer. - * @param packet The touch packet. - */ void passthrough(std::shared_ptr &input, PSS_TOUCH_PACKET packet) { if (!config::input.mouse) { @@ -114,12 +101,6 @@ namespace input::touch { platf::touch_update(input->client_context.get(), abs_port, touch); } - /** - * @brief Batch two touch messages. - * @param dest The original packet to batch into. - * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. - */ batch_result_e batch(PSS_TOUCH_PACKET dest, PSS_TOUCH_PACKET src) { // Only batch hover or move events diff --git a/src/input/touch.h b/src/input/touch.h index 910e7bbfc06..0a8d13e9ab1 100644 --- a/src/input/touch.h +++ b/src/input/touch.h @@ -1,3 +1,7 @@ +/** + * @file src/input/touch.h + * @brief Declarations for common touch input. + */ #pragma once #include @@ -22,7 +26,7 @@ namespace input::touch { print(PSS_TOUCH_PACKET packet); /** - * @brief Converts client coordinates on the specified surface into screen coordinates. + * @brief Convert client coordinates on the specified surface into screen coordinates. * @param input The input context. * @param val The cartesian coordinate pair to convert. * @param size The size of the client's surface containing the value. @@ -43,7 +47,7 @@ namespace input::touch { * @brief Batch two touch messages. * @param dest The original packet to batch into. * @param src A later packet to attempt to batch. - * @return `batch_result_e` : The status of the batching operation. + * @return The status of the batching operation. */ batch_result_e batch(PSS_TOUCH_PACKET dest, PSS_TOUCH_PACKET src); diff --git a/src/server/crypto.cpp b/src/server/crypto.cpp index 5726775172e..267eb106092 100644 --- a/src/server/crypto.cpp +++ b/src/server/crypto.cpp @@ -8,6 +8,9 @@ namespace crypto { using asn1_string_t = util::safe_ptr; + /** + * @memberof crypto + */ cert_chain_t:: cert_chain_t(): _certs {},