Sunshine master
Self-hosted game stream host for Moonlight.
input.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <functional>
9
10// local includes
11#include "platform/common.h"
12#include "thread_safe.h"
13
14namespace input {
15 struct input_t;
16
22 void print(void *input);
28 void reset(std::shared_ptr<input_t> &input);
29
33 void passthrough(std::shared_ptr<input_t> &input, std::vector<std::uint8_t> &&input_data);
34
40 [[nodiscard]] std::unique_ptr<platf::deinit_t> init();
41
47 bool probe_gamepads();
48
55 std::shared_ptr<input_t> alloc(safe::mail_t mail);
56
63
64 // Offset x and y coordinates of the client
67
68 float scalar_inv;
70
73
77 explicit operator bool() const {
78 return width != 0 && height != 0 && env_width != 0 && env_height != 0;
79 }
80 };
81
89 std::pair<float, float> scale_client_contact_area(const std::pair<float, float> &val, uint16_t rotation, const std::pair<float, float> &scalar);
90} // namespace input
Declarations for common platform specific utilities.
util::safe_ptr< void, freeInput > input_t
Owning pointer for a platform input backend.
Definition common.h:850
input_t input
Default input configuration values used before file and CLI overrides.
Definition config.cpp:744
std::unique_ptr< platf::deinit_t > init(const std::filesystem::path &persistence_filepath, const config::video_t &video_config)
Initialize the implementation and perform the initial state recovery (if needed).
Definition display_device.cpp:764
bool probe_gamepads()
Probe connected gamepads and update input capability state.
Definition input.cpp:1882
void passthrough(std::shared_ptr< input_t > &input, PNV_REL_MOUSE_MOVE_PACKET packet)
Forward a client input packet directly to the platform backend.
Definition input.cpp:562
void reset(std::shared_ptr< input_t > &input)
Reset the object to its initial empty state.
Definition input.cpp:1833
std::shared_ptr< input_t > alloc(safe::mail_t mail)
Allocate and initialize platform input state for a stream.
Definition input.cpp:1896
void print(PNV_REL_MOUSE_MOVE_PACKET packet)
Write a debug log representation of the input packet.
Definition input.cpp:297
Handles process-wide communication.
Definition globals.h:34
Touchscreen coordinate bounds used to scale absolute input.
Definition input.h:60
int env_width
Width of the full capture environment in physical pixels.
Definition input.h:61
float client_offsetY
Vertical client viewport offset used when scaling touch input.
Definition input.h:66
int env_logical_width
Width of the full capture environment after display scaling.
Definition input.h:71
float client_offsetX
Horizontal client viewport offset used when scaling touch input.
Definition input.h:65
float scalar_tpcoords
Scale factor from client coordinates to touch-port coordinates.
Definition input.h:69
int env_logical_height
Height of the full capture environment after display scaling.
Definition input.h:72
float scalar_inv
Inverse scale factor from client coordinates to display coordinates.
Definition input.h:68
int env_height
Height of the full capture environment in physical pixels.
Definition input.h:62
Touchscreen coordinate bounds used to scale absolute input.
Definition common.h:361
int height
Frame or display height in pixels.
Definition common.h:365
int width
Frame or display width in pixels.
Definition common.h:364
Declarations for thread-safe data structures.
std::shared_ptr< mail_raw_t > mail_t
Shared mailbox handle used by event and queue wrappers.
Definition thread_safe.h:737