mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Merge pull request #11876 from AreaScout/master
Fix: touchscreen evens on upcomming SDL2 versions which includes the …
This commit is contained in:
commit
2b605f1370
@ -479,6 +479,8 @@ int main(int argc, char *argv[]) {
|
||||
printf("DEBUG: Vulkan is not available, not using Vulkan.\n");
|
||||
}
|
||||
|
||||
SDL_version compiled;
|
||||
SDL_version linked;
|
||||
int set_xres = -1;
|
||||
int set_yres = -1;
|
||||
int w = 0, h = 0;
|
||||
@ -536,6 +538,15 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
SDL_VERSION(&compiled);
|
||||
SDL_GetVersion(&linked);
|
||||
printf("Info: We compiled against SDL version %d.%d.%d", compiled.major, compiled.minor, compiled.patch);
|
||||
if (compiled.minor != linked.minor || compiled.patch != linked.patch) {
|
||||
printf(", but we are linking against SDL version %d.%d.%d., be aware that this can lead to unexpected behaviors\n", linked.major, linked.minor, linked.patch);
|
||||
} else {
|
||||
printf(" and we are linking against SDL version %d.%d.%d. :)\n", linked.major, linked.minor, linked.patch);
|
||||
}
|
||||
|
||||
// Get the video info before doing anything else, so we don't get skewed resolution results.
|
||||
// TODO: support multiple displays correctly
|
||||
SDL_DisplayMode displayMode;
|
||||
@ -847,6 +858,7 @@ int main(int argc, char *argv[]) {
|
||||
NativeKey(key);
|
||||
break;
|
||||
}
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
// This behavior doesn't feel right on a macbook with a touchpad.
|
||||
#if !PPSSPP_PLATFORM(MAC)
|
||||
case SDL_FINGERMOTION:
|
||||
@ -856,7 +868,6 @@ int main(int argc, char *argv[]) {
|
||||
touchEvent.motion.type = SDL_MOUSEMOTION;
|
||||
touchEvent.motion.timestamp = event.tfinger.timestamp;
|
||||
touchEvent.motion.windowID = SDL_GetWindowID(window);
|
||||
touchEvent.motion.which = SDL_TOUCH_MOUSEID;
|
||||
touchEvent.motion.state = SDL_GetMouseState(NULL, NULL);
|
||||
touchEvent.motion.x = event.tfinger.x * w;
|
||||
touchEvent.motion.y = event.tfinger.y * h;
|
||||
@ -873,7 +884,6 @@ int main(int argc, char *argv[]) {
|
||||
touchEvent.button.type = SDL_MOUSEBUTTONDOWN;
|
||||
touchEvent.button.timestamp = SDL_GetTicks();
|
||||
touchEvent.button.windowID = SDL_GetWindowID(window);
|
||||
touchEvent.button.which = SDL_TOUCH_MOUSEID;
|
||||
touchEvent.button.button = SDL_BUTTON_LEFT;
|
||||
touchEvent.button.state = SDL_PRESSED;
|
||||
touchEvent.button.clicks = 1;
|
||||
@ -883,7 +893,6 @@ int main(int argc, char *argv[]) {
|
||||
touchEvent.motion.type = SDL_MOUSEMOTION;
|
||||
touchEvent.motion.timestamp = SDL_GetTicks();
|
||||
touchEvent.motion.windowID = SDL_GetWindowID(window);
|
||||
touchEvent.motion.which = SDL_TOUCH_MOUSEID;
|
||||
touchEvent.motion.x = event.tfinger.x * w;
|
||||
touchEvent.motion.y = event.tfinger.y * h;
|
||||
// Any real mouse cursor should also move
|
||||
@ -902,7 +911,6 @@ int main(int argc, char *argv[]) {
|
||||
touchEvent.button.type = SDL_MOUSEBUTTONUP;
|
||||
touchEvent.button.timestamp = SDL_GetTicks();
|
||||
touchEvent.button.windowID = SDL_GetWindowID(window);
|
||||
touchEvent.button.which = SDL_TOUCH_MOUSEID;
|
||||
touchEvent.button.button = SDL_BUTTON_LEFT;
|
||||
touchEvent.button.state = SDL_RELEASED;
|
||||
touchEvent.button.clicks = 1;
|
||||
@ -911,6 +919,7 @@ int main(int argc, char *argv[]) {
|
||||
SDL_PushEvent(&touchEvent);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
switch (event.button.button) {
|
||||
|
Loading…
Reference in New Issue
Block a user