print absolute mouse movement packets

This commit is contained in:
Loki 2021-05-10 15:04:41 +02:00
parent 25309f21ee
commit b97c902d10
3 changed files with 33 additions and 9 deletions

View File

@ -5,6 +5,14 @@ project(Sunshine)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(Simple-Web-Server)
if(WIN32)
# Ugly hack to compile with #include <qos2.h>
add_compile_definitions(
QOS_FLOWID=UINT32
PQOS_FLOWID=UINT32*
QOS_NON_ADAPTIVE_FLOW=2)
endif()
add_subdirectory(moonlight-common-c/enet)
find_package(Threads REQUIRED)
@ -70,6 +78,7 @@ if(WIN32)
libstdc++.a
libwinpthread.a
libssp.a
Qwave
winmm
ksuser
wsock32

@ -1 +1 @@
Subproject commit cfeb0ffd90992ee0fa4b6b4a179652e3e2786873
Subproject commit 5d09d43b0866d9fa30cc1741f9e10de5420deaad

View File

@ -2,6 +2,8 @@
// Created by loki on 6/20/19.
//
// define uint32_t for <moonlight-common-c/src/Input.h>
#include <cstdint>
extern "C" {
#include <moonlight-common-c/src/Input.h>
}
@ -86,12 +88,22 @@ struct input_t {
using namespace std::literals;
void print(PNV_MOUSE_MOVE_PACKET packet) {
void print(PNV_REL_MOUSE_MOVE_PACKET packet) {
BOOST_LOG(debug)
<< "--begin mouse move packet--"sv << std::endl
<< "--begin relative mouse move packet--"sv << std::endl
<< "deltaX ["sv << util::endian::big(packet->deltaX) << ']' << std::endl
<< "deltaY ["sv << util::endian::big(packet->deltaY) << ']' << std::endl
<< "--end mouse move packet--"sv;
<< "--end relative mouse move packet--"sv;
}
void print(PNV_ABS_MOUSE_MOVE_PACKET packet) {
BOOST_LOG(debug)
<< "--begin absolute mouse move packet--"sv << std::endl
<< "x ["sv << util::endian::big(packet->x) << ']' << std::endl
<< "y ["sv << util::endian::big(packet->y) << ']' << std::endl
<< "width ["sv << util::endian::big(packet->width) << ']' << std::endl
<< "height ["sv << util::endian::big(packet->height) << ']' << std::endl
<< "--end absolute mouse move packet--"sv;
}
void print(PNV_MOUSE_BUTTON_PACKET packet) {
@ -138,8 +150,11 @@ void print(void *input) {
int input_type = util::endian::big(*(int*)input);
switch(input_type) {
case PACKET_TYPE_MOUSE_MOVE:
print((PNV_MOUSE_MOVE_PACKET)input);
case PACKET_TYPE_REL_MOUSE_MOVE:
print((PNV_REL_MOUSE_MOVE_PACKET)input);
break;
case PACKET_TYPE_ABS_MOUSE_MOVE:
print((PNV_ABS_MOUSE_MOVE_PACKET)input);
break;
case PACKET_TYPE_MOUSE_BUTTON:
print((PNV_MOUSE_BUTTON_PACKET)input);
@ -162,7 +177,7 @@ void print(void *input) {
}
}
void passthrough(platf::input_t &input, PNV_MOUSE_MOVE_PACKET packet) {
void passthrough(platf::input_t &input, PNV_REL_MOUSE_MOVE_PACKET packet) {
display_cursor = true;
platf::move_mouse(input, util::endian::big(packet->deltaX), util::endian::big(packet->deltaY));
@ -374,8 +389,8 @@ void passthrough_helper(std::shared_ptr<input_t> input, std::vector<std::uint8_t
int input_type = util::endian::big(*(int*)payload);
switch(input_type) {
case PACKET_TYPE_MOUSE_MOVE:
passthrough(platf_input, (PNV_MOUSE_MOVE_PACKET)payload);
case PACKET_TYPE_REL_MOUSE_MOVE:
passthrough(platf_input, (PNV_REL_MOUSE_MOVE_PACKET)payload);
break;
case PACKET_TYPE_MOUSE_BUTTON:
passthrough(input, (PNV_MOUSE_BUTTON_PACKET)payload);