mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Updates SDL to 2.0.12
This commit is contained in:
parent
3108a08650
commit
a526029f2f
861 changed files with 25596 additions and 8904 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -33,6 +33,13 @@
|
|||
#include "../video/SDL_sysvideo.h"
|
||||
#include "SDL_syswm.h"
|
||||
|
||||
#undef SDL_PRIs64
|
||||
#ifdef __WIN32__
|
||||
#define SDL_PRIs64 "I64d"
|
||||
#else
|
||||
#define SDL_PRIs64 "lld"
|
||||
#endif
|
||||
|
||||
/* An arbitrary limit so we don't have unbounded growth */
|
||||
#define SDL_MAX_QUEUED_EVENTS 65535
|
||||
|
||||
|
|
@ -279,8 +286,8 @@ SDL_LogEvent(const SDL_Event *event)
|
|||
|
||||
#define PRINT_FINGER_EVENT(event) \
|
||||
SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
|
||||
(uint) event->tfinger.timestamp, event->tfinger.touchId, \
|
||||
event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
||||
(uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
|
||||
(long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
||||
SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
|
||||
|
|
@ -289,8 +296,8 @@ SDL_LogEvent(const SDL_Event *event)
|
|||
|
||||
#define PRINT_DOLLAR_EVENT(event) \
|
||||
SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
|
||||
(uint) event->dgesture.timestamp, event->dgesture.touchId, \
|
||||
event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
|
||||
(uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
|
||||
(long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
|
||||
event->dgesture.error, event->dgesture.x, event->dgesture.y);
|
||||
SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
|
||||
|
|
@ -298,7 +305,7 @@ SDL_LogEvent(const SDL_Event *event)
|
|||
|
||||
SDL_EVENT_CASE(SDL_MULTIGESTURE)
|
||||
SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
|
||||
(uint) event->mgesture.timestamp, event->mgesture.touchId,
|
||||
(uint) event->mgesture.timestamp, (long long)event->mgesture.touchId,
|
||||
event->mgesture.dTheta, event->mgesture.dDist,
|
||||
event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers);
|
||||
break;
|
||||
|
|
@ -728,7 +735,7 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
|
|||
/* Timeout expired and no events */
|
||||
return 0;
|
||||
}
|
||||
SDL_Delay(10);
|
||||
SDL_Delay(1);
|
||||
break;
|
||||
default:
|
||||
/* Has events */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -36,12 +36,14 @@
|
|||
|
||||
#define MAXPATHSIZE 1024
|
||||
|
||||
#define DOLLARNPOINTS 64
|
||||
#define DOLLARSIZE 256
|
||||
|
||||
#define ENABLE_DOLLAR
|
||||
|
||||
#define PHI 0.618033989
|
||||
#define DOLLARNPOINTS 64
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
# define DOLLARSIZE 256
|
||||
# define PHI 0.618033989
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
float x,y;
|
||||
|
|
@ -335,7 +337,7 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
|
|||
}
|
||||
|
||||
/* DollarPath contains raw points, plus (possibly) the calculated length */
|
||||
static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
|
||||
static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SDL_bool is_recording)
|
||||
{
|
||||
int i;
|
||||
float interval;
|
||||
|
|
@ -381,7 +383,9 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
|
|||
dist += d;
|
||||
}
|
||||
if (numPoints < DOLLARNPOINTS-1) {
|
||||
SDL_SetError("ERROR: NumPoints = %i", numPoints);
|
||||
if (is_recording) {
|
||||
SDL_SetError("ERROR: NumPoints = %i", numPoints);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* copy the last point */
|
||||
|
|
@ -435,7 +439,7 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
|
|||
|
||||
SDL_memset(points, 0, sizeof(points));
|
||||
|
||||
dollarNormalize(path,points);
|
||||
dollarNormalize(path, points, SDL_FALSE);
|
||||
|
||||
/* PrintPath(points); */
|
||||
*bestTempl = -1;
|
||||
|
|
@ -498,43 +502,48 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
|
||||
static void SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.mgesture.type = SDL_MULTIGESTURE;
|
||||
event.mgesture.touchId = touch->id;
|
||||
event.mgesture.x = touch->centroid.x;
|
||||
event.mgesture.y = touch->centroid.y;
|
||||
event.mgesture.dTheta = dTheta;
|
||||
event.mgesture.dDist = dDist;
|
||||
event.mgesture.numFingers = touch->numDownFingers;
|
||||
return SDL_PushEvent(&event) > 0;
|
||||
if (SDL_GetEventState(SDL_MULTIGESTURE) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.mgesture.type = SDL_MULTIGESTURE;
|
||||
event.mgesture.touchId = touch->id;
|
||||
event.mgesture.x = touch->centroid.x;
|
||||
event.mgesture.y = touch->centroid.y;
|
||||
event.mgesture.dTheta = dTheta;
|
||||
event.mgesture.dDist = dDist;
|
||||
event.mgesture.numFingers = touch->numDownFingers;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
|
||||
static void SDL_SendGestureDollar(SDL_GestureTouch* touch,
|
||||
SDL_GestureID gestureId,float error)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.dgesture.type = SDL_DOLLARGESTURE;
|
||||
event.dgesture.touchId = touch->id;
|
||||
event.dgesture.x = touch->centroid.x;
|
||||
event.dgesture.y = touch->centroid.y;
|
||||
event.dgesture.gestureId = gestureId;
|
||||
event.dgesture.error = error;
|
||||
/* A finger came up to trigger this event. */
|
||||
event.dgesture.numFingers = touch->numDownFingers + 1;
|
||||
return SDL_PushEvent(&event) > 0;
|
||||
if (SDL_GetEventState(SDL_DOLLARGESTURE) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.dgesture.type = SDL_DOLLARGESTURE;
|
||||
event.dgesture.touchId = touch->id;
|
||||
event.dgesture.x = touch->centroid.x;
|
||||
event.dgesture.y = touch->centroid.y;
|
||||
event.dgesture.gestureId = gestureId;
|
||||
event.dgesture.error = error;
|
||||
/* A finger came up to trigger this event. */
|
||||
event.dgesture.numFingers = touch->numDownFingers + 1;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
|
||||
static void SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.dgesture.type = SDL_DOLLARRECORD;
|
||||
event.dgesture.touchId = touch->id;
|
||||
event.dgesture.gestureId = gestureId;
|
||||
return SDL_PushEvent(&event) > 0;
|
||||
if (SDL_GetEventState(SDL_DOLLARRECORD) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.dgesture.type = SDL_DOLLARRECORD;
|
||||
event.dgesture.touchId = touch->id;
|
||||
event.dgesture.gestureId = gestureId;
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -576,7 +585,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
|
|||
#if defined(ENABLE_DOLLAR)
|
||||
if (inTouch->recording) {
|
||||
inTouch->recording = SDL_FALSE;
|
||||
dollarNormalize(&inTouch->dollarPath,path);
|
||||
dollarNormalize(&inTouch->dollarPath, path, SDL_TRUE);
|
||||
/* PrintPath(path); */
|
||||
if (recordAll) {
|
||||
index = SDL_AddDollarGesture(NULL,path);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -878,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
|||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
||||
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -905,7 +905,7 @@ const char *
|
|||
SDL_GetScancodeName(SDL_Scancode scancode)
|
||||
{
|
||||
const char *name;
|
||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
||||
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#include "SDL_timer.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "../SDL_hints_c.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
#ifdef __WIN32__
|
||||
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
|
||||
|
|
@ -100,30 +101,21 @@ SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldVal
|
|||
{
|
||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||
|
||||
if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) {
|
||||
mouse->touch_mouse_events = SDL_FALSE;
|
||||
} else {
|
||||
mouse->touch_mouse_events = SDL_TRUE;
|
||||
}
|
||||
mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE);
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||
SDL_bool default_value;
|
||||
|
||||
if (hint == NULL || *hint == '\0') {
|
||||
/* Default */
|
||||
#if defined(__ANDROID__) || (defined(__IPHONEOS__) && !defined(__TVOS__))
|
||||
mouse->mouse_touch_events = SDL_TRUE;
|
||||
default_value = SDL_TRUE;
|
||||
#else
|
||||
mouse->mouse_touch_events = SDL_FALSE;
|
||||
default_value = SDL_FALSE;
|
||||
#endif
|
||||
} else if (*hint == '1' || SDL_strcasecmp(hint, "true") == 0) {
|
||||
mouse->mouse_touch_events = SDL_TRUE;
|
||||
} else {
|
||||
mouse->mouse_touch_events = SDL_FALSE;
|
||||
}
|
||||
mouse->mouse_touch_events = SDL_GetStringBoolean(hint, default_value);
|
||||
|
||||
if (mouse->mouse_touch_events) {
|
||||
SDL_AddTouch(SDL_MOUSE_TOUCHID, SDL_TOUCH_DEVICE_DIRECT, "mouse_input");
|
||||
|
|
@ -339,7 +331,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
if (window) {
|
||||
float fx = (float)x / (float)window->w;
|
||||
float fy = (float)y / (float)window->h;
|
||||
SDL_SendTouchMotion(SDL_MOUSE_TOUCHID, 0, fx, fy, 1.0f);
|
||||
SDL_SendTouchMotion(SDL_MOUSE_TOUCHID, 0, window, fx, fy, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -381,19 +373,16 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
yrel = y - mouse->last_y;
|
||||
}
|
||||
|
||||
/* Drop events that don't change state */
|
||||
if (!xrel && !yrel) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
printf("Mouse event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ignore relative motion when first positioning the mouse */
|
||||
if (!mouse->has_position) {
|
||||
xrel = 0;
|
||||
yrel = 0;
|
||||
mouse->has_position = SDL_TRUE;
|
||||
} else if (!xrel && !yrel) { /* Drop events that don't change state */
|
||||
#ifdef DEBUG_MOUSE
|
||||
printf("Mouse event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ignore relative motion positioning the first touch */
|
||||
|
|
@ -509,7 +498,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
|
|||
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, window, track_mouse_down, fx, fy, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -239,7 +239,7 @@ SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid)
|
|||
}
|
||||
|
||||
int
|
||||
SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
||||
SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
SDL_bool down, float x, float y, float pressure)
|
||||
{
|
||||
int posted;
|
||||
|
|
@ -259,16 +259,6 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
if (mouse->touch_mouse_events) {
|
||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
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 (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
|
|
@ -332,6 +322,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
event.tfinger.dx = 0;
|
||||
event.tfinger.dy = 0;
|
||||
event.tfinger.pressure = pressure;
|
||||
event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -344,7 +335,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERUP;
|
||||
event.tfinger.touchId = id;
|
||||
event.tfinger.touchId = id;
|
||||
event.tfinger.fingerId = fingerid;
|
||||
/* I don't trust the coordinates passed on fingerUp */
|
||||
event.tfinger.x = finger->x;
|
||||
|
|
@ -352,6 +343,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
event.tfinger.dx = 0;
|
||||
event.tfinger.dy = 0;
|
||||
event.tfinger.pressure = pressure;
|
||||
event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +353,7 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
}
|
||||
|
||||
int
|
||||
SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
|
||||
SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
float x, float y, float pressure)
|
||||
{
|
||||
SDL_Touch *touch;
|
||||
|
|
@ -382,7 +374,6 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
{
|
||||
if (mouse->touch_mouse_events) {
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
SDL_Window *window = SDL_GetMouseFocus();
|
||||
if (window) {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
|
|
@ -408,7 +399,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
|
||||
finger = SDL_GetFinger(touch,fingerid);
|
||||
if (!finger) {
|
||||
return SDL_SendTouch(id, fingerid, SDL_TRUE, x, y, pressure);
|
||||
return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure);
|
||||
}
|
||||
|
||||
xrel = x - finger->x;
|
||||
|
|
@ -440,6 +431,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
|
|||
event.tfinger.dx = xrel;
|
||||
event.tfinger.dy = yrel;
|
||||
event.tfinger.pressure = pressure;
|
||||
event.tfinger.windowID = window ? SDL_GetWindowID(window) : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
return posted;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -44,11 +44,11 @@ extern int SDL_AddTouch(SDL_TouchID id, SDL_TouchDeviceType type, const char *na
|
|||
extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
|
||||
|
||||
/* Send a touch down/up event for a touch */
|
||||
extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
|
||||
extern int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
SDL_bool down, float x, float y, float pressure);
|
||||
|
||||
/* Send a touch motion event for a touch */
|
||||
extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid,
|
||||
extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
float x, float y, float pressure);
|
||||
|
||||
/* Remove a touch */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -299,12 +299,12 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 115 */ SDL_SCANCODE_VOLUMEUP,
|
||||
/* 116 */ SDL_SCANCODE_POWER,
|
||||
/* 117 */ SDL_SCANCODE_KP_EQUALS,
|
||||
/* 118 */ SDL_SCANCODE_UNKNOWN, /* plusminus */
|
||||
/* 118 */ SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */
|
||||
/* 119 */ SDL_SCANCODE_PAUSE,
|
||||
/* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */
|
||||
/* 121 */ SDL_SCANCODE_UNKNOWN, /* KP_Decimal */
|
||||
/* 122 */ SDL_SCANCODE_UNKNOWN, /* Hangul */
|
||||
/* 123 */ SDL_SCANCODE_UNKNOWN, /* Hangul_Hanja */
|
||||
/* 121 */ SDL_SCANCODE_KP_COMMA, /* KP_Decimal */
|
||||
/* 122 */ SDL_SCANCODE_LANG1, /* Hangul */
|
||||
/* 123 */ SDL_SCANCODE_LANG2, /* Hangul_Hanja */
|
||||
/* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
|
||||
/* 125 */ SDL_SCANCODE_LGUI,
|
||||
/* 126 */ SDL_SCANCODE_RGUI,
|
||||
|
|
@ -320,7 +320,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 136 */ SDL_SCANCODE_FIND,
|
||||
/* 137 */ SDL_SCANCODE_CUT,
|
||||
/* 138 */ SDL_SCANCODE_HELP,
|
||||
/* 139 */ SDL_SCANCODE_UNKNOWN, /* XF86MenuKB */
|
||||
/* 139 */ SDL_SCANCODE_MENU, /* XF86MenuKB */
|
||||
/* 140 */ SDL_SCANCODE_CALCULATOR,
|
||||
/* 141 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 142 */ SDL_SCANCODE_SLEEP,
|
||||
|
|
@ -360,8 +360,8 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 176 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */
|
||||
/* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */
|
||||
/* 179 */ SDL_SCANCODE_UNKNOWN, /* parenleft */
|
||||
/* 180 */ SDL_SCANCODE_UNKNOWN, /* parenright */
|
||||
/* 179 */ SDL_SCANCODE_KP_LEFTPAREN, /* parenleft */
|
||||
/* 180 */ SDL_SCANCODE_KP_RIGHTPAREN, /* parenright */
|
||||
/* 181 */ SDL_SCANCODE_UNKNOWN, /* XF86New */
|
||||
/* 182 */ SDL_SCANCODE_AGAIN,
|
||||
/* 183 */ SDL_SCANCODE_F13, /* XF86Tools */
|
||||
|
|
@ -371,7 +371,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 187 */ SDL_SCANCODE_F17, /* XF86Launch8 */
|
||||
/* 188 */ SDL_SCANCODE_F18, /* XF86Launch9 */
|
||||
/* 189 */ SDL_SCANCODE_F19, /* null keysym */
|
||||
/* 190 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 190 */ SDL_SCANCODE_F20,
|
||||
/* 191 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */
|
||||
/* 193 */ SDL_SCANCODE_UNKNOWN,
|
||||
|
|
@ -389,7 +389,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */
|
||||
/* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
|
||||
/* 207 */ SDL_SCANCODE_AUDIOPLAY,
|
||||
/* 208 */ SDL_SCANCODE_AUDIONEXT,
|
||||
/* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD,
|
||||
/* 209 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 210 */ SDL_SCANCODE_PRINTSCREEN,
|
||||
/* 211 */ SDL_SCANCODE_UNKNOWN,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue