mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fix synthetically generated mouse events getting lost forever after the device orientation changes (or the window is otherwise resized) while a finger is touching the screen.
This commit is contained in:
parent
f4625f52f2
commit
9306ef9b10
@ -262,6 +262,15 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||||
if (id != SDL_MOUSE_TOUCHID) {
|
if (id != SDL_MOUSE_TOUCHID) {
|
||||||
SDL_Window *window = SDL_GetMouseFocus();
|
SDL_Window *window = SDL_GetMouseFocus();
|
||||||
|
if (window == NULL) {
|
||||||
|
/* Mouse focus may have been lost by e.g. the window resizing
|
||||||
|
* due to device orientation change while the mouse state is
|
||||||
|
* pressed (because its position is now out of the window).
|
||||||
|
* SendMouse* will update mouse focus again after that, but
|
||||||
|
* if those are never called then SDL might think the
|
||||||
|
* 'mouse' has no focus at all. */
|
||||||
|
window = SDL_GetKeyboardFocus();
|
||||||
|
}
|
||||||
if (window) {
|
if (window) {
|
||||||
if (down) {
|
if (down) {
|
||||||
if (finger_touching == SDL_FALSE) {
|
if (finger_touching == SDL_FALSE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user