EmuWindow: Clip mouse input coordinates to emulated screen dimensions.

If the mouse position for a mouse move/drag would take it outside the emulated screen dimensions, clip the coordinates to
the emulated screen dimensions.
Qt and GLFW will report negative coordinates for mouse positions to the left, or above citra window. Added restriction
to mouse coordinates passed to touchmoved by Qt/GLFW to be greater or equal to zero.
This commit is contained in:
Zaneo 2015-04-14 00:06:44 -04:00
parent 5b9bbc37d4
commit b8328593fe
4 changed files with 23 additions and 8 deletions

View file

@ -206,5 +206,10 @@ private:
u16 touch_x; ///< Touchpad X-position in native 3DS pixel coordinates (0-320)
u16 touch_y; ///< Touchpad Y-position in native 3DS pixel coordinates (0-240)
/**
* Clip the provided coordinates to be inside the touchscreen area.
*/
std::tuple<unsigned,unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y);
Service::HID::PadState pad_state;
};