From 1bdee14934f434f7a6105ccd7e7f61e8421d60cf Mon Sep 17 00:00:00 2001 From: Vithorio Polten Date: Thu, 23 May 2024 06:43:20 -0300 Subject: [PATCH] chore: lint fixes --- src/platform/linux/input.cpp | 9 +++++---- src/platform/macos/input.cpp | 18 +++++++----------- src/platform/windows/input.cpp | 6 +++--- src/utility.h | 3 ++- tests/unit/test_mouse.cpp | 18 ++++++++++-------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/platform/linux/input.cpp b/src/platform/linux/input.cpp index 0536bed7286..4af7c568eee 100644 --- a/src/platform/linux/input.cpp +++ b/src/platform/linux/input.cpp @@ -1103,7 +1103,7 @@ namespace platf { #ifdef SUNSHINE_BUILD_X11 Display *xdisplay = ((input_raw_t *) input.get())->display; if (!xdisplay) { - return util::point_t { }; + return util::point_t {}; } Window root, root_return, child_return; root = DefaultRootWindow(xdisplay); @@ -1117,14 +1117,15 @@ namespace platf { << " x: " << root_x << std::endl << " y: " << root_y << std::endl; - return util::point_t { (double)root_x, (double)root_y }; - } else { + return util::point_t { (double) root_x, (double) root_y }; + } + else { BOOST_LOG(debug) << "Unable to query x11 pointer"sv << std::endl; } #else BOOST_LOG(debug) << "Unable to query wayland pointer"sv << std::endl; #endif - return util::point_t { }; + return util::point_t {}; } /** diff --git a/src/platform/macos/input.cpp b/src/platform/macos/input.cpp index 21956c42829..ec2822ad356 100644 --- a/src/platform/macos/input.cpp +++ b/src/platform/macos/input.cpp @@ -12,12 +12,10 @@ #include "src/platform/common.h" #include "src/utility.h" +#include +#include #include #include -#include -#include -#include -#include /** * @brief Delay for a double click, in milliseconds. @@ -344,8 +342,7 @@ const KeyCodeMap kKeyCodesMap[] = { const CGEventType type, const util::point_t raw_location, const util::point_t previous_location, - const int click_count - ) { + const int click_count) { BOOST_LOG(debug) << "mouse_event: "sv << button << ", type: "sv << type << ", location:"sv << raw_location.x << ":"sv << raw_location.y << " click_count: "sv << click_count; const auto macos_input = static_cast(input.get()); @@ -395,8 +392,7 @@ const KeyCodeMap kKeyCodesMap[] = { move_mouse( input_t &input, const int deltaX, - const int deltaY - ) { + const int deltaY) { const auto current = get_mouse_loc(input); const auto location = util::point_t { current.x + deltaX, current.y + deltaY }; @@ -408,8 +404,7 @@ const KeyCodeMap kKeyCodesMap[] = { input_t &input, const touch_port_t &touch_port, const float x, - const float y - ) { + const float y) { const auto macos_input = static_cast(input.get()); const auto scaling = macos_input->displayScaling; const auto display = macos_input->display; @@ -456,7 +451,8 @@ const KeyCodeMap kKeyCodesMap[] = { if (now < macos_input->last_mouse_event[mac_button][release] + MULTICLICK_DELAY_MS) { post_mouse(input, mac_button, event, mouse_position, mouse_position, 2); - } else { + } + else { post_mouse(input, mac_button, event, mouse_position, mouse_position, 1); } diff --git a/src/platform/windows/input.cpp b/src/platform/windows/input.cpp index b99ab463daa..c919674963b 100644 --- a/src/platform/windows/input.cpp +++ b/src/platform/windows/input.cpp @@ -528,8 +528,8 @@ namespace platf { send_input(i); } -/** -* // TODO: This method seems to work better during tests, + /** + * // TODO: This method seems to work better during tests, but it doesn't seem to cover the same features as the original method void abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) { @@ -551,7 +551,7 @@ namespace platf { auto &mi = i.mi; // mi.dwFlags = MOUSEEVENTF_MOVE; - mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; // TODO: Not sure if needed + mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE; // TODO: Not sure if needed mi.dx = deltaX; mi.dy = deltaY; diff --git a/src/utility.h b/src/utility.h index 1fd99b8cd25..723986c24d8 100644 --- a/src/utility.h +++ b/src/utility.h @@ -945,7 +945,8 @@ namespace util { double x; double y; - friend std::ostream& operator << (std::ostream &os, const point_t &p) { + friend std::ostream & + operator<<(std::ostream &os, const point_t &p) { return (os << "Point(x: " << p.x << ", y: " << p.y << ")"); } }; diff --git a/tests/unit/test_mouse.cpp b/tests/unit/test_mouse.cpp index f60f3ffc5b8..21a3dd428f9 100644 --- a/tests/unit/test_mouse.cpp +++ b/tests/unit/test_mouse.cpp @@ -34,7 +34,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values( util::point_t { 40, 40 }, util::point_t { 70, 150 })); - // todo: add tests for hitting screen edges +// todo: add tests for hitting screen edges TEST_P(MouseHIDTest, MoveInputTest) { util::point_t mouse_delta = GetParam(); @@ -60,7 +60,8 @@ TEST_P(MouseHIDTest, MoveInputTest) { if (!has_input_moved) { std::cout << "MoveInputTest:: haven't moved" << std::endl; - } else { + } + else { std::cout << "MoveInputTest:: moved" << std::endl; } @@ -82,19 +83,19 @@ TEST_P(MouseHIDTest, AbsMoveInputTest) { auto old_loc = platf::get_mouse_loc(input); std::cout << "AbsMoveInputTest:: got current mouse loc: " << old_loc << std::endl; - #ifdef _WIN32 +#ifdef _WIN32 platf::touch_port_t abs_port { 0, 0, 65535, 65535 }; - #elif __linux__ +#elif __linux__ platf::touch_port_t abs_port { 0, 0, 19200, 12000 }; - #else - platf::touch_port_t abs_port { }; - #endif +#else + platf::touch_port_t abs_port {}; +#endif std::cout << "AbsMoveInputTest:: move: " << mouse_pos << std::endl; platf::abs_mouse(input, abs_port, mouse_pos.x, mouse_pos.y); std::this_thread::sleep_for(std::chrono::milliseconds(200)); @@ -108,7 +109,8 @@ TEST_P(MouseHIDTest, AbsMoveInputTest) { if (!has_input_moved) { std::cout << "AbsMoveInputTest:: haven't moved" << std::endl; - } else { + } + else { std::cout << "AbsMoveInputTest:: moved" << std::endl; }