Skip to content

Commit

Permalink
Keep x/y values within viewport resolution for screen mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickStankard committed Feb 20, 2024
1 parent db017ea commit 597a821
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions input/drivers/android_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,13 @@ static INLINE void android_mouse_calculate_deltas(android_input_t *android,
if (!x) x = android->mouse_x + android->mouse_x_delta;
if (!y) y = android->mouse_y + android->mouse_y_delta;

/* x and y are used for the screen mouse, so we want
* to avoid values outside of the viewport resolution */
if (x < x_min) x = x_min;
else if (x > x_max) x = x_max;
if (y < y_min) y = y_min;
else if (y > y_max) y = y_max;

android->mouse_x = x;
android->mouse_y = y;
}
Expand Down

0 comments on commit 597a821

Please sign in to comment.