Declarations for libvirtualhid-backed input helpers. More...
#include <memory>#include <optional>#include <set>#include <string>#include <string_view>#include <vector>#include <libvirtualhid/libvirtualhid.hpp>#include "src/platform/common.h"Go to the source code of this file.
Classes | |
| struct | platf::virtualhid::client_context_t |
| Per-client virtual touch and pen state. More... | |
| struct | platf::virtualhid::input_context_t |
| Runtime and virtual devices owned by one platform input context. More... | |
Functions | |
| void | platf::virtualhid::abs_mouse (input_context_t &context, const touch_port_t &touch_port, float x, float y) |
| Move the virtual mouse absolutely inside a target touch port. | |
| int | platf::virtualhid::alloc_gamepad (input_context_t &context, const gamepad_id_t &id, const gamepad_arrival_t &metadata, feedback_queue_t feedback_queue) |
| Allocate a libvirtualhid gamepad. | |
| void | platf::virtualhid::button_mouse (input_context_t &context, int button, bool release) |
| Submit a mouse button event. | |
| bool | platf::virtualhid::configured_gamepad_supports_controller_extensions () |
| Return whether the configured gamepad profile needs Moonlight controller extensions. | |
| bool | platf::virtualhid::configured_gamepad_supports_touchpad () |
| Return whether the configured gamepad profile can expose touchpad input. | |
| std::unique_ptr< lvh::Runtime > | platf::virtualhid::create_runtime (lvh::BackendKind backend=lvh::BackendKind::platform_default) |
| Create a platform-default libvirtualhid runtime. | |
| void | platf::virtualhid::free_gamepad (input_context_t &context, int nr) |
| Release a libvirtualhid gamepad slot. | |
| void | platf::virtualhid::gamepad_battery (input_context_t &context, const gamepad_battery_t &battery) |
| Submit gamepad battery metadata. | |
| void | platf::virtualhid::gamepad_motion (input_context_t &context, const gamepad_motion_t &motion) |
| Submit a gamepad motion event. | |
| void | platf::virtualhid::gamepad_touch (input_context_t &context, const gamepad_touch_t &touch) |
| Submit a gamepad touch event. | |
| void | platf::virtualhid::gamepad_update (input_context_t &context, int nr, const gamepad_state_t &state) |
| Submit a full gamepad state. | |
| client_context_t & | platf::virtualhid::get_client_context (client_input_t *input) |
| Return the per-client libvirtualhid context from a platform input backend. | |
| input_context_t & | platf::virtualhid::get_input_context (input_t &input) |
| Return the shared libvirtualhid context from a platform input backend. | |
| bool | platf::virtualhid::has_gamepad (const input_context_t &context, int nr) |
| Check whether a libvirtualhid gamepad exists in a slot. | |
| void | platf::virtualhid::hscroll (input_context_t &context, int high_res_distance) |
| Submit horizontal scroll input. | |
| void | platf::virtualhid::keyboard_update (input_context_t &context, std::uint16_t modcode, bool release, std::uint8_t flags, bool extended=false) |
| Submit a keyboard key transition. | |
| void | platf::virtualhid::move_mouse (input_context_t &context, const touch_port_t &touch_port, int delta_x, int delta_y) |
| Retarget the virtual mouse and move it relatively. | |
| void | platf::virtualhid::move_mouse (input_context_t &context, int delta_x, int delta_y) |
| Move the virtual mouse relatively. | |
| void | platf::virtualhid::pen_update (client_context_t &context, const touch_port_t &touch_port, const pen_input_t &pen) |
| Submit a pen event. | |
| int | platf::virtualhid::rebind_gamepad (input_context_t &context, const gamepad_id_t &id, feedback_queue_t feedback_queue) |
| Rebind an existing libvirtualhid gamepad to a resumed client session. | |
| void | platf::virtualhid::scroll (input_context_t &context, int high_res_distance) |
| Submit vertical scroll input. | |
| bool | platf::virtualhid::should_try_vigembus_fallback (std::string_view configured_gamepad, bool virtualhid_selected, std::string_view gamepad_driver) |
| Decide whether ViGEmBus should be tried for a gamepad allocation. | |
| bool | platf::virtualhid::should_use_gamepad_runtime (const lvh::BackendCapabilities &capabilities, std::string_view gamepad_driver, bool virtualhid_licensed) |
| Decide whether a libvirtualhid runtime may create a gamepad. | |
| std::vector< supported_gamepad_t > | platf::virtualhid::static_supported_gamepads () |
| Return static gamepad choices for config validation. | |
| std::vector< supported_gamepad_t > | platf::virtualhid::supported_gamepads (lvh::Runtime *runtime, bool fallback_vigem_available=false, bool virtualhid_licensed=true, bool require_license=false) |
| Return gamepad choices and runtime availability. | |
| void | platf::virtualhid::touch_update (client_context_t &context, const touch_port_t &touch_port, const touch_input_t &touch) |
| Submit a touchscreen event. | |
| void | platf::virtualhid::unicode (input_context_t &context, const char *utf8, int size) |
| Submit UTF-8 text input. | |
Declarations for libvirtualhid-backed input helpers.
| void platf::virtualhid::abs_mouse | ( | input_context_t & | context, |
| const touch_port_t & | touch_port, | ||
| float | x, | ||
| float | y ) |
Move the virtual mouse absolutely inside a target touch port.
| context | Input context. |
| touch_port | Target coordinate space. |
| x | Absolute X coordinate. |
| y | Absolute Y coordinate. |
| int platf::virtualhid::alloc_gamepad | ( | input_context_t & | context, |
| const gamepad_id_t & | id, | ||
| const gamepad_arrival_t & | metadata, | ||
| feedback_queue_t | feedback_queue ) |
Allocate a libvirtualhid gamepad.
| context | Input context. |
| id | Sunshine gamepad identifiers. |
| metadata | Client-reported controller metadata. |
| feedback_queue | Queue used to return gamepad feedback to the client. |
| void platf::virtualhid::button_mouse | ( | input_context_t & | context, |
| int | button, | ||
| bool | release ) |
Submit a mouse button event.
| context | Input context. |
| button | Moonlight mouse button. |
| release | Whether the button was released. |
| bool platf::virtualhid::configured_gamepad_supports_controller_extensions | ( | ) |
Return whether the configured gamepad profile needs Moonlight controller extensions.
Moonlight uses the controller-touch feature flag to authorize both controller touchpad and motion packets.
| bool platf::virtualhid::configured_gamepad_supports_touchpad | ( | ) |
Return whether the configured gamepad profile can expose touchpad input.
| std::unique_ptr< lvh::Runtime > platf::virtualhid::create_runtime | ( | lvh::BackendKind | backend = lvh::BackendKind::platform_default | ) |
Create a platform-default libvirtualhid runtime.
| backend | Backend used to create the runtime. |
| void platf::virtualhid::free_gamepad | ( | input_context_t & | context, |
| int | nr ) |
Release a libvirtualhid gamepad slot.
| context | Input context. |
| nr | Gamepad slot index. |
| void platf::virtualhid::gamepad_battery | ( | input_context_t & | context, |
| const gamepad_battery_t & | battery ) |
Submit gamepad battery metadata.
| context | Input context. |
| battery | Sunshine battery event. |
| void platf::virtualhid::gamepad_motion | ( | input_context_t & | context, |
| const gamepad_motion_t & | motion ) |
Submit a gamepad motion event.
| context | Input context. |
| motion | Sunshine motion event. |
| void platf::virtualhid::gamepad_touch | ( | input_context_t & | context, |
| const gamepad_touch_t & | touch ) |
Submit a gamepad touch event.
| context | Input context. |
| touch | Sunshine touch event. |
| void platf::virtualhid::gamepad_update | ( | input_context_t & | context, |
| int | nr, | ||
| const gamepad_state_t & | state ) |
Submit a full gamepad state.
| context | Input context. |
| nr | Gamepad slot index. |
| state | Sunshine gamepad state. |
| virtualhid::client_context_t & platf::virtualhid::get_client_context | ( | client_input_t * | input | ) |
Return the per-client libvirtualhid context from a platform input backend.
| input | Per-client platform input backend. |
| virtualhid::input_context_t & platf::virtualhid::get_input_context | ( | input_t & | input | ) |
Return the shared libvirtualhid context from a platform input backend.
| input | Platform input backend. |
| bool platf::virtualhid::has_gamepad | ( | const input_context_t & | context, |
| int | nr ) |
Check whether a libvirtualhid gamepad exists in a slot.
| context | Input context. |
| nr | Gamepad slot index. |
| void platf::virtualhid::hscroll | ( | input_context_t & | context, |
| int | high_res_distance ) |
Submit horizontal scroll input.
| context | Input context. |
| high_res_distance | High-resolution scroll distance. |
| void platf::virtualhid::keyboard_update | ( | input_context_t & | context, |
| std::uint16_t | modcode, | ||
| bool | release, | ||
| std::uint8_t | flags, | ||
| bool | extended = false ) |
Submit a keyboard key transition.
| context | Input context. |
| modcode | Portable key code. |
| release | Whether the key was released. |
| flags | Bit flags that modify the requested operation. |
| extended | Whether the client positively identified an extended key. |
| void platf::virtualhid::move_mouse | ( | input_context_t & | context, |
| const touch_port_t & | touch_port, | ||
| int | delta_x, | ||
| int | delta_y ) |
Retarget the virtual mouse and move it relatively.
| context | Input context. |
| touch_port | Desktop and streamed-display bounds for the pointer. |
| delta_x | Horizontal delta. |
| delta_y | Vertical delta. |
| void platf::virtualhid::move_mouse | ( | input_context_t & | context, |
| int | delta_x, | ||
| int | delta_y ) |
Move the virtual mouse relatively.
| context | Input context. |
| delta_x | Horizontal delta. |
| delta_y | Vertical delta. |
| void platf::virtualhid::pen_update | ( | client_context_t & | context, |
| const touch_port_t & | touch_port, | ||
| const pen_input_t & | pen ) |
Submit a pen event.
| context | Client context. |
| touch_port | Touch coordinate bounds used for scaling. |
| pen | Pen event. |
| int platf::virtualhid::rebind_gamepad | ( | input_context_t & | context, |
| const gamepad_id_t & | id, | ||
| feedback_queue_t | feedback_queue ) |
Rebind an existing libvirtualhid gamepad to a resumed client session.
| context | Input context. |
| id | Sunshine gamepad identifiers for the resumed client. |
| feedback_queue | Queue used to return gamepad feedback to the resumed client. |
| void platf::virtualhid::scroll | ( | input_context_t & | context, |
| int | high_res_distance ) |
Submit vertical scroll input.
| context | Input context. |
| high_res_distance | High-resolution scroll distance. |
| bool platf::virtualhid::should_try_vigembus_fallback | ( | std::string_view | configured_gamepad, |
| bool | virtualhid_selected, | ||
| std::string_view | gamepad_driver ) |
Decide whether ViGEmBus should be tried for a gamepad allocation.
When Virtual HID Driver is unavailable or deliberately bypassed, ViGEmBus uses automatic selection for profiles it cannot represent directly.
| configured_gamepad | Configured virtual gamepad profile. |
| virtualhid_selected | Whether Virtual HID Driver was selected for the allocation. |
| gamepad_driver | Configured Windows virtual gamepad driver policy. |
| bool platf::virtualhid::should_use_gamepad_runtime | ( | const lvh::BackendCapabilities & | capabilities, |
| std::string_view | gamepad_driver, | ||
| bool | virtualhid_licensed ) |
Decide whether a libvirtualhid runtime may create a gamepad.
| capabilities | Runtime backend capabilities. |
| gamepad_driver | Configured Windows virtual gamepad driver policy. |
| virtualhid_licensed | Whether the Virtual HID Driver machine license is valid. |
| std::vector< supported_gamepad_t > platf::virtualhid::static_supported_gamepads | ( | ) |
Return static gamepad choices for config validation.
| std::vector< supported_gamepad_t > platf::virtualhid::supported_gamepads | ( | lvh::Runtime * | runtime, |
| bool | fallback_vigem_available = false, | ||
| bool | virtualhid_licensed = true, | ||
| bool | require_license = false ) |
Return gamepad choices and runtime availability.
| runtime | Runtime to probe. |
| fallback_vigem_available | Whether Windows ViGEm fallback can create gamepads. |
| virtualhid_licensed | Whether the broker has a valid license. |
| require_license | Whether this platform requires a broker license for gamepads. |
| void platf::virtualhid::touch_update | ( | client_context_t & | context, |
| const touch_port_t & | touch_port, | ||
| const touch_input_t & | touch ) |
Submit a touchscreen event.
| context | Client context. |
| touch_port | Touch coordinate bounds used for scaling. |
| touch | Touch event. |
| void platf::virtualhid::unicode | ( | input_context_t & | context, |
| const char * | utf8, | ||
| int | size ) |
Submit UTF-8 text input.
| context | Input context. |
| utf8 | UTF-8 text buffer. |
| size | Text buffer size. |