![]() |
Sunshine latest
Self-hosted game stream host for Moonlight.
|
Definitions for macOS input handling. More...
#include <chrono>
#include <iostream>
#include <thread>
#include <ApplicationServices/ApplicationServices.h>
import <Carbon/Carbon.h>
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach.h>
#include "src/display_device.h"
#include "src/input.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/utility.h"
Classes | |
struct | platf::KeyCodeMap |
struct | platf::macos_input_t |
Functions | |
void | platf::abs_mouse (input_t &input, const touch_port_t &touch_port, float x, float y) |
int | platf::alloc_gamepad (input_t &input, const gamepad_id_t &id, const gamepad_arrival_t &metadata, feedback_queue_t feedback_queue) |
Create a new virtual gamepad. | |
std::unique_ptr< client_input_t > | platf::allocate_client_input_context (input_t &input) |
Allocate a context to store per-client input data. | |
void | platf::button_mouse (input_t &input, int button, bool release) |
CGEventType | platf::event_type_mouse (input_t &input) |
void | platf::free_gamepad (input_t &input, int nr) |
void | platf::freeInput (void *) |
void | platf::gamepad_battery (input_t &input, const gamepad_battery_t &battery) |
Send a gamepad battery event to the OS. | |
void | platf::gamepad_motion (input_t &input, const gamepad_motion_t &motion) |
Send a gamepad motion event to the OS. | |
void | platf::gamepad_touch (input_t &input, const gamepad_touch_t &touch) |
Send a gamepad touch event to the OS. | |
void | platf::gamepad_update (input_t &input, int nr, const gamepad_state_t &gamepad_state) |
Updates virtual gamepad with the provided gamepad state. | |
platform_caps::caps_t | platf::get_capabilities () |
Get the supported platform capabilities to advertise to the client. | |
util::point_t | platf::get_mouse_loc (input_t &input) |
Get the current mouse position on screen. | |
void | platf::hscroll (input_t &input, int distance) |
input_t | platf::input () |
void | platf::keyboard_update (input_t &input, uint16_t modcode, bool release, uint8_t flags) |
int | platf::keysym (int keycode) |
void | platf::move_mouse (input_t &input, int deltaX, int deltaY) |
constexpr std::chrono::milliseconds | MULTICLICK_DELAY_MS (500) |
Delay for a double click, in milliseconds. | |
bool | platf::operator< (const KeyCodeMap &a, const KeyCodeMap &b) |
void | platf::pen_update (client_input_t *input, const touch_port_t &touch_port, const pen_input_t &pen) |
Send a pen event to the OS. | |
void | platf::post_mouse (input_t &input, const CGMouseButton button, const CGEventType type, const util::point_t raw_location, const util::point_t previous_location, const int click_count) |
void | platf::scroll (input_t &input, int distance) |
std::vector< supported_gamepad_t > & | platf::supported_gamepads (input_t *input) |
Gets the supported gamepads for this platform backend. | |
void | platf::touch_update (client_input_t *input, const touch_port_t &touch_port, const touch_input_t &touch) |
Send a touch event to the OS. | |
void | platf::unicode (input_t &input, char *utf8, int size) |
Variables | |
const KeyCodeMap | platf::kKeyCodesMap [] |
Definitions for macOS input handling.
int platf::alloc_gamepad | ( | input_t & | input, |
const gamepad_id_t & | id, | ||
const gamepad_arrival_t & | metadata, | ||
feedback_queue_t | feedback_queue ) |
Create a new virtual gamepad.
input | The global input context. |
id | The gamepad ID. |
metadata | Controller metadata from client (empty if none provided). |
feedback_queue | The queue for posting messages back to the client. |
std::unique_ptr< client_input_t > platf::allocate_client_input_context | ( | input_t & | input | ) |
Allocate a context to store per-client input data.
Allocates a context to store per-client input data.
input | The global input context. |
void platf::gamepad_battery | ( | input_t & | input, |
const gamepad_battery_t & | battery ) |
Send a gamepad battery event to the OS.
Sends a gamepad battery event to the OS.
input | The global input context. |
battery | The battery event. |
void platf::gamepad_motion | ( | input_t & | input, |
const gamepad_motion_t & | motion ) |
Send a gamepad motion event to the OS.
Sends a gamepad motion event to the OS.
input | The global input context. |
motion | The motion event. |
void platf::gamepad_touch | ( | input_t & | input, |
const gamepad_touch_t & | touch ) |
Send a gamepad touch event to the OS.
Sends a gamepad touch event to the OS.
input | The global input context. |
touch | The touch event. |
void platf::gamepad_update | ( | input_t & | input, |
int | nr, | ||
const gamepad_state_t & | gamepad_state ) |
Updates virtual gamepad with the provided gamepad state.
input | The input context. |
nr | The gamepad index to update. |
gamepad_state | The gamepad button/axis state sent from the client. |
platform_caps::caps_t platf::get_capabilities | ( | ) |
Get the supported platform capabilities to advertise to the client.
Returns the supported platform capabilities to advertise to the client.
util::point_t platf::get_mouse_loc | ( | input_t & | input | ) |
Get the current mouse position on screen.
input | The input_t instance to use. |
Examples
|
constexpr |
Delay for a double click, in milliseconds.
void platf::pen_update | ( | client_input_t * | input, |
const touch_port_t & | touch_port, | ||
const pen_input_t & | pen ) |
Send a pen event to the OS.
Sends a pen event to the OS.
input | The client-specific input context. |
touch_port | The current viewport for translating to screen coordinates. |
pen | The pen event. |
std::vector< supported_gamepad_t > & platf::supported_gamepads | ( | input_t * | input | ) |
Gets the supported gamepads for this platform backend.
This may be called prior to platf::input()
!
input | Pointer to the platform's input_t or nullptr . |
void platf::touch_update | ( | client_input_t * | input, |
const touch_port_t & | touch_port, | ||
const touch_input_t & | touch ) |
Send a touch event to the OS.
Sends a touch event to the OS.
input | The client-specific input context. |
touch_port | The current viewport for translating to screen coordinates. |
touch | The touch event. |