Skip to content

Commit

Permalink
chore: back to original abs_mouse method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazer committed May 21, 2024
1 parent 6a16bf7 commit 5155fd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/platform/windows/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ namespace platf {
}

void
abs_mouse2(input_t &input, const touch_port_t &touch_port, float x, float y) {
abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) {
INPUT i {};

i.type = INPUT_MOUSE;
Expand All @@ -528,6 +528,7 @@ namespace platf {
send_input(i);
}

/**
void
abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) {
INPUT i {};
Expand All @@ -538,6 +539,7 @@ namespace platf {
mi.dy = (y * 65535) / GetSystemMetrics(SM_CYSCREEN);
send_input(i);
}
*/

void
move_mouse(input_t &input, int deltaX, int deltaY) {
Expand Down
15 changes: 14 additions & 1 deletion tests/unit/test_mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ TEST_P(MouseTest, AbsMoveInputTest) {

auto old_loc = platf::get_mouse_loc(input);

platf::abs_mouse(input, platf::touch_port_t {}, mouse_pos.x, mouse_pos.y);
#ifdef _WIN32
platf::touch_port_t abs_port {
0, 0,
65535, 65535
};
#elif __linux__
platf::touch_port_t abs_port {
0, 0,
19200, 12000
};
#else
platf::touch_port_t abs_port { };
#endif
platf::abs_mouse(input, abs_port, mouse_pos.x, mouse_pos.y);
std::this_thread::sleep_for(std::chrono::milliseconds(200));

auto new_loc = platf::get_mouse_loc(input);
Expand Down

0 comments on commit 5155fd4

Please sign in to comment.