mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
SDL_HINT_MOUSE_TOUCH_EVENTS: move tracking appart in case of 'window' is null
This commit is contained in:
parent
a1a9fd50c6
commit
eb7affeeb8
@ -486,14 +486,14 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
|
|||||||
/* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */
|
/* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */
|
||||||
if (mouse->mouse_touch_events) {
|
if (mouse->mouse_touch_events) {
|
||||||
if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) {
|
if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) {
|
||||||
if (window) {
|
|
||||||
float fx = (float)mouse->x / (float)window->w;
|
|
||||||
float fy = (float)mouse->y / (float)window->h;
|
|
||||||
if (state == SDL_PRESSED) {
|
if (state == SDL_PRESSED) {
|
||||||
track_mouse_down = SDL_TRUE;
|
track_mouse_down = SDL_TRUE;
|
||||||
} else {
|
} else {
|
||||||
track_mouse_down = SDL_FALSE;
|
track_mouse_down = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
if (window) {
|
||||||
|
float fx = (float)mouse->x / (float)window->w;
|
||||||
|
float fy = (float)mouse->y / (float)window->h;
|
||||||
SDL_SendTouch(SDL_MOUSE_TOUCHID, 0, track_mouse_down, fx, fy, 1.0f);
|
SDL_SendTouch(SDL_MOUSE_TOUCHID, 0, track_mouse_down, fx, fy, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user