early-access version 1611
This commit is contained in:
46
externals/SDL/src/events/SDL_clipboardevents.c
vendored
Executable file
46
externals/SDL/src/events/SDL_clipboardevents.c
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* Clipboard event handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_clipboardevents_c.h"
|
||||
|
||||
|
||||
int
|
||||
SDL_SendClipboardUpdate(void)
|
||||
{
|
||||
int posted;
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_CLIPBOARDUPDATE;
|
||||
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
return (posted);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
30
externals/SDL/src/events/SDL_clipboardevents_c.h
vendored
Executable file
30
externals/SDL/src/events/SDL_clipboardevents_c.h
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_clipboardevents_c_h_
|
||||
#define SDL_clipboardevents_c_h_
|
||||
|
||||
extern int SDL_SendClipboardUpdate(void);
|
||||
|
||||
#endif /* SDL_clipboardevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
60
externals/SDL/src/events/SDL_displayevents.c
vendored
Executable file
60
externals/SDL/src/events/SDL_displayevents.c
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* Display event handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
|
||||
|
||||
int
|
||||
SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1)
|
||||
{
|
||||
int posted;
|
||||
|
||||
if (!display) {
|
||||
return 0;
|
||||
}
|
||||
switch (displayevent) {
|
||||
case SDL_DISPLAYEVENT_ORIENTATION:
|
||||
if (data1 == SDL_ORIENTATION_UNKNOWN || data1 == display->orientation) {
|
||||
return 0;
|
||||
}
|
||||
display->orientation = (SDL_DisplayOrientation)data1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_DISPLAYEVENT) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_DISPLAYEVENT;
|
||||
event.display.event = displayevent;
|
||||
event.display.display = SDL_GetIndexOfDisplay(display);
|
||||
event.display.data1 = data1;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
|
||||
return (posted);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
30
externals/SDL/src/events/SDL_displayevents_c.h
vendored
Executable file
30
externals/SDL/src/events/SDL_displayevents_c.h
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_displayevents_c_h_
|
||||
#define SDL_displayevents_c_h_
|
||||
|
||||
extern int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data1);
|
||||
|
||||
#endif /* SDL_displayevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
98
externals/SDL/src/events/SDL_dropevents.c
vendored
Executable file
98
externals/SDL/src/events/SDL_dropevents.c
vendored
Executable file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* Drag and drop event handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_dropevents_c.h"
|
||||
|
||||
#include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */
|
||||
|
||||
|
||||
static int
|
||||
SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
|
||||
{
|
||||
static SDL_bool app_is_dropping = SDL_FALSE;
|
||||
int posted = 0;
|
||||
|
||||
/* Post the event, if desired */
|
||||
if (SDL_GetEventState(evtype) == SDL_ENABLE) {
|
||||
const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping;
|
||||
SDL_Event event;
|
||||
|
||||
if (need_begin) {
|
||||
SDL_zero(event);
|
||||
event.type = SDL_DROPBEGIN;
|
||||
|
||||
if (window) {
|
||||
event.drop.windowID = window->id;
|
||||
}
|
||||
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
if (!posted) {
|
||||
return 0;
|
||||
}
|
||||
if (window) {
|
||||
window->is_dropping = SDL_TRUE;
|
||||
} else {
|
||||
app_is_dropping = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_zero(event);
|
||||
event.type = evtype;
|
||||
event.drop.file = data ? SDL_strdup(data) : NULL;
|
||||
event.drop.windowID = window ? window->id : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
|
||||
if (posted && (evtype == SDL_DROPCOMPLETE)) {
|
||||
if (window) {
|
||||
window->is_dropping = SDL_FALSE;
|
||||
} else {
|
||||
app_is_dropping = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return posted;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendDropFile(SDL_Window *window, const char *file)
|
||||
{
|
||||
return SDL_SendDrop(window, SDL_DROPFILE, file);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendDropText(SDL_Window *window, const char *text)
|
||||
{
|
||||
return SDL_SendDrop(window, SDL_DROPTEXT, text);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendDropComplete(SDL_Window *window)
|
||||
{
|
||||
return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
32
externals/SDL/src/events/SDL_dropevents_c.h
vendored
Executable file
32
externals/SDL/src/events/SDL_dropevents_c.h
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_dropevents_c_h_
|
||||
#define SDL_dropevents_c_h_
|
||||
|
||||
extern int SDL_SendDropFile(SDL_Window *window, const char *file);
|
||||
extern int SDL_SendDropText(SDL_Window *window, const char *text);
|
||||
extern int SDL_SendDropComplete(SDL_Window *window);
|
||||
|
||||
#endif /* SDL_dropevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
1030
externals/SDL/src/events/SDL_events.c
vendored
Executable file
1030
externals/SDL/src/events/SDL_events.c
vendored
Executable file
File diff suppressed because it is too large
Load Diff
62
externals/SDL/src/events/SDL_events_c.h
vendored
Executable file
62
externals/SDL/src/events/SDL_events_c.h
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_events_c_h_
|
||||
#define SDL_events_c_h_
|
||||
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* Useful functions and variables from SDL_events.c */
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
#include "SDL_clipboardevents_c.h"
|
||||
#include "SDL_displayevents_c.h"
|
||||
#include "SDL_dropevents_c.h"
|
||||
#include "SDL_gesture_c.h"
|
||||
#include "SDL_keyboard_c.h"
|
||||
#include "SDL_mouse_c.h"
|
||||
#include "SDL_touch_c.h"
|
||||
#include "SDL_windowevents_c.h"
|
||||
|
||||
/* Start and stop the event processing loop */
|
||||
extern int SDL_StartEventLoop(void);
|
||||
extern void SDL_StopEventLoop(void);
|
||||
extern void SDL_QuitInterrupt(void);
|
||||
|
||||
extern int SDL_SendAppEvent(SDL_EventType eventType);
|
||||
extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
|
||||
extern int SDL_SendKeymapChangedEvent(void);
|
||||
|
||||
extern int SDL_SendQuit(void);
|
||||
|
||||
extern int SDL_EventsInit(void);
|
||||
extern void SDL_EventsQuit(void);
|
||||
|
||||
extern void SDL_SendPendingSignalEvents(void);
|
||||
|
||||
extern int SDL_QuitInit(void);
|
||||
extern void SDL_QuitQuit(void);
|
||||
|
||||
#endif /* SDL_events_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
717
externals/SDL/src/events/SDL_gesture.c
vendored
Executable file
717
externals/SDL/src/events/SDL_gesture.c
vendored
Executable file
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* General gesture handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_gesture_c.h"
|
||||
|
||||
/*
|
||||
#include <stdio.h>
|
||||
*/
|
||||
|
||||
/* TODO: Replace with malloc */
|
||||
|
||||
#define MAXPATHSIZE 1024
|
||||
|
||||
#define ENABLE_DOLLAR
|
||||
|
||||
#define DOLLARNPOINTS 64
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
# define DOLLARSIZE 256
|
||||
# define PHI 0.618033989
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
float x,y;
|
||||
} SDL_FloatPoint;
|
||||
|
||||
typedef struct {
|
||||
float length;
|
||||
|
||||
int numPoints;
|
||||
SDL_FloatPoint p[MAXPATHSIZE];
|
||||
} SDL_DollarPath;
|
||||
|
||||
typedef struct {
|
||||
SDL_FloatPoint path[DOLLARNPOINTS];
|
||||
unsigned long hash;
|
||||
} SDL_DollarTemplate;
|
||||
|
||||
typedef struct {
|
||||
SDL_TouchID id;
|
||||
SDL_FloatPoint centroid;
|
||||
SDL_DollarPath dollarPath;
|
||||
Uint16 numDownFingers;
|
||||
|
||||
int numDollarTemplates;
|
||||
SDL_DollarTemplate *dollarTemplate;
|
||||
|
||||
SDL_bool recording;
|
||||
} SDL_GestureTouch;
|
||||
|
||||
static SDL_GestureTouch *SDL_gestureTouch;
|
||||
static int SDL_numGestureTouches = 0;
|
||||
static SDL_bool recordAll;
|
||||
|
||||
#if 0
|
||||
static void PrintPath(SDL_FloatPoint *path)
|
||||
{
|
||||
int i;
|
||||
printf("Path:");
|
||||
for (i=0; i<DOLLARNPOINTS; i++) {
|
||||
printf(" (%f,%f)",path[i].x,path[i].y);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
int SDL_RecordGesture(SDL_TouchID touchId)
|
||||
{
|
||||
int i;
|
||||
if (touchId < 0) recordAll = SDL_TRUE;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
if ((touchId < 0) || (SDL_gestureTouch[i].id == touchId)) {
|
||||
SDL_gestureTouch[i].recording = SDL_TRUE;
|
||||
if (touchId >= 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return (touchId < 0);
|
||||
}
|
||||
|
||||
void SDL_GestureQuit()
|
||||
{
|
||||
SDL_free(SDL_gestureTouch);
|
||||
SDL_gestureTouch = NULL;
|
||||
}
|
||||
|
||||
static unsigned long SDL_HashDollar(SDL_FloatPoint* points)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int i;
|
||||
for (i = 0; i < DOLLARNPOINTS; i++) {
|
||||
hash = ((hash<<5) + hash) + (unsigned long)points[i].x;
|
||||
hash = ((hash<<5) + hash) + (unsigned long)points[i].y;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst)
|
||||
{
|
||||
if (dst == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* No Longer storing the Hash, rehash on load */
|
||||
/* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
if (SDL_RWwrite(dst, templ->path,
|
||||
sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
SDL_DollarTemplate copy = *templ;
|
||||
SDL_FloatPoint *p = copy.path;
|
||||
int i;
|
||||
for (i = 0; i < DOLLARNPOINTS; i++, p++) {
|
||||
p->x = SDL_SwapFloatLE(p->x);
|
||||
p->y = SDL_SwapFloatLE(p->y);
|
||||
}
|
||||
|
||||
if (SDL_RWwrite(dst, copy.path,
|
||||
sizeof(copy.path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int SDL_SaveAllDollarTemplates(SDL_RWops *dst)
|
||||
{
|
||||
int i,j,rtrn = 0;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
rtrn += SaveTemplate(&touch->dollarTemplate[j], dst);
|
||||
}
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst)
|
||||
{
|
||||
int i,j;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
if (touch->dollarTemplate[j].hash == gestureId) {
|
||||
return SaveTemplate(&touch->dollarTemplate[j], dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SDL_SetError("Unknown gestureId");
|
||||
}
|
||||
|
||||
/* path is an already sampled set of points
|
||||
Returns the index of the gesture on success, or -1 */
|
||||
static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
|
||||
{
|
||||
SDL_DollarTemplate* dollarTemplate;
|
||||
SDL_DollarTemplate *templ;
|
||||
int index;
|
||||
|
||||
index = inTouch->numDollarTemplates;
|
||||
dollarTemplate =
|
||||
(SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate,
|
||||
(index + 1) *
|
||||
sizeof(SDL_DollarTemplate));
|
||||
if (!dollarTemplate) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
inTouch->dollarTemplate = dollarTemplate;
|
||||
|
||||
templ = &inTouch->dollarTemplate[index];
|
||||
SDL_memcpy(templ->path, path, DOLLARNPOINTS*sizeof(SDL_FloatPoint));
|
||||
templ->hash = SDL_HashDollar(templ->path);
|
||||
inTouch->numDollarTemplates++;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
|
||||
{
|
||||
int index = -1;
|
||||
int i = 0;
|
||||
if (inTouch == NULL) {
|
||||
if (SDL_numGestureTouches == 0) return SDL_SetError("no gesture touch devices registered");
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
inTouch = &SDL_gestureTouch[i];
|
||||
index = SDL_AddDollarGesture_one(inTouch, path);
|
||||
if (index < 0)
|
||||
return -1;
|
||||
}
|
||||
/* Use the index of the last one added. */
|
||||
return index;
|
||||
}
|
||||
return SDL_AddDollarGesture_one(inTouch, path);
|
||||
}
|
||||
|
||||
int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
|
||||
{
|
||||
int i,loaded = 0;
|
||||
SDL_GestureTouch *touch = NULL;
|
||||
if (src == NULL) return 0;
|
||||
if (touchId >= 0) {
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
if (SDL_gestureTouch[i].id == touchId) {
|
||||
touch = &SDL_gestureTouch[i];
|
||||
}
|
||||
}
|
||||
if (touch == NULL) {
|
||||
return SDL_SetError("given touch id not found");
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
SDL_DollarTemplate templ;
|
||||
|
||||
if (SDL_RWread(src,templ.path,sizeof(templ.path[0]),DOLLARNPOINTS) < DOLLARNPOINTS) {
|
||||
if (loaded == 0) {
|
||||
return SDL_SetError("could not read any dollar gesture from rwops");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||
for (i = 0; i < DOLLARNPOINTS; i++) {
|
||||
SDL_FloatPoint *p = &templ.path[i];
|
||||
p->x = SDL_SwapFloatLE(p->x);
|
||||
p->y = SDL_SwapFloatLE(p->y);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (touchId >= 0) {
|
||||
/* printf("Adding loaded gesture to 1 touch\n"); */
|
||||
if (SDL_AddDollarGesture(touch, templ.path) >= 0)
|
||||
loaded++;
|
||||
}
|
||||
else {
|
||||
/* printf("Adding to: %i touches\n",SDL_numGestureTouches); */
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
touch = &SDL_gestureTouch[i];
|
||||
/* printf("Adding loaded gesture to + touches\n"); */
|
||||
/* TODO: What if this fails? */
|
||||
SDL_AddDollarGesture(touch,templ.path);
|
||||
}
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang)
|
||||
{
|
||||
/* SDL_FloatPoint p[DOLLARNPOINTS]; */
|
||||
float dist = 0;
|
||||
SDL_FloatPoint p;
|
||||
int i;
|
||||
for (i = 0; i < DOLLARNPOINTS; i++) {
|
||||
p.x = (float)(points[i].x * SDL_cos(ang) - points[i].y * SDL_sin(ang));
|
||||
p.y = (float)(points[i].x * SDL_sin(ang) + points[i].y * SDL_cos(ang));
|
||||
dist += (float)(SDL_sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+
|
||||
(p.y-templ[i].y)*(p.y-templ[i].y)));
|
||||
}
|
||||
return dist/DOLLARNPOINTS;
|
||||
|
||||
}
|
||||
|
||||
static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
|
||||
{
|
||||
/*------------BEGIN DOLLAR BLACKBOX------------------
|
||||
-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-
|
||||
-"http://depts.washington.edu/aimgroup/proj/dollar/"
|
||||
*/
|
||||
double ta = -M_PI/4;
|
||||
double tb = M_PI/4;
|
||||
double dt = M_PI/90;
|
||||
float x1 = (float)(PHI*ta + (1-PHI)*tb);
|
||||
float f1 = dollarDifference(points,templ,x1);
|
||||
float x2 = (float)((1-PHI)*ta + PHI*tb);
|
||||
float f2 = dollarDifference(points,templ,x2);
|
||||
while (SDL_fabs(ta-tb) > dt) {
|
||||
if (f1 < f2) {
|
||||
tb = x2;
|
||||
x2 = x1;
|
||||
f2 = f1;
|
||||
x1 = (float)(PHI*ta + (1-PHI)*tb);
|
||||
f1 = dollarDifference(points,templ,x1);
|
||||
}
|
||||
else {
|
||||
ta = x1;
|
||||
x1 = x2;
|
||||
f1 = f2;
|
||||
x2 = (float)((1-PHI)*ta + PHI*tb);
|
||||
f2 = dollarDifference(points,templ,x2);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (f1 <= f2)
|
||||
printf("Min angle (x1): %f\n",x1);
|
||||
else if (f1 > f2)
|
||||
printf("Min angle (x2): %f\n",x2);
|
||||
*/
|
||||
return SDL_min(f1,f2);
|
||||
}
|
||||
|
||||
/* DollarPath contains raw points, plus (possibly) the calculated length */
|
||||
static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SDL_bool is_recording)
|
||||
{
|
||||
int i;
|
||||
float interval;
|
||||
float dist;
|
||||
int numPoints = 0;
|
||||
SDL_FloatPoint centroid;
|
||||
float xmin,xmax,ymin,ymax;
|
||||
float ang;
|
||||
float w,h;
|
||||
float length = path->length;
|
||||
|
||||
/* Calculate length if it hasn't already been done */
|
||||
if (length <= 0) {
|
||||
for (i=1;i < path->numPoints; i++) {
|
||||
float dx = path->p[i ].x - path->p[i-1].x;
|
||||
float dy = path->p[i ].y - path->p[i-1].y;
|
||||
length += (float)(SDL_sqrt(dx*dx+dy*dy));
|
||||
}
|
||||
}
|
||||
|
||||
/* Resample */
|
||||
interval = length/(DOLLARNPOINTS - 1);
|
||||
dist = interval;
|
||||
|
||||
centroid.x = 0;centroid.y = 0;
|
||||
|
||||
/* printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y); */
|
||||
for (i = 1; i < path->numPoints; i++) {
|
||||
float d = (float)(SDL_sqrt((path->p[i-1].x-path->p[i].x)*(path->p[i-1].x-path->p[i].x)+
|
||||
(path->p[i-1].y-path->p[i].y)*(path->p[i-1].y-path->p[i].y)));
|
||||
/* printf("d = %f dist = %f/%f\n",d,dist,interval); */
|
||||
while (dist + d > interval) {
|
||||
points[numPoints].x = path->p[i-1].x +
|
||||
((interval-dist)/d)*(path->p[i].x-path->p[i-1].x);
|
||||
points[numPoints].y = path->p[i-1].y +
|
||||
((interval-dist)/d)*(path->p[i].y-path->p[i-1].y);
|
||||
centroid.x += points[numPoints].x;
|
||||
centroid.y += points[numPoints].y;
|
||||
numPoints++;
|
||||
|
||||
dist -= interval;
|
||||
}
|
||||
dist += d;
|
||||
}
|
||||
if (numPoints < DOLLARNPOINTS-1) {
|
||||
if (is_recording) {
|
||||
SDL_SetError("ERROR: NumPoints = %i", numPoints);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* copy the last point */
|
||||
points[DOLLARNPOINTS-1] = path->p[path->numPoints-1];
|
||||
numPoints = DOLLARNPOINTS;
|
||||
|
||||
centroid.x /= numPoints;
|
||||
centroid.y /= numPoints;
|
||||
|
||||
/* printf("Centroid (%f,%f)",centroid.x,centroid.y); */
|
||||
/* Rotate Points so point 0 is left of centroid and solve for the bounding box */
|
||||
xmin = centroid.x;
|
||||
xmax = centroid.x;
|
||||
ymin = centroid.y;
|
||||
ymax = centroid.y;
|
||||
|
||||
ang = (float)(SDL_atan2(centroid.y - points[0].y,
|
||||
centroid.x - points[0].x));
|
||||
|
||||
for (i = 0; i<numPoints; i++) {
|
||||
float px = points[i].x;
|
||||
float py = points[i].y;
|
||||
points[i].x = (float)((px - centroid.x)*SDL_cos(ang) -
|
||||
(py - centroid.y)*SDL_sin(ang) + centroid.x);
|
||||
points[i].y = (float)((px - centroid.x)*SDL_sin(ang) +
|
||||
(py - centroid.y)*SDL_cos(ang) + centroid.y);
|
||||
|
||||
|
||||
if (points[i].x < xmin) xmin = points[i].x;
|
||||
if (points[i].x > xmax) xmax = points[i].x;
|
||||
if (points[i].y < ymin) ymin = points[i].y;
|
||||
if (points[i].y > ymax) ymax = points[i].y;
|
||||
}
|
||||
|
||||
/* Scale points to DOLLARSIZE, and translate to the origin */
|
||||
w = xmax-xmin;
|
||||
h = ymax-ymin;
|
||||
|
||||
for (i=0; i<numPoints; i++) {
|
||||
points[i].x = (points[i].x - centroid.x)*DOLLARSIZE/w;
|
||||
points[i].y = (points[i].y - centroid.y)*DOLLARSIZE/h;
|
||||
}
|
||||
return numPoints;
|
||||
}
|
||||
|
||||
static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch)
|
||||
{
|
||||
SDL_FloatPoint points[DOLLARNPOINTS];
|
||||
int i;
|
||||
float bestDiff = 10000;
|
||||
|
||||
SDL_memset(points, 0, sizeof(points));
|
||||
|
||||
dollarNormalize(path, points, SDL_FALSE);
|
||||
|
||||
/* PrintPath(points); */
|
||||
*bestTempl = -1;
|
||||
for (i = 0; i < touch->numDollarTemplates; i++) {
|
||||
float diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
|
||||
if (diff < bestDiff) {bestDiff = diff; *bestTempl = i;}
|
||||
}
|
||||
return bestDiff;
|
||||
}
|
||||
#endif
|
||||
|
||||
int SDL_GestureAddTouch(SDL_TouchID touchId)
|
||||
{
|
||||
SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
|
||||
(SDL_numGestureTouches + 1) *
|
||||
sizeof(SDL_GestureTouch));
|
||||
|
||||
if (!gestureTouch) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_gestureTouch = gestureTouch;
|
||||
|
||||
SDL_zero(SDL_gestureTouch[SDL_numGestureTouches]);
|
||||
SDL_gestureTouch[SDL_numGestureTouches].id = touchId;
|
||||
SDL_numGestureTouches++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SDL_GestureDelTouch(SDL_TouchID touchId)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
if (SDL_gestureTouch[i].id == touchId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == SDL_numGestureTouches) {
|
||||
/* not found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_free(SDL_gestureTouch[i].dollarTemplate);
|
||||
SDL_zero(SDL_gestureTouch[i]);
|
||||
|
||||
SDL_numGestureTouches--;
|
||||
SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
/* printf("%i ?= %i\n",SDL_gestureTouch[i].id,id); */
|
||||
if (SDL_gestureTouch[i].id == id)
|
||||
return &SDL_gestureTouch[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
|
||||
{
|
||||
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 void SDL_SendGestureDollar(SDL_GestureTouch* touch,
|
||||
SDL_GestureID gestureId,float error)
|
||||
{
|
||||
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 void SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
void SDL_GestureProcessEvent(SDL_Event* event)
|
||||
{
|
||||
float x,y;
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
int index;
|
||||
int i;
|
||||
float pathDx, pathDy;
|
||||
#endif
|
||||
SDL_FloatPoint lastP;
|
||||
SDL_FloatPoint lastCentroid;
|
||||
float lDist;
|
||||
float Dist;
|
||||
float dtheta;
|
||||
float dDist;
|
||||
|
||||
if (event->type == SDL_FINGERMOTION ||
|
||||
event->type == SDL_FINGERDOWN ||
|
||||
event->type == SDL_FINGERUP) {
|
||||
SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
|
||||
|
||||
/* Shouldn't be possible */
|
||||
if (inTouch == NULL) return;
|
||||
|
||||
x = event->tfinger.x;
|
||||
y = event->tfinger.y;
|
||||
|
||||
/* Finger Up */
|
||||
if (event->type == SDL_FINGERUP) {
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
SDL_FloatPoint path[DOLLARNPOINTS];
|
||||
#endif
|
||||
|
||||
inTouch->numDownFingers--;
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
if (inTouch->recording) {
|
||||
inTouch->recording = SDL_FALSE;
|
||||
dollarNormalize(&inTouch->dollarPath, path, SDL_TRUE);
|
||||
/* PrintPath(path); */
|
||||
if (recordAll) {
|
||||
index = SDL_AddDollarGesture(NULL,path);
|
||||
for (i = 0; i < SDL_numGestureTouches; i++)
|
||||
SDL_gestureTouch[i].recording = SDL_FALSE;
|
||||
}
|
||||
else {
|
||||
index = SDL_AddDollarGesture(inTouch,path);
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash);
|
||||
}
|
||||
else {
|
||||
SDL_SendDollarRecord(inTouch,-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int bestTempl;
|
||||
float error;
|
||||
error = dollarRecognize(&inTouch->dollarPath,
|
||||
&bestTempl,inTouch);
|
||||
if (bestTempl >= 0){
|
||||
/* Send Event */
|
||||
unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
|
||||
SDL_SendGestureDollar(inTouch,gestureId,error);
|
||||
/* printf ("%s\n",);("Dollar error: %f\n",error); */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; */
|
||||
if (inTouch->numDownFingers > 0) {
|
||||
inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers+1)-
|
||||
x)/inTouch->numDownFingers;
|
||||
inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers+1)-
|
||||
y)/inTouch->numDownFingers;
|
||||
}
|
||||
}
|
||||
else if (event->type == SDL_FINGERMOTION) {
|
||||
float dx = event->tfinger.dx;
|
||||
float dy = event->tfinger.dy;
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
SDL_DollarPath* path = &inTouch->dollarPath;
|
||||
if (path->numPoints < MAXPATHSIZE) {
|
||||
path->p[path->numPoints].x = inTouch->centroid.x;
|
||||
path->p[path->numPoints].y = inTouch->centroid.y;
|
||||
pathDx =
|
||||
(path->p[path->numPoints].x-path->p[path->numPoints-1].x);
|
||||
pathDy =
|
||||
(path->p[path->numPoints].y-path->p[path->numPoints-1].y);
|
||||
path->length += (float)SDL_sqrt(pathDx*pathDx + pathDy*pathDy);
|
||||
path->numPoints++;
|
||||
}
|
||||
#endif
|
||||
lastP.x = x - dx;
|
||||
lastP.y = y - dy;
|
||||
lastCentroid = inTouch->centroid;
|
||||
|
||||
inTouch->centroid.x += dx/inTouch->numDownFingers;
|
||||
inTouch->centroid.y += dy/inTouch->numDownFingers;
|
||||
/* printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y); */
|
||||
if (inTouch->numDownFingers > 1) {
|
||||
SDL_FloatPoint lv; /* Vector from centroid to last x,y position */
|
||||
SDL_FloatPoint v; /* Vector from centroid to current x,y position */
|
||||
/* lv = inTouch->gestureLast[j].cv; */
|
||||
lv.x = lastP.x - lastCentroid.x;
|
||||
lv.y = lastP.y - lastCentroid.y;
|
||||
lDist = (float)SDL_sqrt(lv.x*lv.x + lv.y*lv.y);
|
||||
/* printf("lDist = %f\n",lDist); */
|
||||
v.x = x - inTouch->centroid.x;
|
||||
v.y = y - inTouch->centroid.y;
|
||||
/* inTouch->gestureLast[j].cv = v; */
|
||||
Dist = (float)SDL_sqrt(v.x*v.x+v.y*v.y);
|
||||
/* SDL_cos(dTheta) = (v . lv)/(|v| * |lv|) */
|
||||
|
||||
/* Normalize Vectors to simplify angle calculation */
|
||||
lv.x/=lDist;
|
||||
lv.y/=lDist;
|
||||
v.x/=Dist;
|
||||
v.y/=Dist;
|
||||
dtheta = (float)SDL_atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
|
||||
|
||||
dDist = (Dist - lDist);
|
||||
if (lDist == 0) {dDist = 0;dtheta = 0;} /* To avoid impossible values */
|
||||
|
||||
/* inTouch->gestureLast[j].dDist = dDist;
|
||||
inTouch->gestureLast[j].dtheta = dtheta;
|
||||
|
||||
printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
|
||||
gdtheta = gdtheta*.9 + dtheta*.1;
|
||||
gdDist = gdDist*.9 + dDist*.1
|
||||
knob.r += dDist/numDownFingers;
|
||||
knob.ang += dtheta;
|
||||
printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
|
||||
printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); */
|
||||
SDL_SendGestureMulti(inTouch,dtheta,dDist);
|
||||
}
|
||||
else {
|
||||
/* inTouch->gestureLast[j].dDist = 0;
|
||||
inTouch->gestureLast[j].dtheta = 0;
|
||||
inTouch->gestureLast[j].cv.x = 0;
|
||||
inTouch->gestureLast[j].cv.y = 0; */
|
||||
}
|
||||
/* inTouch->gestureLast[j].f.p.x = x;
|
||||
inTouch->gestureLast[j].f.p.y = y;
|
||||
break;
|
||||
pressure? */
|
||||
}
|
||||
else if (event->type == SDL_FINGERDOWN) {
|
||||
|
||||
inTouch->numDownFingers++;
|
||||
inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+
|
||||
x)/inTouch->numDownFingers;
|
||||
inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+
|
||||
y)/inTouch->numDownFingers;
|
||||
/* printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
|
||||
inTouch->centroid.x,inTouch->centroid.y); */
|
||||
|
||||
#if defined(ENABLE_DOLLAR)
|
||||
inTouch->dollarPath.length = 0;
|
||||
inTouch->dollarPath.p[0].x = x;
|
||||
inTouch->dollarPath.p[0].y = y;
|
||||
inTouch->dollarPath.numPoints = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
35
externals/SDL/src/events/SDL_gesture_c.h
vendored
Executable file
35
externals/SDL/src/events/SDL_gesture_c.h
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_gesture_c_h_
|
||||
#define SDL_gesture_c_h_
|
||||
|
||||
extern int SDL_GestureAddTouch(SDL_TouchID touchId);
|
||||
extern int SDL_GestureDelTouch(SDL_TouchID touchId);
|
||||
|
||||
extern void SDL_GestureProcessEvent(SDL_Event* event);
|
||||
|
||||
extern void SDL_GestureQuit(void);
|
||||
|
||||
#endif /* SDL_gesture_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
1033
externals/SDL/src/events/SDL_keyboard.c
vendored
Executable file
1033
externals/SDL/src/events/SDL_keyboard.c
vendored
Executable file
File diff suppressed because it is too large
Load Diff
70
externals/SDL/src/events/SDL_keyboard_c.h
vendored
Executable file
70
externals/SDL/src/events/SDL_keyboard_c.h
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_keyboard_c_h_
|
||||
#define SDL_keyboard_c_h_
|
||||
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_events.h"
|
||||
|
||||
/* Initialize the keyboard subsystem */
|
||||
extern int SDL_KeyboardInit(void);
|
||||
|
||||
/* Clear the state of the keyboard */
|
||||
extern void SDL_ResetKeyboard(void);
|
||||
|
||||
/* Get the default keymap */
|
||||
extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap);
|
||||
|
||||
/* Set the mapping of scancode to key codes */
|
||||
extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length);
|
||||
|
||||
/* Set a platform-dependent key name, overriding the default platform-agnostic
|
||||
name. Encoded as UTF-8. The string is not copied, thus the pointer given to
|
||||
this function must stay valid forever (or at least until the call to
|
||||
VideoQuit()). */
|
||||
extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name);
|
||||
|
||||
/* Set the keyboard focus window */
|
||||
extern void SDL_SetKeyboardFocus(SDL_Window * window);
|
||||
|
||||
/* Send a keyboard key event */
|
||||
extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
|
||||
|
||||
/* Send keyboard text input */
|
||||
extern int SDL_SendKeyboardText(const char *text);
|
||||
|
||||
/* Send editing text for selected range from start to end */
|
||||
extern int SDL_SendEditingText(const char *text, int start, int end);
|
||||
|
||||
/* Shutdown the keyboard subsystem */
|
||||
extern void SDL_KeyboardQuit(void);
|
||||
|
||||
/* Convert to UTF-8 */
|
||||
extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst);
|
||||
|
||||
/* Toggle on or off pieces of the keyboard mod state. */
|
||||
extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle);
|
||||
|
||||
#endif /* SDL_keyboard_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
1120
externals/SDL/src/events/SDL_mouse.c
vendored
Executable file
1120
externals/SDL/src/events/SDL_mouse.c
vendored
Executable file
File diff suppressed because it is too large
Load Diff
142
externals/SDL/src/events/SDL_mouse_c.h
vendored
Executable file
142
externals/SDL/src/events/SDL_mouse_c.h
vendored
Executable file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_mouse_c_h_
|
||||
#define SDL_mouse_c_h_
|
||||
|
||||
#include "SDL_mouse.h"
|
||||
|
||||
typedef Uint32 SDL_MouseID;
|
||||
|
||||
struct SDL_Cursor
|
||||
{
|
||||
struct SDL_Cursor *next;
|
||||
void *driverdata;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int last_x, last_y;
|
||||
Uint32 last_timestamp;
|
||||
Uint8 click_count;
|
||||
} SDL_MouseClickState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Create a cursor from a surface */
|
||||
SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
|
||||
|
||||
/* Create a system cursor */
|
||||
SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
|
||||
|
||||
/* Show the specified cursor, or hide if cursor is NULL */
|
||||
int (*ShowCursor) (SDL_Cursor * cursor);
|
||||
|
||||
/* This is called when a mouse motion event occurs */
|
||||
void (*MoveCursor) (SDL_Cursor * cursor);
|
||||
|
||||
/* Free a window manager cursor */
|
||||
void (*FreeCursor) (SDL_Cursor * cursor);
|
||||
|
||||
/* Warp the mouse to (x,y) within a window */
|
||||
void (*WarpMouse) (SDL_Window * window, int x, int y);
|
||||
|
||||
/* Warp the mouse to (x,y) in screen space */
|
||||
int (*WarpMouseGlobal) (int x, int y);
|
||||
|
||||
/* Set relative mode */
|
||||
int (*SetRelativeMouseMode) (SDL_bool enabled);
|
||||
|
||||
/* Set mouse capture */
|
||||
int (*CaptureMouse) (SDL_Window * window);
|
||||
|
||||
/* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */
|
||||
Uint32 (*GetGlobalMouseState) (int *x, int *y);
|
||||
|
||||
/* Data common to all mice */
|
||||
SDL_MouseID mouseID;
|
||||
SDL_Window *focus;
|
||||
int x;
|
||||
int y;
|
||||
int xdelta;
|
||||
int ydelta;
|
||||
int last_x, last_y; /* the last reported x and y coordinates */
|
||||
float accumulated_wheel_x;
|
||||
float accumulated_wheel_y;
|
||||
Uint32 buttonstate;
|
||||
SDL_bool has_position;
|
||||
SDL_bool relative_mode;
|
||||
SDL_bool relative_mode_warp;
|
||||
float normal_speed_scale;
|
||||
float relative_speed_scale;
|
||||
float scale_accum_x;
|
||||
float scale_accum_y;
|
||||
Uint32 double_click_time;
|
||||
int double_click_radius;
|
||||
SDL_bool touch_mouse_events;
|
||||
SDL_bool mouse_touch_events;
|
||||
SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */
|
||||
|
||||
/* Data for double-click tracking */
|
||||
int num_clickstates;
|
||||
SDL_MouseClickState *clickstate;
|
||||
|
||||
SDL_Cursor *cursors;
|
||||
SDL_Cursor *def_cursor;
|
||||
SDL_Cursor *cur_cursor;
|
||||
SDL_bool cursor_shown;
|
||||
|
||||
/* Driver-dependent data. */
|
||||
void *driverdata;
|
||||
} SDL_Mouse;
|
||||
|
||||
|
||||
/* Initialize the mouse subsystem */
|
||||
extern int SDL_MouseInit(void);
|
||||
|
||||
/* Get the mouse state structure */
|
||||
SDL_Mouse *SDL_GetMouse(void);
|
||||
|
||||
/* Set the default mouse cursor */
|
||||
extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
|
||||
|
||||
/* Set the mouse focus window */
|
||||
extern void SDL_SetMouseFocus(SDL_Window * window);
|
||||
|
||||
/* Send a mouse motion event */
|
||||
extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
|
||||
|
||||
/* Send a mouse button event */
|
||||
extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button);
|
||||
|
||||
/* Send a mouse button event with a click count */
|
||||
extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks);
|
||||
|
||||
/* Send a mouse wheel event */
|
||||
extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
|
||||
|
||||
/* Shutdown the mouse subsystem */
|
||||
extern void SDL_MouseQuit(void);
|
||||
|
||||
#endif /* SDL_mouse_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
209
externals/SDL/src/events/SDL_quit.c
vendored
Executable file
209
externals/SDL/src/events/SDL_quit.c
vendored
Executable file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_assert.h"
|
||||
|
||||
/* General quit handling code for SDL */
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
|
||||
#if defined(HAVE_SIGNAL_H) || defined(HAVE_SIGACTION)
|
||||
#define HAVE_SIGNAL_SUPPORT 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNAL_SUPPORT
|
||||
static SDL_bool disable_signals = SDL_FALSE;
|
||||
static SDL_bool send_quit_pending = SDL_FALSE;
|
||||
|
||||
#ifdef SDL_BACKGROUNDING_SIGNAL
|
||||
static SDL_bool send_backgrounding_pending = SDL_FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef SDL_FOREGROUNDING_SIGNAL
|
||||
static SDL_bool send_foregrounding_pending = SDL_FALSE;
|
||||
#endif
|
||||
|
||||
static void
|
||||
SDL_HandleSIG(int sig)
|
||||
{
|
||||
/* Reset the signal handler */
|
||||
signal(sig, SDL_HandleSIG);
|
||||
|
||||
/* Send a quit event next time the event loop pumps. */
|
||||
/* We can't send it in signal handler; malloc() might be interrupted! */
|
||||
if ((sig == SIGINT) || (sig == SIGTERM)) {
|
||||
send_quit_pending = SDL_TRUE;
|
||||
}
|
||||
|
||||
#ifdef SDL_BACKGROUNDING_SIGNAL
|
||||
else if (sig == SDL_BACKGROUNDING_SIGNAL) {
|
||||
send_backgrounding_pending = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_FOREGROUNDING_SIGNAL
|
||||
else if (sig == SDL_FOREGROUNDING_SIGNAL) {
|
||||
send_foregrounding_pending = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_EventSignal_Init(const int sig)
|
||||
{
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
|
||||
sigaction(sig, NULL, &action);
|
||||
#ifdef HAVE_SA_SIGACTION
|
||||
if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) {
|
||||
#else
|
||||
if ( action.sa_handler == SIG_DFL ) {
|
||||
#endif
|
||||
action.sa_handler = SDL_HandleSIG;
|
||||
sigaction(sig, &action, NULL);
|
||||
}
|
||||
#elif HAVE_SIGNAL_H
|
||||
void (*ohandler) (int) = signal(sig, SDL_HandleSIG);
|
||||
if (ohandler != SIG_DFL) {
|
||||
signal(sig, ohandler);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_EventSignal_Quit(const int sig)
|
||||
{
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
sigaction(sig, NULL, &action);
|
||||
if ( action.sa_handler == SDL_HandleSIG ) {
|
||||
action.sa_handler = SIG_DFL;
|
||||
sigaction(sig, &action, NULL);
|
||||
}
|
||||
#elif HAVE_SIGNAL_H
|
||||
void (*ohandler) (int) = signal(sig, SIG_DFL);
|
||||
if (ohandler != SDL_HandleSIG) {
|
||||
signal(sig, ohandler);
|
||||
}
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
}
|
||||
|
||||
/* Public functions */
|
||||
static int
|
||||
SDL_QuitInit_Internal(void)
|
||||
{
|
||||
/* Both SIGINT and SIGTERM are translated into quit interrupts */
|
||||
/* and SDL can be built to simulate iOS/Android semantics with arbitrary signals. */
|
||||
SDL_EventSignal_Init(SIGINT);
|
||||
SDL_EventSignal_Init(SIGTERM);
|
||||
|
||||
#ifdef SDL_BACKGROUNDING_SIGNAL
|
||||
SDL_EventSignal_Init(SDL_BACKGROUNDING_SIGNAL);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_FOREGROUNDING_SIGNAL
|
||||
SDL_EventSignal_Init(SDL_FOREGROUNDING_SIGNAL);
|
||||
#endif
|
||||
|
||||
/* That's it! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_QuitQuit_Internal(void)
|
||||
{
|
||||
SDL_EventSignal_Quit(SIGINT);
|
||||
SDL_EventSignal_Quit(SIGTERM);
|
||||
|
||||
#ifdef SDL_BACKGROUNDING_SIGNAL
|
||||
SDL_EventSignal_Quit(SDL_BACKGROUNDING_SIGNAL);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_FOREGROUNDING_SIGNAL
|
||||
SDL_EventSignal_Quit(SDL_FOREGROUNDING_SIGNAL);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
SDL_QuitInit(void)
|
||||
{
|
||||
#ifdef HAVE_SIGNAL_SUPPORT
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
|
||||
return SDL_QuitInit_Internal();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_QuitQuit(void)
|
||||
{
|
||||
#ifdef HAVE_SIGNAL_SUPPORT
|
||||
if (!disable_signals) {
|
||||
SDL_QuitQuit_Internal();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SendPendingSignalEvents(void)
|
||||
{
|
||||
#ifdef HAVE_SIGNAL_SUPPORT
|
||||
if (send_quit_pending) {
|
||||
SDL_SendQuit();
|
||||
SDL_assert(!send_quit_pending);
|
||||
}
|
||||
|
||||
#ifdef SDL_BACKGROUNDING_SIGNAL
|
||||
if (send_backgrounding_pending) {
|
||||
send_backgrounding_pending = SDL_FALSE;
|
||||
SDL_OnApplicationWillResignActive();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_FOREGROUNDING_SIGNAL
|
||||
if (send_foregrounding_pending) {
|
||||
send_foregrounding_pending = SDL_FALSE;
|
||||
SDL_OnApplicationDidBecomeActive();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function returns 1 if it's okay to close the application window */
|
||||
int
|
||||
SDL_SendQuit(void)
|
||||
{
|
||||
#ifdef HAVE_SIGNAL_SUPPORT
|
||||
send_quit_pending = SDL_FALSE;
|
||||
#endif
|
||||
return SDL_SendAppEvent(SDL_QUIT);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
36
externals/SDL/src/events/SDL_sysevents.h
vendored
Executable file
36
externals/SDL/src/events/SDL_sysevents.h
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
/* Useful functions and variables from SDL_sysevents.c */
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
/* The Haiku event loops run in a separate thread */
|
||||
#define MUST_THREAD_EVENTS
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__ /* Windows doesn't allow a separate event thread */
|
||||
#define CANT_THREAD_EVENTS
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
479
externals/SDL/src/events/SDL_touch.c
vendored
Executable file
479
externals/SDL/src/events/SDL_touch.c
vendored
Executable file
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* General touch handling code for SDL */
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
|
||||
static int SDL_num_touch = 0;
|
||||
static SDL_Touch **SDL_touchDevices = NULL;
|
||||
|
||||
/* for mapping touch events to mice */
|
||||
|
||||
#define SYNTHESIZE_TOUCH_TO_MOUSE 1
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
static SDL_bool finger_touching = SDL_FALSE;
|
||||
static SDL_FingerID track_fingerid;
|
||||
static SDL_TouchID track_touchid;
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
int
|
||||
SDL_TouchInit(void)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_GetNumTouchDevices(void)
|
||||
{
|
||||
return SDL_num_touch;
|
||||
}
|
||||
|
||||
SDL_TouchID
|
||||
SDL_GetTouchDevice(int index)
|
||||
{
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
SDL_SetError("Unknown touch device index %d", index);
|
||||
return 0;
|
||||
}
|
||||
return SDL_touchDevices[index]->id;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_GetTouchIndex(SDL_TouchID id)
|
||||
{
|
||||
int index;
|
||||
SDL_Touch *touch;
|
||||
|
||||
for (index = 0; index < SDL_num_touch; ++index) {
|
||||
touch = SDL_touchDevices[index];
|
||||
if (touch->id == id) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_Touch *
|
||||
SDL_GetTouch(SDL_TouchID id)
|
||||
{
|
||||
int index = SDL_GetTouchIndex(id);
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
if (SDL_GetVideoDevice()->ResetTouch != NULL) {
|
||||
SDL_SetError("Unknown touch id %d, resetting", (int) id);
|
||||
(SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice());
|
||||
} else {
|
||||
SDL_SetError("Unknown touch device id %d, cannot reset", (int) id);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return SDL_touchDevices[index];
|
||||
}
|
||||
|
||||
SDL_TouchDeviceType
|
||||
SDL_GetTouchDeviceType(SDL_TouchID id)
|
||||
{
|
||||
SDL_Touch *touch = SDL_GetTouch(id);
|
||||
if (touch) {
|
||||
return touch->type;
|
||||
}
|
||||
return SDL_TOUCH_DEVICE_INVALID;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
|
||||
{
|
||||
int index;
|
||||
for (index = 0; index < touch->num_fingers; ++index) {
|
||||
if (touch->fingers[index]->id == fingerid) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static SDL_Finger *
|
||||
SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id)
|
||||
{
|
||||
int index = SDL_GetFingerIndex(touch, id);
|
||||
if (index < 0 || index >= touch->num_fingers) {
|
||||
return NULL;
|
||||
}
|
||||
return touch->fingers[index];
|
||||
}
|
||||
|
||||
int
|
||||
SDL_GetNumTouchFingers(SDL_TouchID touchID)
|
||||
{
|
||||
SDL_Touch *touch = SDL_GetTouch(touchID);
|
||||
if (touch) {
|
||||
return touch->num_fingers;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_Finger *
|
||||
SDL_GetTouchFinger(SDL_TouchID touchID, int index)
|
||||
{
|
||||
SDL_Touch *touch = SDL_GetTouch(touchID);
|
||||
if (!touch) {
|
||||
return NULL;
|
||||
}
|
||||
if (index < 0 || index >= touch->num_fingers) {
|
||||
SDL_SetError("Unknown touch finger");
|
||||
return NULL;
|
||||
}
|
||||
return touch->fingers[index];
|
||||
}
|
||||
|
||||
int
|
||||
SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name)
|
||||
{
|
||||
SDL_Touch **touchDevices;
|
||||
int index;
|
||||
|
||||
index = SDL_GetTouchIndex(touchID);
|
||||
if (index >= 0) {
|
||||
return index;
|
||||
}
|
||||
|
||||
/* Add the touch to the list of touch */
|
||||
touchDevices = (SDL_Touch **) SDL_realloc(SDL_touchDevices,
|
||||
(SDL_num_touch + 1) * sizeof(*touchDevices));
|
||||
if (!touchDevices) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_touchDevices = touchDevices;
|
||||
index = SDL_num_touch;
|
||||
|
||||
SDL_touchDevices[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchDevices[index]));
|
||||
if (!SDL_touchDevices[index]) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
/* Added touch to list */
|
||||
++SDL_num_touch;
|
||||
|
||||
/* we're setting the touch properties */
|
||||
SDL_touchDevices[index]->id = touchID;
|
||||
SDL_touchDevices[index]->type = type;
|
||||
SDL_touchDevices[index]->num_fingers = 0;
|
||||
SDL_touchDevices[index]->max_fingers = 0;
|
||||
SDL_touchDevices[index]->fingers = NULL;
|
||||
|
||||
/* Record this touch device for gestures */
|
||||
/* We could do this on the fly in the gesture code if we wanted */
|
||||
SDL_GestureAddTouch(touchID);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
|
||||
{
|
||||
SDL_Finger *finger;
|
||||
|
||||
if (touch->num_fingers == touch->max_fingers) {
|
||||
SDL_Finger **new_fingers;
|
||||
new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers+1)*sizeof(*touch->fingers));
|
||||
if (!new_fingers) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
touch->fingers = new_fingers;
|
||||
touch->fingers[touch->max_fingers] = (SDL_Finger *)SDL_malloc(sizeof(*finger));
|
||||
if (!touch->fingers[touch->max_fingers]) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
touch->max_fingers++;
|
||||
}
|
||||
|
||||
finger = touch->fingers[touch->num_fingers++];
|
||||
finger->id = fingerid;
|
||||
finger->x = x;
|
||||
finger->y = y;
|
||||
finger->pressure = pressure;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_DelFinger(SDL_Touch* touch, SDL_FingerID fingerid)
|
||||
{
|
||||
SDL_Finger *temp;
|
||||
|
||||
int index = SDL_GetFingerIndex(touch, fingerid);
|
||||
if (index < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
touch->num_fingers--;
|
||||
temp = touch->fingers[index];
|
||||
touch->fingers[index] = touch->fingers[touch->num_fingers];
|
||||
touch->fingers[touch->num_fingers] = temp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
SDL_bool down, float x, float y, float pressure)
|
||||
{
|
||||
int posted;
|
||||
SDL_Finger *finger;
|
||||
SDL_Mouse *mouse;
|
||||
|
||||
SDL_Touch* touch = SDL_GetTouch(id);
|
||||
if (!touch) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
/* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */
|
||||
{
|
||||
if (mouse->touch_mouse_events) {
|
||||
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
if (window) {
|
||||
if (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
int pos_y = (int)(y * (float)window->h);
|
||||
if (pos_x < 0) pos_x = 0;
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
} else {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (down) {
|
||||
if (finger_touching == SDL_FALSE) {
|
||||
finger_touching = SDL_TRUE;
|
||||
track_touchid = id;
|
||||
track_fingerid = fingerid;
|
||||
}
|
||||
} else {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
finger_touching = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */
|
||||
if (mouse->mouse_touch_events == 0) {
|
||||
if (id == SDL_MOUSE_TOUCHID) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
finger = SDL_GetFinger(touch, fingerid);
|
||||
if (down) {
|
||||
if (finger) {
|
||||
/* This finger is already down */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERDOWN;
|
||||
event.tfinger.touchId = id;
|
||||
event.tfinger.fingerId = fingerid;
|
||||
event.tfinger.x = x;
|
||||
event.tfinger.y = y;
|
||||
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 {
|
||||
if (!finger) {
|
||||
/* This finger is already up */
|
||||
return 0;
|
||||
}
|
||||
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERUP;
|
||||
event.tfinger.touchId = id;
|
||||
event.tfinger.fingerId = fingerid;
|
||||
/* I don't trust the coordinates passed on fingerUp */
|
||||
event.tfinger.x = finger->x;
|
||||
event.tfinger.y = finger->y;
|
||||
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);
|
||||
}
|
||||
|
||||
SDL_DelFinger(touch, fingerid);
|
||||
}
|
||||
return posted;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
float x, float y, float pressure)
|
||||
{
|
||||
SDL_Touch *touch;
|
||||
SDL_Finger *finger;
|
||||
SDL_Mouse *mouse;
|
||||
int posted;
|
||||
float xrel, yrel, prel;
|
||||
|
||||
touch = SDL_GetTouch(id);
|
||||
if (!touch) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
mouse = SDL_GetMouse();
|
||||
|
||||
#if SYNTHESIZE_TOUCH_TO_MOUSE
|
||||
/* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */
|
||||
{
|
||||
if (mouse->touch_mouse_events) {
|
||||
if (id != SDL_MOUSE_TOUCHID) {
|
||||
if (window) {
|
||||
if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
|
||||
int pos_x = (int)(x * (float)window->w);
|
||||
int pos_y = (int)(y * (float)window->h);
|
||||
if (pos_x < 0) pos_x = 0;
|
||||
if (pos_x > window->w - 1) pos_x = window->w - 1;
|
||||
if (pos_y < 0) pos_y = 0;
|
||||
if (pos_y > window->h - 1) pos_y = window->h - 1;
|
||||
SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* SDL_HINT_MOUSE_TOUCH_EVENTS: if not set, discard synthetic touch events coming from platform layer */
|
||||
if (mouse->mouse_touch_events == 0) {
|
||||
if (id == SDL_MOUSE_TOUCHID) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
finger = SDL_GetFinger(touch,fingerid);
|
||||
if (!finger) {
|
||||
return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure);
|
||||
}
|
||||
|
||||
xrel = x - finger->x;
|
||||
yrel = y - finger->y;
|
||||
prel = pressure - finger->pressure;
|
||||
|
||||
/* Drop events that don't change state */
|
||||
if (xrel == 0.0f && yrel == 0.0f && prel == 0.0f) {
|
||||
#if 0
|
||||
printf("Touch event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Update internal touch coordinates */
|
||||
finger->x = x;
|
||||
finger->y = y;
|
||||
finger->pressure = pressure;
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERMOTION;
|
||||
event.tfinger.touchId = id;
|
||||
event.tfinger.fingerId = fingerid;
|
||||
event.tfinger.x = x;
|
||||
event.tfinger.y = y;
|
||||
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;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_DelTouch(SDL_TouchID id)
|
||||
{
|
||||
int i;
|
||||
int index = SDL_GetTouchIndex(id);
|
||||
SDL_Touch *touch = SDL_GetTouch(id);
|
||||
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < touch->max_fingers; ++i) {
|
||||
SDL_free(touch->fingers[i]);
|
||||
}
|
||||
SDL_free(touch->fingers);
|
||||
SDL_free(touch);
|
||||
|
||||
SDL_num_touch--;
|
||||
SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch];
|
||||
|
||||
/* Delete this touch device for gestures */
|
||||
SDL_GestureDelTouch(id);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_TouchQuit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = SDL_num_touch; i--; ) {
|
||||
SDL_DelTouch(SDL_touchDevices[i]->id);
|
||||
}
|
||||
SDL_assert(SDL_num_touch == 0);
|
||||
|
||||
SDL_free(SDL_touchDevices);
|
||||
SDL_touchDevices = NULL;
|
||||
SDL_GestureQuit();
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
62
externals/SDL/src/events/SDL_touch_c.h
vendored
Executable file
62
externals/SDL/src/events/SDL_touch_c.h
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
#include "../../include/SDL_touch.h"
|
||||
|
||||
#ifndef SDL_touch_c_h_
|
||||
#define SDL_touch_c_h_
|
||||
|
||||
typedef struct SDL_Touch
|
||||
{
|
||||
SDL_TouchID id;
|
||||
SDL_TouchDeviceType type;
|
||||
int num_fingers;
|
||||
int max_fingers;
|
||||
SDL_Finger** fingers;
|
||||
} SDL_Touch;
|
||||
|
||||
|
||||
/* Initialize the touch subsystem */
|
||||
extern int SDL_TouchInit(void);
|
||||
|
||||
/* Add a touch, returning the index of the touch, or -1 if there was an error. */
|
||||
extern int SDL_AddTouch(SDL_TouchID id, SDL_TouchDeviceType type, const char *name);
|
||||
|
||||
/* Get the touch with a given id */
|
||||
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, 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, SDL_Window * window,
|
||||
float x, float y, float pressure);
|
||||
|
||||
/* Remove a touch */
|
||||
extern void SDL_DelTouch(SDL_TouchID id);
|
||||
|
||||
/* Shutdown the touch subsystem */
|
||||
extern void SDL_TouchQuit(void);
|
||||
|
||||
#endif /* SDL_touch_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
211
externals/SDL/src/events/SDL_windowevents.c
vendored
Executable file
211
externals/SDL/src/events/SDL_windowevents.c
vendored
Executable file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
/* Window event handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_mouse_c.h"
|
||||
|
||||
|
||||
static int SDLCALL
|
||||
RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
||||
if (event->type == SDL_WINDOWEVENT &&
|
||||
(event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
||||
event->window.event == SDL_WINDOWEVENT_RESIZED) &&
|
||||
event->window.windowID == new_event->window.windowID) {
|
||||
/* We're about to post a new size event, drop the old one */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
RemovePendingMoveEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
||||
if (event->type == SDL_WINDOWEVENT &&
|
||||
event->window.event == SDL_WINDOWEVENT_MOVED &&
|
||||
event->window.windowID == new_event->window.windowID) {
|
||||
/* We're about to post a new move event, drop the old one */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
RemovePendingExposedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
||||
if (event->type == SDL_WINDOWEVENT &&
|
||||
event->window.event == SDL_WINDOWEVENT_EXPOSED &&
|
||||
event->window.windowID == new_event->window.windowID) {
|
||||
/* We're about to post a new exposed event, drop the old one */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
||||
int data2)
|
||||
{
|
||||
int posted;
|
||||
|
||||
if (!window) {
|
||||
return 0;
|
||||
}
|
||||
switch (windowevent) {
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
if (window->flags & SDL_WINDOW_SHOWN) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
|
||||
window->flags |= SDL_WINDOW_SHOWN;
|
||||
SDL_OnWindowShown(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
if (!(window->flags & SDL_WINDOW_SHOWN)) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~SDL_WINDOW_SHOWN;
|
||||
window->flags |= SDL_WINDOW_HIDDEN;
|
||||
SDL_OnWindowHidden(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
|
||||
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
|
||||
return 0;
|
||||
}
|
||||
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||
window->windowed.x = data1;
|
||||
window->windowed.y = data2;
|
||||
}
|
||||
if (data1 == window->x && data2 == window->y) {
|
||||
return 0;
|
||||
}
|
||||
window->x = data1;
|
||||
window->y = data2;
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||
window->windowed.w = data1;
|
||||
window->windowed.h = data2;
|
||||
}
|
||||
if (data1 == window->w && data2 == window->h) {
|
||||
return 0;
|
||||
}
|
||||
window->w = data1;
|
||||
window->h = data2;
|
||||
SDL_OnWindowResized(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~SDL_WINDOW_MAXIMIZED;
|
||||
window->flags |= SDL_WINDOW_MINIMIZED;
|
||||
SDL_OnWindowMinimized(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
if (window->flags & SDL_WINDOW_MAXIMIZED) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~SDL_WINDOW_MINIMIZED;
|
||||
window->flags |= SDL_WINDOW_MAXIMIZED;
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESTORED:
|
||||
if (!(window->flags & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED);
|
||||
SDL_OnWindowRestored(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_ENTER:
|
||||
if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
|
||||
return 0;
|
||||
}
|
||||
window->flags |= SDL_WINDOW_MOUSE_FOCUS;
|
||||
SDL_OnWindowEnter(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_LEAVE:
|
||||
if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~SDL_WINDOW_MOUSE_FOCUS;
|
||||
SDL_OnWindowLeave(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
|
||||
return 0;
|
||||
}
|
||||
window->flags |= SDL_WINDOW_INPUT_FOCUS;
|
||||
SDL_OnWindowFocusGained(window);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
if (!(window->flags & SDL_WINDOW_INPUT_FOCUS)) {
|
||||
return 0;
|
||||
}
|
||||
window->flags &= ~SDL_WINDOW_INPUT_FOCUS;
|
||||
SDL_OnWindowFocusLost(window);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_WINDOWEVENT;
|
||||
event.window.event = windowevent;
|
||||
event.window.data1 = data1;
|
||||
event.window.data2 = data2;
|
||||
event.window.windowID = window->id;
|
||||
|
||||
/* Fixes queue overflow with resize events that aren't processed */
|
||||
if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||
SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event);
|
||||
}
|
||||
if (windowevent == SDL_WINDOWEVENT_MOVED) {
|
||||
SDL_FilterEvents(RemovePendingMoveEvents, &event);
|
||||
}
|
||||
if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
|
||||
SDL_FilterEvents(RemovePendingExposedEvents, &event);
|
||||
}
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
|
||||
if (windowevent == SDL_WINDOWEVENT_CLOSE) {
|
||||
if ( !window->prev && !window->next ) {
|
||||
/* This is the last window in the list so send the SDL_QUIT event */
|
||||
SDL_SendQuit();
|
||||
}
|
||||
}
|
||||
|
||||
return (posted);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
31
externals/SDL/src/events/SDL_windowevents_c.h
vendored
Executable file
31
externals/SDL/src/events/SDL_windowevents_c.h
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef SDL_windowevents_c_h_
|
||||
#define SDL_windowevents_c_h_
|
||||
|
||||
extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent,
|
||||
int data1, int data2);
|
||||
|
||||
#endif /* SDL_windowevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
33
externals/SDL/src/events/blank_cursor.h
vendored
Executable file
33
externals/SDL/src/events/blank_cursor.h
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* A default blank 8x8 cursor */
|
||||
|
||||
#define BLANK_CWIDTH 8
|
||||
#define BLANK_CHEIGHT 8
|
||||
#define BLANK_CHOTX 0
|
||||
#define BLANK_CHOTY 0
|
||||
|
||||
static const unsigned char blank_cdata[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static const unsigned char blank_cmask[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
114
externals/SDL/src/events/default_cursor.h
vendored
Executable file
114
externals/SDL/src/events/default_cursor.h
vendored
Executable file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Default cursor - it happens to be the Mac cursor, but could be anything */
|
||||
|
||||
#define DEFAULT_CWIDTH 16
|
||||
#define DEFAULT_CHEIGHT 16
|
||||
#define DEFAULT_CHOTX 0
|
||||
#define DEFAULT_CHOTY 0
|
||||
|
||||
/* Added a real MacOS cursor, at the request of Luc-Olivier de Charri<72>re */
|
||||
#define USE_MACOS_CURSOR
|
||||
|
||||
#ifdef USE_MACOS_CURSOR
|
||||
|
||||
static const unsigned char default_cdata[] = {
|
||||
0x00, 0x00,
|
||||
0x40, 0x00,
|
||||
0x60, 0x00,
|
||||
0x70, 0x00,
|
||||
0x78, 0x00,
|
||||
0x7C, 0x00,
|
||||
0x7E, 0x00,
|
||||
0x7F, 0x00,
|
||||
0x7F, 0x80,
|
||||
0x7C, 0x00,
|
||||
0x6C, 0x00,
|
||||
0x46, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x03, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char default_cmask[] = {
|
||||
0xC0, 0x00,
|
||||
0xE0, 0x00,
|
||||
0xF0, 0x00,
|
||||
0xF8, 0x00,
|
||||
0xFC, 0x00,
|
||||
0xFE, 0x00,
|
||||
0xFF, 0x00,
|
||||
0xFF, 0x80,
|
||||
0xFF, 0xC0,
|
||||
0xFF, 0xE0,
|
||||
0xFE, 0x00,
|
||||
0xEF, 0x00,
|
||||
0xCF, 0x00,
|
||||
0x87, 0x80,
|
||||
0x07, 0x80,
|
||||
0x03, 0x00
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
static const unsigned char default_cdata[] = {
|
||||
0x00, 0x00,
|
||||
0x40, 0x00,
|
||||
0x60, 0x00,
|
||||
0x70, 0x00,
|
||||
0x78, 0x00,
|
||||
0x7C, 0x00,
|
||||
0x7E, 0x00,
|
||||
0x7F, 0x00,
|
||||
0x7F, 0x80,
|
||||
0x7C, 0x00,
|
||||
0x6C, 0x00,
|
||||
0x46, 0x00,
|
||||
0x06, 0x00,
|
||||
0x03, 0x00,
|
||||
0x03, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char default_cmask[] = {
|
||||
0x40, 0x00,
|
||||
0xE0, 0x00,
|
||||
0xF0, 0x00,
|
||||
0xF8, 0x00,
|
||||
0xFC, 0x00,
|
||||
0xFE, 0x00,
|
||||
0xFF, 0x00,
|
||||
0xFF, 0x80,
|
||||
0xFF, 0xC0,
|
||||
0xFF, 0x80,
|
||||
0xFE, 0x00,
|
||||
0xEF, 0x00,
|
||||
0x4F, 0x00,
|
||||
0x07, 0x80,
|
||||
0x07, 0x80,
|
||||
0x03, 0x00
|
||||
};
|
||||
|
||||
#endif /* USE_MACOS_CURSOR */
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
159
externals/SDL/src/events/scancodes_darwin.h
vendored
Executable file
159
externals/SDL/src/events/scancodes_darwin.h
vendored
Executable file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* Mac virtual key code to SDL scancode mapping table
|
||||
Sources:
|
||||
- Inside Macintosh: Text <http://developer.apple.com/documentation/mac/Text/Text-571.html>
|
||||
- Apple USB keyboard driver source <http://darwinsource.opendarwin.org/10.4.6.ppc/IOHIDFamily-172.8/IOHIDFamily/Cosmo_USB2ADB.c>
|
||||
- experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard
|
||||
*/
|
||||
/* *INDENT-OFF* */
|
||||
static const SDL_Scancode darwin_scancode_table[] = {
|
||||
/* 0 */ SDL_SCANCODE_A,
|
||||
/* 1 */ SDL_SCANCODE_S,
|
||||
/* 2 */ SDL_SCANCODE_D,
|
||||
/* 3 */ SDL_SCANCODE_F,
|
||||
/* 4 */ SDL_SCANCODE_H,
|
||||
/* 5 */ SDL_SCANCODE_G,
|
||||
/* 6 */ SDL_SCANCODE_Z,
|
||||
/* 7 */ SDL_SCANCODE_X,
|
||||
/* 8 */ SDL_SCANCODE_C,
|
||||
/* 9 */ SDL_SCANCODE_V,
|
||||
/* 10 */ SDL_SCANCODE_NONUSBACKSLASH, /* SDL_SCANCODE_NONUSBACKSLASH on ANSI and JIS keyboards (if this key would exist there), SDL_SCANCODE_GRAVE on ISO. (The USB keyboard driver actually translates these usage codes to different virtual key codes depending on whether the keyboard is ISO/ANSI/JIS. That's why you have to help it identify the keyboard type when you plug in a PC USB keyboard. It's a historical thing - ADB keyboards are wired this way.) */
|
||||
/* 11 */ SDL_SCANCODE_B,
|
||||
/* 12 */ SDL_SCANCODE_Q,
|
||||
/* 13 */ SDL_SCANCODE_W,
|
||||
/* 14 */ SDL_SCANCODE_E,
|
||||
/* 15 */ SDL_SCANCODE_R,
|
||||
/* 16 */ SDL_SCANCODE_Y,
|
||||
/* 17 */ SDL_SCANCODE_T,
|
||||
/* 18 */ SDL_SCANCODE_1,
|
||||
/* 19 */ SDL_SCANCODE_2,
|
||||
/* 20 */ SDL_SCANCODE_3,
|
||||
/* 21 */ SDL_SCANCODE_4,
|
||||
/* 22 */ SDL_SCANCODE_6,
|
||||
/* 23 */ SDL_SCANCODE_5,
|
||||
/* 24 */ SDL_SCANCODE_EQUALS,
|
||||
/* 25 */ SDL_SCANCODE_9,
|
||||
/* 26 */ SDL_SCANCODE_7,
|
||||
/* 27 */ SDL_SCANCODE_MINUS,
|
||||
/* 28 */ SDL_SCANCODE_8,
|
||||
/* 29 */ SDL_SCANCODE_0,
|
||||
/* 30 */ SDL_SCANCODE_RIGHTBRACKET,
|
||||
/* 31 */ SDL_SCANCODE_O,
|
||||
/* 32 */ SDL_SCANCODE_U,
|
||||
/* 33 */ SDL_SCANCODE_LEFTBRACKET,
|
||||
/* 34 */ SDL_SCANCODE_I,
|
||||
/* 35 */ SDL_SCANCODE_P,
|
||||
/* 36 */ SDL_SCANCODE_RETURN,
|
||||
/* 37 */ SDL_SCANCODE_L,
|
||||
/* 38 */ SDL_SCANCODE_J,
|
||||
/* 39 */ SDL_SCANCODE_APOSTROPHE,
|
||||
/* 40 */ SDL_SCANCODE_K,
|
||||
/* 41 */ SDL_SCANCODE_SEMICOLON,
|
||||
/* 42 */ SDL_SCANCODE_BACKSLASH,
|
||||
/* 43 */ SDL_SCANCODE_COMMA,
|
||||
/* 44 */ SDL_SCANCODE_SLASH,
|
||||
/* 45 */ SDL_SCANCODE_N,
|
||||
/* 46 */ SDL_SCANCODE_M,
|
||||
/* 47 */ SDL_SCANCODE_PERIOD,
|
||||
/* 48 */ SDL_SCANCODE_TAB,
|
||||
/* 49 */ SDL_SCANCODE_SPACE,
|
||||
/* 50 */ SDL_SCANCODE_GRAVE, /* SDL_SCANCODE_GRAVE on ANSI and JIS keyboards, SDL_SCANCODE_NONUSBACKSLASH on ISO (see comment about virtual key code 10 above) */
|
||||
/* 51 */ SDL_SCANCODE_BACKSPACE,
|
||||
/* 52 */ SDL_SCANCODE_KP_ENTER, /* keyboard enter on portables */
|
||||
/* 53 */ SDL_SCANCODE_ESCAPE,
|
||||
/* 54 */ SDL_SCANCODE_RGUI,
|
||||
/* 55 */ SDL_SCANCODE_LGUI,
|
||||
/* 56 */ SDL_SCANCODE_LSHIFT,
|
||||
/* 57 */ SDL_SCANCODE_CAPSLOCK,
|
||||
/* 58 */ SDL_SCANCODE_LALT,
|
||||
/* 59 */ SDL_SCANCODE_LCTRL,
|
||||
/* 60 */ SDL_SCANCODE_RSHIFT,
|
||||
/* 61 */ SDL_SCANCODE_RALT,
|
||||
/* 62 */ SDL_SCANCODE_RCTRL,
|
||||
/* 63 */ SDL_SCANCODE_RGUI, /* fn on portables, acts as a hardware-level modifier already, so we don't generate events for it, also XK_Meta_R */
|
||||
/* 64 */ SDL_SCANCODE_F17,
|
||||
/* 65 */ SDL_SCANCODE_KP_PERIOD,
|
||||
/* 66 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 67 */ SDL_SCANCODE_KP_MULTIPLY,
|
||||
/* 68 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 69 */ SDL_SCANCODE_KP_PLUS,
|
||||
/* 70 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 71 */ SDL_SCANCODE_NUMLOCKCLEAR,
|
||||
/* 72 */ SDL_SCANCODE_VOLUMEUP,
|
||||
/* 73 */ SDL_SCANCODE_VOLUMEDOWN,
|
||||
/* 74 */ SDL_SCANCODE_MUTE,
|
||||
/* 75 */ SDL_SCANCODE_KP_DIVIDE,
|
||||
/* 76 */ SDL_SCANCODE_KP_ENTER, /* keypad enter on external keyboards, fn-return on portables */
|
||||
/* 77 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 78 */ SDL_SCANCODE_KP_MINUS,
|
||||
/* 79 */ SDL_SCANCODE_F18,
|
||||
/* 80 */ SDL_SCANCODE_F19,
|
||||
/* 81 */ SDL_SCANCODE_KP_EQUALS,
|
||||
/* 82 */ SDL_SCANCODE_KP_0,
|
||||
/* 83 */ SDL_SCANCODE_KP_1,
|
||||
/* 84 */ SDL_SCANCODE_KP_2,
|
||||
/* 85 */ SDL_SCANCODE_KP_3,
|
||||
/* 86 */ SDL_SCANCODE_KP_4,
|
||||
/* 87 */ SDL_SCANCODE_KP_5,
|
||||
/* 88 */ SDL_SCANCODE_KP_6,
|
||||
/* 89 */ SDL_SCANCODE_KP_7,
|
||||
/* 90 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 91 */ SDL_SCANCODE_KP_8,
|
||||
/* 92 */ SDL_SCANCODE_KP_9,
|
||||
/* 93 */ SDL_SCANCODE_INTERNATIONAL3, /* Cosmo_USB2ADB.c says "Yen (JIS)" */
|
||||
/* 94 */ SDL_SCANCODE_INTERNATIONAL1, /* Cosmo_USB2ADB.c says "Ro (JIS)" */
|
||||
/* 95 */ SDL_SCANCODE_KP_COMMA, /* Cosmo_USB2ADB.c says ", JIS only" */
|
||||
/* 96 */ SDL_SCANCODE_F5,
|
||||
/* 97 */ SDL_SCANCODE_F6,
|
||||
/* 98 */ SDL_SCANCODE_F7,
|
||||
/* 99 */ SDL_SCANCODE_F3,
|
||||
/* 100 */ SDL_SCANCODE_F8,
|
||||
/* 101 */ SDL_SCANCODE_F9,
|
||||
/* 102 */ SDL_SCANCODE_LANG2, /* Cosmo_USB2ADB.c says "Eisu" */
|
||||
/* 103 */ SDL_SCANCODE_F11,
|
||||
/* 104 */ SDL_SCANCODE_LANG1, /* Cosmo_USB2ADB.c says "Kana" */
|
||||
/* 105 */ SDL_SCANCODE_PRINTSCREEN, /* On ADB keyboards, this key is labeled "F13/print screen". Problem: USB has different usage codes for these two functions. On Apple USB keyboards, the key is labeled "F13" and sends the F13 usage code (SDL_SCANCODE_F13). I decided to use SDL_SCANCODE_PRINTSCREEN here nevertheless since SDL applications are more likely to assume the presence of a print screen key than an F13 key. */
|
||||
/* 106 */ SDL_SCANCODE_F16,
|
||||
/* 107 */ SDL_SCANCODE_SCROLLLOCK, /* F14/scroll lock, see comment about F13/print screen above */
|
||||
/* 108 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 109 */ SDL_SCANCODE_F10,
|
||||
/* 110 */ SDL_SCANCODE_APPLICATION, /* windows contextual menu key, fn-enter on portables */
|
||||
/* 111 */ SDL_SCANCODE_F12,
|
||||
/* 112 */ SDL_SCANCODE_UNKNOWN, /* unknown (unused?) */
|
||||
/* 113 */ SDL_SCANCODE_PAUSE, /* F15/pause, see comment about F13/print screen above */
|
||||
/* 114 */ SDL_SCANCODE_INSERT, /* the key is actually labeled "help" on Apple keyboards, and works as such in Mac OS, but it sends the "insert" usage code even on Apple USB keyboards */
|
||||
/* 115 */ SDL_SCANCODE_HOME,
|
||||
/* 116 */ SDL_SCANCODE_PAGEUP,
|
||||
/* 117 */ SDL_SCANCODE_DELETE,
|
||||
/* 118 */ SDL_SCANCODE_F4,
|
||||
/* 119 */ SDL_SCANCODE_END,
|
||||
/* 120 */ SDL_SCANCODE_F2,
|
||||
/* 121 */ SDL_SCANCODE_PAGEDOWN,
|
||||
/* 122 */ SDL_SCANCODE_F1,
|
||||
/* 123 */ SDL_SCANCODE_LEFT,
|
||||
/* 124 */ SDL_SCANCODE_RIGHT,
|
||||
/* 125 */ SDL_SCANCODE_DOWN,
|
||||
/* 126 */ SDL_SCANCODE_UP,
|
||||
/* 127 */ SDL_SCANCODE_POWER
|
||||
};
|
||||
/* *INDENT-ON* */
|
263
externals/SDL/src/events/scancodes_linux.h
vendored
Executable file
263
externals/SDL/src/events/scancodes_linux.h
vendored
Executable file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../include/SDL_scancode.h"
|
||||
|
||||
/* Linux virtual key code to SDL_Keycode mapping table
|
||||
Sources:
|
||||
- Linux kernel source input.h
|
||||
*/
|
||||
/* *INDENT-OFF* */
|
||||
static SDL_Scancode const linux_scancode_table[] = {
|
||||
/* 0 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 1 */ SDL_SCANCODE_ESCAPE,
|
||||
/* 2 */ SDL_SCANCODE_1,
|
||||
/* 3 */ SDL_SCANCODE_2,
|
||||
/* 4 */ SDL_SCANCODE_3,
|
||||
/* 5 */ SDL_SCANCODE_4,
|
||||
/* 6 */ SDL_SCANCODE_5,
|
||||
/* 7 */ SDL_SCANCODE_6,
|
||||
/* 8 */ SDL_SCANCODE_7,
|
||||
/* 9 */ SDL_SCANCODE_8,
|
||||
/* 10 */ SDL_SCANCODE_9,
|
||||
/* 11 */ SDL_SCANCODE_0,
|
||||
/* 12 */ SDL_SCANCODE_MINUS,
|
||||
/* 13 */ SDL_SCANCODE_EQUALS,
|
||||
/* 14 */ SDL_SCANCODE_BACKSPACE,
|
||||
/* 15 */ SDL_SCANCODE_TAB,
|
||||
/* 16 */ SDL_SCANCODE_Q,
|
||||
/* 17 */ SDL_SCANCODE_W,
|
||||
/* 18 */ SDL_SCANCODE_E,
|
||||
/* 19 */ SDL_SCANCODE_R,
|
||||
/* 20 */ SDL_SCANCODE_T,
|
||||
/* 21 */ SDL_SCANCODE_Y,
|
||||
/* 22 */ SDL_SCANCODE_U,
|
||||
/* 23 */ SDL_SCANCODE_I,
|
||||
/* 24 */ SDL_SCANCODE_O,
|
||||
/* 25 */ SDL_SCANCODE_P,
|
||||
/* 26 */ SDL_SCANCODE_LEFTBRACKET,
|
||||
/* 27 */ SDL_SCANCODE_RIGHTBRACKET,
|
||||
/* 28 */ SDL_SCANCODE_RETURN,
|
||||
/* 29 */ SDL_SCANCODE_LCTRL,
|
||||
/* 30 */ SDL_SCANCODE_A,
|
||||
/* 31 */ SDL_SCANCODE_S,
|
||||
/* 32 */ SDL_SCANCODE_D,
|
||||
/* 33 */ SDL_SCANCODE_F,
|
||||
/* 34 */ SDL_SCANCODE_G,
|
||||
/* 35 */ SDL_SCANCODE_H,
|
||||
/* 36 */ SDL_SCANCODE_J,
|
||||
/* 37 */ SDL_SCANCODE_K,
|
||||
/* 38 */ SDL_SCANCODE_L,
|
||||
/* 39 */ SDL_SCANCODE_SEMICOLON,
|
||||
/* 40 */ SDL_SCANCODE_APOSTROPHE,
|
||||
/* 41 */ SDL_SCANCODE_GRAVE,
|
||||
/* 42 */ SDL_SCANCODE_LSHIFT,
|
||||
/* 43 */ SDL_SCANCODE_BACKSLASH,
|
||||
/* 44 */ SDL_SCANCODE_Z,
|
||||
/* 45 */ SDL_SCANCODE_X,
|
||||
/* 46 */ SDL_SCANCODE_C,
|
||||
/* 47 */ SDL_SCANCODE_V,
|
||||
/* 48 */ SDL_SCANCODE_B,
|
||||
/* 49 */ SDL_SCANCODE_N,
|
||||
/* 50 */ SDL_SCANCODE_M,
|
||||
/* 51 */ SDL_SCANCODE_COMMA,
|
||||
/* 52 */ SDL_SCANCODE_PERIOD,
|
||||
/* 53 */ SDL_SCANCODE_SLASH,
|
||||
/* 54 */ SDL_SCANCODE_RSHIFT,
|
||||
/* 55 */ SDL_SCANCODE_KP_MULTIPLY,
|
||||
/* 56 */ SDL_SCANCODE_LALT,
|
||||
/* 57 */ SDL_SCANCODE_SPACE,
|
||||
/* 58 */ SDL_SCANCODE_CAPSLOCK,
|
||||
/* 59 */ SDL_SCANCODE_F1,
|
||||
/* 60 */ SDL_SCANCODE_F2,
|
||||
/* 61 */ SDL_SCANCODE_F3,
|
||||
/* 62 */ SDL_SCANCODE_F4,
|
||||
/* 63 */ SDL_SCANCODE_F5,
|
||||
/* 64 */ SDL_SCANCODE_F6,
|
||||
/* 65 */ SDL_SCANCODE_F7,
|
||||
/* 66 */ SDL_SCANCODE_F8,
|
||||
/* 67 */ SDL_SCANCODE_F9,
|
||||
/* 68 */ SDL_SCANCODE_F10,
|
||||
/* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
|
||||
/* 70 */ SDL_SCANCODE_SCROLLLOCK,
|
||||
/* 71 */ SDL_SCANCODE_KP_7,
|
||||
/* 72 */ SDL_SCANCODE_KP_8,
|
||||
/* 73 */ SDL_SCANCODE_KP_9,
|
||||
/* 74 */ SDL_SCANCODE_KP_MINUS,
|
||||
/* 75 */ SDL_SCANCODE_KP_4,
|
||||
/* 76 */ SDL_SCANCODE_KP_5,
|
||||
/* 77 */ SDL_SCANCODE_KP_6,
|
||||
/* 78 */ SDL_SCANCODE_KP_PLUS,
|
||||
/* 79 */ SDL_SCANCODE_KP_1,
|
||||
/* 80 */ SDL_SCANCODE_KP_2,
|
||||
/* 81 */ SDL_SCANCODE_KP_3,
|
||||
/* 82 */ SDL_SCANCODE_KP_0,
|
||||
/* 83 */ SDL_SCANCODE_KP_PERIOD,
|
||||
0,
|
||||
/* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */
|
||||
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */
|
||||
/* 87 */ SDL_SCANCODE_F11,
|
||||
/* 88 */ SDL_SCANCODE_F12,
|
||||
/* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* KEY_RO */
|
||||
/* 90 */ SDL_SCANCODE_LANG3, /* KEY_KATAKANA */
|
||||
/* 91 */ SDL_SCANCODE_LANG4, /* KEY_HIRAGANA */
|
||||
/* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* KEY_HENKAN */
|
||||
/* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* KEY_KATAKANAHIRAGANA */
|
||||
/* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_MUHENKAN */
|
||||
/* 95 */ SDL_SCANCODE_INTERNATIONAL5, /* KEY_KPJPCOMMA */
|
||||
/* 96 */ SDL_SCANCODE_KP_ENTER,
|
||||
/* 97 */ SDL_SCANCODE_RCTRL,
|
||||
/* 98 */ SDL_SCANCODE_KP_DIVIDE,
|
||||
/* 99 */ SDL_SCANCODE_SYSREQ,
|
||||
/* 100 */ SDL_SCANCODE_RALT,
|
||||
/* 101 */ SDL_SCANCODE_UNKNOWN, /* KEY_LINEFEED */
|
||||
/* 102 */ SDL_SCANCODE_HOME,
|
||||
/* 103 */ SDL_SCANCODE_UP,
|
||||
/* 104 */ SDL_SCANCODE_PAGEUP,
|
||||
/* 105 */ SDL_SCANCODE_LEFT,
|
||||
/* 106 */ SDL_SCANCODE_RIGHT,
|
||||
/* 107 */ SDL_SCANCODE_END,
|
||||
/* 108 */ SDL_SCANCODE_DOWN,
|
||||
/* 109 */ SDL_SCANCODE_PAGEDOWN,
|
||||
/* 110 */ SDL_SCANCODE_INSERT,
|
||||
/* 111 */ SDL_SCANCODE_DELETE,
|
||||
/* 112 */ SDL_SCANCODE_UNKNOWN, /* KEY_MACRO */
|
||||
/* 113 */ SDL_SCANCODE_MUTE,
|
||||
/* 114 */ SDL_SCANCODE_VOLUMEDOWN,
|
||||
/* 115 */ SDL_SCANCODE_VOLUMEUP,
|
||||
/* 116 */ SDL_SCANCODE_POWER,
|
||||
/* 117 */ SDL_SCANCODE_KP_EQUALS,
|
||||
/* 118 */ SDL_SCANCODE_KP_PLUSMINUS,
|
||||
/* 119 */ SDL_SCANCODE_PAUSE,
|
||||
0,
|
||||
/* 121 */ SDL_SCANCODE_KP_COMMA,
|
||||
/* 122 */ SDL_SCANCODE_LANG1, /* KEY_HANGUEL */
|
||||
/* 123 */ SDL_SCANCODE_LANG2, /* KEY_HANJA */
|
||||
/* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */
|
||||
/* 125 */ SDL_SCANCODE_LGUI,
|
||||
/* 126 */ SDL_SCANCODE_RGUI,
|
||||
/* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */
|
||||
/* 128 */ SDL_SCANCODE_STOP,
|
||||
/* 129 */ SDL_SCANCODE_AGAIN,
|
||||
/* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */
|
||||
/* 131 */ SDL_SCANCODE_UNDO,
|
||||
/* 132 */ SDL_SCANCODE_UNKNOWN, /* KEY_FRONT */
|
||||
/* 133 */ SDL_SCANCODE_COPY,
|
||||
/* 134 */ SDL_SCANCODE_UNKNOWN, /* KEY_OPEN */
|
||||
/* 135 */ SDL_SCANCODE_PASTE,
|
||||
/* 136 */ SDL_SCANCODE_FIND,
|
||||
/* 137 */ SDL_SCANCODE_CUT,
|
||||
/* 138 */ SDL_SCANCODE_HELP,
|
||||
/* 139 */ SDL_SCANCODE_MENU,
|
||||
/* 140 */ SDL_SCANCODE_CALCULATOR,
|
||||
/* 141 */ SDL_SCANCODE_UNKNOWN, /* KEY_SETUP */
|
||||
/* 142 */ SDL_SCANCODE_SLEEP,
|
||||
/* 143 */ SDL_SCANCODE_UNKNOWN, /* KEY_WAKEUP */
|
||||
/* 144 */ SDL_SCANCODE_UNKNOWN, /* KEY_FILE */
|
||||
/* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */
|
||||
/* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */
|
||||
/* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */
|
||||
/* 148 */ SDL_SCANCODE_APP1, /* KEY_PROG1 */
|
||||
/* 149 */ SDL_SCANCODE_APP2, /* KEY_PROG2 */
|
||||
/* 150 */ SDL_SCANCODE_WWW, /* KEY_WWW */
|
||||
/* 151 */ SDL_SCANCODE_UNKNOWN, /* KEY_MSDOS */
|
||||
/* 152 */ SDL_SCANCODE_UNKNOWN, /* KEY_COFFEE */
|
||||
/* 153 */ SDL_SCANCODE_UNKNOWN, /* KEY_DIRECTION */
|
||||
/* 154 */ SDL_SCANCODE_UNKNOWN, /* KEY_CYCLEWINDOWS */
|
||||
/* 155 */ SDL_SCANCODE_MAIL,
|
||||
/* 156 */ SDL_SCANCODE_AC_BOOKMARKS,
|
||||
/* 157 */ SDL_SCANCODE_COMPUTER,
|
||||
/* 158 */ SDL_SCANCODE_AC_BACK,
|
||||
/* 159 */ SDL_SCANCODE_AC_FORWARD,
|
||||
/* 160 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSECD */
|
||||
/* 161 */ SDL_SCANCODE_EJECT, /* KEY_EJECTCD */
|
||||
/* 162 */ SDL_SCANCODE_UNKNOWN, /* KEY_EJECTCLOSECD */
|
||||
/* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */
|
||||
/* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */
|
||||
/* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */
|
||||
/* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */
|
||||
/* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */
|
||||
/* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */
|
||||
/* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */
|
||||
/* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */
|
||||
/* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */
|
||||
/* 172 */ SDL_SCANCODE_AC_HOME,
|
||||
/* 173 */ SDL_SCANCODE_AC_REFRESH,
|
||||
/* 174 */ SDL_SCANCODE_UNKNOWN, /* KEY_EXIT */
|
||||
/* 175 */ SDL_SCANCODE_UNKNOWN, /* KEY_MOVE */
|
||||
/* 176 */ SDL_SCANCODE_UNKNOWN, /* KEY_EDIT */
|
||||
/* 177 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLUP */
|
||||
/* 178 */ SDL_SCANCODE_UNKNOWN, /* KEY_SCROLLDOWN */
|
||||
/* 179 */ SDL_SCANCODE_KP_LEFTPAREN,
|
||||
/* 180 */ SDL_SCANCODE_KP_RIGHTPAREN,
|
||||
/* 181 */ SDL_SCANCODE_UNKNOWN, /* KEY_NEW */
|
||||
/* 182 */ SDL_SCANCODE_UNKNOWN, /* KEY_REDO */
|
||||
/* 183 */ SDL_SCANCODE_F13,
|
||||
/* 184 */ SDL_SCANCODE_F14,
|
||||
/* 185 */ SDL_SCANCODE_F15,
|
||||
/* 186 */ SDL_SCANCODE_F16,
|
||||
/* 187 */ SDL_SCANCODE_F17,
|
||||
/* 188 */ SDL_SCANCODE_F18,
|
||||
/* 189 */ SDL_SCANCODE_F19,
|
||||
/* 190 */ SDL_SCANCODE_F20,
|
||||
/* 191 */ SDL_SCANCODE_F21,
|
||||
/* 192 */ SDL_SCANCODE_F22,
|
||||
/* 193 */ SDL_SCANCODE_F23,
|
||||
/* 194 */ SDL_SCANCODE_F24,
|
||||
0, 0, 0, 0, 0,
|
||||
/* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */
|
||||
/* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */
|
||||
/* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */
|
||||
/* 203 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG4 */
|
||||
0,
|
||||
/* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */
|
||||
/* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */
|
||||
/* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */
|
||||
/* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */
|
||||
/* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */
|
||||
/* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */
|
||||
/* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */
|
||||
/* 212 */ SDL_SCANCODE_UNKNOWN, /* KEY_CAMERA */
|
||||
/* 213 */ SDL_SCANCODE_UNKNOWN, /* KEY_SOUND */
|
||||
/* 214 */ SDL_SCANCODE_UNKNOWN, /* KEY_QUESTION */
|
||||
/* 215 */ SDL_SCANCODE_UNKNOWN, /* KEY_EMAIL */
|
||||
/* 216 */ SDL_SCANCODE_UNKNOWN, /* KEY_CHAT */
|
||||
/* 217 */ SDL_SCANCODE_AC_SEARCH,
|
||||
/* 218 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONNECT */
|
||||
/* 219 */ SDL_SCANCODE_UNKNOWN, /* KEY_FINANCE */
|
||||
/* 220 */ SDL_SCANCODE_UNKNOWN, /* KEY_SPORT */
|
||||
/* 221 */ SDL_SCANCODE_UNKNOWN, /* KEY_SHOP */
|
||||
/* 222 */ SDL_SCANCODE_ALTERASE,
|
||||
/* 223 */ SDL_SCANCODE_CANCEL,
|
||||
/* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN,
|
||||
/* 225 */ SDL_SCANCODE_BRIGHTNESSUP,
|
||||
/* 226 */ SDL_SCANCODE_UNKNOWN, /* KEY_MEDIA */
|
||||
/* 227 */ SDL_SCANCODE_DISPLAYSWITCH, /* KEY_SWITCHVIDEOMODE */
|
||||
/* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE,
|
||||
/* 229 */ SDL_SCANCODE_KBDILLUMDOWN,
|
||||
/* 230 */ SDL_SCANCODE_KBDILLUMUP,
|
||||
/* 231 */ SDL_SCANCODE_UNKNOWN, /* KEY_SEND */
|
||||
/* 232 */ SDL_SCANCODE_UNKNOWN, /* KEY_REPLY */
|
||||
/* 233 */ SDL_SCANCODE_UNKNOWN, /* KEY_FORWARDMAIL */
|
||||
/* 234 */ SDL_SCANCODE_UNKNOWN, /* KEY_SAVE */
|
||||
/* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */
|
||||
/* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */
|
||||
};
|
||||
/* *INDENT-ON* */
|
55
externals/SDL/src/events/scancodes_windows.h
vendored
Executable file
55
externals/SDL/src/events/scancodes_windows.h
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../include/SDL_scancode.h"
|
||||
|
||||
/* Windows scancode to SDL scancode mapping table */
|
||||
/* derived from Microsoft scan code document, http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static const SDL_Scancode windows_scancode_table[] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
/* 8 9 A B C D E F */
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */
|
||||
SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */
|
||||
|
||||
SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */
|
||||
SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */
|
||||
|
||||
SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */
|
||||
SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */
|
||||
|
||||
SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,/* 3 */
|
||||
SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */
|
||||
|
||||
SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, /* 4 */
|
||||
SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, /* 4 */
|
||||
|
||||
SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */
|
||||
SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 5 */
|
||||
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, /* 6 */
|
||||
SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 6 */
|
||||
|
||||
SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */
|
||||
};
|
||||
/* *INDENT-ON* */
|
512
externals/SDL/src/events/scancodes_xfree86.h
vendored
Executable file
512
externals/SDL/src/events/scancodes_xfree86.h
vendored
Executable file
@@ -0,0 +1,512 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef scancodes_xfree86_h_
|
||||
#define scancodes_xfree86_h_
|
||||
|
||||
#include "../../include/SDL_scancode.h"
|
||||
|
||||
/* XFree86 key code to SDL scancode mapping table
|
||||
Sources:
|
||||
- atKeyNames.h from XFree86 source code
|
||||
*/
|
||||
/* *INDENT-OFF* */
|
||||
static const SDL_Scancode xfree86_scancode_table[] = {
|
||||
/* 0 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 1 */ SDL_SCANCODE_ESCAPE,
|
||||
/* 2 */ SDL_SCANCODE_1,
|
||||
/* 3 */ SDL_SCANCODE_2,
|
||||
/* 4 */ SDL_SCANCODE_3,
|
||||
/* 5 */ SDL_SCANCODE_4,
|
||||
/* 6 */ SDL_SCANCODE_5,
|
||||
/* 7 */ SDL_SCANCODE_6,
|
||||
/* 8 */ SDL_SCANCODE_7,
|
||||
/* 9 */ SDL_SCANCODE_8,
|
||||
/* 10 */ SDL_SCANCODE_9,
|
||||
/* 11 */ SDL_SCANCODE_0,
|
||||
/* 12 */ SDL_SCANCODE_MINUS,
|
||||
/* 13 */ SDL_SCANCODE_EQUALS,
|
||||
/* 14 */ SDL_SCANCODE_BACKSPACE,
|
||||
/* 15 */ SDL_SCANCODE_TAB,
|
||||
/* 16 */ SDL_SCANCODE_Q,
|
||||
/* 17 */ SDL_SCANCODE_W,
|
||||
/* 18 */ SDL_SCANCODE_E,
|
||||
/* 19 */ SDL_SCANCODE_R,
|
||||
/* 20 */ SDL_SCANCODE_T,
|
||||
/* 21 */ SDL_SCANCODE_Y,
|
||||
/* 22 */ SDL_SCANCODE_U,
|
||||
/* 23 */ SDL_SCANCODE_I,
|
||||
/* 24 */ SDL_SCANCODE_O,
|
||||
/* 25 */ SDL_SCANCODE_P,
|
||||
/* 26 */ SDL_SCANCODE_LEFTBRACKET,
|
||||
/* 27 */ SDL_SCANCODE_RIGHTBRACKET,
|
||||
/* 28 */ SDL_SCANCODE_RETURN,
|
||||
/* 29 */ SDL_SCANCODE_LCTRL,
|
||||
/* 30 */ SDL_SCANCODE_A,
|
||||
/* 31 */ SDL_SCANCODE_S,
|
||||
/* 32 */ SDL_SCANCODE_D,
|
||||
/* 33 */ SDL_SCANCODE_F,
|
||||
/* 34 */ SDL_SCANCODE_G,
|
||||
/* 35 */ SDL_SCANCODE_H,
|
||||
/* 36 */ SDL_SCANCODE_J,
|
||||
/* 37 */ SDL_SCANCODE_K,
|
||||
/* 38 */ SDL_SCANCODE_L,
|
||||
/* 39 */ SDL_SCANCODE_SEMICOLON,
|
||||
/* 40 */ SDL_SCANCODE_APOSTROPHE,
|
||||
/* 41 */ SDL_SCANCODE_GRAVE,
|
||||
/* 42 */ SDL_SCANCODE_LSHIFT,
|
||||
/* 43 */ SDL_SCANCODE_BACKSLASH,
|
||||
/* 44 */ SDL_SCANCODE_Z,
|
||||
/* 45 */ SDL_SCANCODE_X,
|
||||
/* 46 */ SDL_SCANCODE_C,
|
||||
/* 47 */ SDL_SCANCODE_V,
|
||||
/* 48 */ SDL_SCANCODE_B,
|
||||
/* 49 */ SDL_SCANCODE_N,
|
||||
/* 50 */ SDL_SCANCODE_M,
|
||||
/* 51 */ SDL_SCANCODE_COMMA,
|
||||
/* 52 */ SDL_SCANCODE_PERIOD,
|
||||
/* 53 */ SDL_SCANCODE_SLASH,
|
||||
/* 54 */ SDL_SCANCODE_RSHIFT,
|
||||
/* 55 */ SDL_SCANCODE_KP_MULTIPLY,
|
||||
/* 56 */ SDL_SCANCODE_LALT,
|
||||
/* 57 */ SDL_SCANCODE_SPACE,
|
||||
/* 58 */ SDL_SCANCODE_CAPSLOCK,
|
||||
/* 59 */ SDL_SCANCODE_F1,
|
||||
/* 60 */ SDL_SCANCODE_F2,
|
||||
/* 61 */ SDL_SCANCODE_F3,
|
||||
/* 62 */ SDL_SCANCODE_F4,
|
||||
/* 63 */ SDL_SCANCODE_F5,
|
||||
/* 64 */ SDL_SCANCODE_F6,
|
||||
/* 65 */ SDL_SCANCODE_F7,
|
||||
/* 66 */ SDL_SCANCODE_F8,
|
||||
/* 67 */ SDL_SCANCODE_F9,
|
||||
/* 68 */ SDL_SCANCODE_F10,
|
||||
/* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
|
||||
/* 70 */ SDL_SCANCODE_SCROLLLOCK,
|
||||
/* 71 */ SDL_SCANCODE_KP_7,
|
||||
/* 72 */ SDL_SCANCODE_KP_8,
|
||||
/* 73 */ SDL_SCANCODE_KP_9,
|
||||
/* 74 */ SDL_SCANCODE_KP_MINUS,
|
||||
/* 75 */ SDL_SCANCODE_KP_4,
|
||||
/* 76 */ SDL_SCANCODE_KP_5,
|
||||
/* 77 */ SDL_SCANCODE_KP_6,
|
||||
/* 78 */ SDL_SCANCODE_KP_PLUS,
|
||||
/* 79 */ SDL_SCANCODE_KP_1,
|
||||
/* 80 */ SDL_SCANCODE_KP_2,
|
||||
/* 81 */ SDL_SCANCODE_KP_3,
|
||||
/* 82 */ SDL_SCANCODE_KP_0,
|
||||
/* 83 */ SDL_SCANCODE_KP_PERIOD,
|
||||
/* 84 */ SDL_SCANCODE_SYSREQ,
|
||||
/* 85 */ SDL_SCANCODE_MODE,
|
||||
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
|
||||
/* 87 */ SDL_SCANCODE_F11,
|
||||
/* 88 */ SDL_SCANCODE_F12,
|
||||
/* 89 */ SDL_SCANCODE_HOME,
|
||||
/* 90 */ SDL_SCANCODE_UP,
|
||||
/* 91 */ SDL_SCANCODE_PAGEUP,
|
||||
/* 92 */ SDL_SCANCODE_LEFT,
|
||||
/* 93 */ SDL_SCANCODE_BRIGHTNESSDOWN, /* on PowerBook G4 / KEY_Begin */
|
||||
/* 94 */ SDL_SCANCODE_RIGHT,
|
||||
/* 95 */ SDL_SCANCODE_END,
|
||||
/* 96 */ SDL_SCANCODE_DOWN,
|
||||
/* 97 */ SDL_SCANCODE_PAGEDOWN,
|
||||
/* 98 */ SDL_SCANCODE_INSERT,
|
||||
/* 99 */ SDL_SCANCODE_DELETE,
|
||||
/* 100 */ SDL_SCANCODE_KP_ENTER,
|
||||
/* 101 */ SDL_SCANCODE_RCTRL,
|
||||
/* 102 */ SDL_SCANCODE_PAUSE,
|
||||
/* 103 */ SDL_SCANCODE_PRINTSCREEN,
|
||||
/* 104 */ SDL_SCANCODE_KP_DIVIDE,
|
||||
/* 105 */ SDL_SCANCODE_RALT,
|
||||
/* 106 */ SDL_SCANCODE_UNKNOWN, /* BREAK */
|
||||
/* 107 */ SDL_SCANCODE_LGUI,
|
||||
/* 108 */ SDL_SCANCODE_RGUI,
|
||||
/* 109 */ SDL_SCANCODE_APPLICATION,
|
||||
/* 110 */ SDL_SCANCODE_F13,
|
||||
/* 111 */ SDL_SCANCODE_F14,
|
||||
/* 112 */ SDL_SCANCODE_F15,
|
||||
/* 113 */ SDL_SCANCODE_F16,
|
||||
/* 114 */ SDL_SCANCODE_F17,
|
||||
/* 115 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */
|
||||
/* 116 */ SDL_SCANCODE_UNKNOWN, /* is translated to XK_ISO_Level3_Shift by my X server, but I have no keyboard that generates this code, so I don't know what the correct SDL_SCANCODE_* for it is */
|
||||
/* 117 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 118 */ SDL_SCANCODE_KP_EQUALS,
|
||||
/* 119 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 120 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 121 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */
|
||||
/* 122 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 123 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */
|
||||
/* 124 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 125 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
|
||||
/* 126 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 127 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 128 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 129 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 130 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 131 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 132 */ SDL_SCANCODE_POWER,
|
||||
/* 133 */ SDL_SCANCODE_MUTE,
|
||||
/* 134 */ SDL_SCANCODE_VOLUMEDOWN,
|
||||
/* 135 */ SDL_SCANCODE_VOLUMEUP,
|
||||
/* 136 */ SDL_SCANCODE_HELP,
|
||||
/* 137 */ SDL_SCANCODE_STOP,
|
||||
/* 138 */ SDL_SCANCODE_AGAIN,
|
||||
/* 139 */ SDL_SCANCODE_UNKNOWN, /* PROPS */
|
||||
/* 140 */ SDL_SCANCODE_UNDO,
|
||||
/* 141 */ SDL_SCANCODE_UNKNOWN, /* FRONT */
|
||||
/* 142 */ SDL_SCANCODE_COPY,
|
||||
/* 143 */ SDL_SCANCODE_UNKNOWN, /* OPEN */
|
||||
/* 144 */ SDL_SCANCODE_PASTE,
|
||||
/* 145 */ SDL_SCANCODE_FIND,
|
||||
/* 146 */ SDL_SCANCODE_CUT,
|
||||
};
|
||||
|
||||
/* for wireless usb keyboard (manufacturer TRUST) without numpad. */
|
||||
static const SDL_Scancode xfree86_scancode_table2[] = {
|
||||
/* 0 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 1 */ SDL_SCANCODE_ESCAPE,
|
||||
/* 2 */ SDL_SCANCODE_1,
|
||||
/* 3 */ SDL_SCANCODE_2,
|
||||
/* 4 */ SDL_SCANCODE_3,
|
||||
/* 5 */ SDL_SCANCODE_4,
|
||||
/* 6 */ SDL_SCANCODE_5,
|
||||
/* 7 */ SDL_SCANCODE_6,
|
||||
/* 8 */ SDL_SCANCODE_7,
|
||||
/* 9 */ SDL_SCANCODE_8,
|
||||
/* 10 */ SDL_SCANCODE_9,
|
||||
/* 11 */ SDL_SCANCODE_0,
|
||||
/* 12 */ SDL_SCANCODE_MINUS,
|
||||
/* 13 */ SDL_SCANCODE_EQUALS,
|
||||
/* 14 */ SDL_SCANCODE_BACKSPACE,
|
||||
/* 15 */ SDL_SCANCODE_TAB,
|
||||
/* 16 */ SDL_SCANCODE_Q,
|
||||
/* 17 */ SDL_SCANCODE_W,
|
||||
/* 18 */ SDL_SCANCODE_E,
|
||||
/* 19 */ SDL_SCANCODE_R,
|
||||
/* 20 */ SDL_SCANCODE_T,
|
||||
/* 21 */ SDL_SCANCODE_Y,
|
||||
/* 22 */ SDL_SCANCODE_U,
|
||||
/* 23 */ SDL_SCANCODE_I,
|
||||
/* 24 */ SDL_SCANCODE_O,
|
||||
/* 25 */ SDL_SCANCODE_P,
|
||||
/* 26 */ SDL_SCANCODE_LEFTBRACKET,
|
||||
/* 27 */ SDL_SCANCODE_RIGHTBRACKET,
|
||||
/* 28 */ SDL_SCANCODE_RETURN,
|
||||
/* 29 */ SDL_SCANCODE_LCTRL,
|
||||
/* 30 */ SDL_SCANCODE_A,
|
||||
/* 31 */ SDL_SCANCODE_S,
|
||||
/* 32 */ SDL_SCANCODE_D,
|
||||
/* 33 */ SDL_SCANCODE_F,
|
||||
/* 34 */ SDL_SCANCODE_G,
|
||||
/* 35 */ SDL_SCANCODE_H,
|
||||
/* 36 */ SDL_SCANCODE_J,
|
||||
/* 37 */ SDL_SCANCODE_K,
|
||||
/* 38 */ SDL_SCANCODE_L,
|
||||
/* 39 */ SDL_SCANCODE_SEMICOLON,
|
||||
/* 40 */ SDL_SCANCODE_APOSTROPHE,
|
||||
/* 41 */ SDL_SCANCODE_GRAVE,
|
||||
/* 42 */ SDL_SCANCODE_LSHIFT,
|
||||
/* 43 */ SDL_SCANCODE_BACKSLASH,
|
||||
/* 44 */ SDL_SCANCODE_Z,
|
||||
/* 45 */ SDL_SCANCODE_X,
|
||||
/* 46 */ SDL_SCANCODE_C,
|
||||
/* 47 */ SDL_SCANCODE_V,
|
||||
/* 48 */ SDL_SCANCODE_B,
|
||||
/* 49 */ SDL_SCANCODE_N,
|
||||
/* 50 */ SDL_SCANCODE_M,
|
||||
/* 51 */ SDL_SCANCODE_COMMA,
|
||||
/* 52 */ SDL_SCANCODE_PERIOD,
|
||||
/* 53 */ SDL_SCANCODE_SLASH,
|
||||
/* 54 */ SDL_SCANCODE_RSHIFT,
|
||||
/* 55 */ SDL_SCANCODE_KP_MULTIPLY,
|
||||
/* 56 */ SDL_SCANCODE_LALT,
|
||||
/* 57 */ SDL_SCANCODE_SPACE,
|
||||
/* 58 */ SDL_SCANCODE_CAPSLOCK,
|
||||
/* 59 */ SDL_SCANCODE_F1,
|
||||
/* 60 */ SDL_SCANCODE_F2,
|
||||
/* 61 */ SDL_SCANCODE_F3,
|
||||
/* 62 */ SDL_SCANCODE_F4,
|
||||
/* 63 */ SDL_SCANCODE_F5,
|
||||
/* 64 */ SDL_SCANCODE_F6,
|
||||
/* 65 */ SDL_SCANCODE_F7,
|
||||
/* 66 */ SDL_SCANCODE_F8,
|
||||
/* 67 */ SDL_SCANCODE_F9,
|
||||
/* 68 */ SDL_SCANCODE_F10,
|
||||
/* 69 */ SDL_SCANCODE_NUMLOCKCLEAR,
|
||||
/* 70 */ SDL_SCANCODE_SCROLLLOCK,
|
||||
/* 71 */ SDL_SCANCODE_KP_7,
|
||||
/* 72 */ SDL_SCANCODE_KP_8,
|
||||
/* 73 */ SDL_SCANCODE_KP_9,
|
||||
/* 74 */ SDL_SCANCODE_KP_MINUS,
|
||||
/* 75 */ SDL_SCANCODE_KP_4,
|
||||
/* 76 */ SDL_SCANCODE_KP_5,
|
||||
/* 77 */ SDL_SCANCODE_KP_6,
|
||||
/* 78 */ SDL_SCANCODE_KP_PLUS,
|
||||
/* 79 */ SDL_SCANCODE_KP_1,
|
||||
/* 80 */ SDL_SCANCODE_KP_2,
|
||||
/* 81 */ SDL_SCANCODE_KP_3,
|
||||
/* 82 */ SDL_SCANCODE_KP_0,
|
||||
/* 83 */ SDL_SCANCODE_KP_PERIOD,
|
||||
/* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */
|
||||
/* 85 */ SDL_SCANCODE_MODE, /* ???? */
|
||||
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
|
||||
/* 87 */ SDL_SCANCODE_F11,
|
||||
/* 88 */ SDL_SCANCODE_F12,
|
||||
/* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */
|
||||
/* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */
|
||||
/* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */
|
||||
/* 92 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */
|
||||
/* 93 */ SDL_SCANCODE_INTERNATIONAL2, /* Hiragana_Katakana */
|
||||
/* 94 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */
|
||||
/* 95 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 96 */ SDL_SCANCODE_KP_ENTER,
|
||||
/* 97 */ SDL_SCANCODE_RCTRL,
|
||||
/* 98 */ SDL_SCANCODE_KP_DIVIDE,
|
||||
/* 99 */ SDL_SCANCODE_PRINTSCREEN,
|
||||
/* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */
|
||||
/* 101 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */
|
||||
/* 102 */ SDL_SCANCODE_HOME,
|
||||
/* 103 */ SDL_SCANCODE_UP,
|
||||
/* 104 */ SDL_SCANCODE_PAGEUP,
|
||||
/* 105 */ SDL_SCANCODE_LEFT,
|
||||
/* 106 */ SDL_SCANCODE_RIGHT,
|
||||
/* 107 */ SDL_SCANCODE_END,
|
||||
/* 108 */ SDL_SCANCODE_DOWN,
|
||||
/* 109 */ SDL_SCANCODE_PAGEDOWN,
|
||||
/* 110 */ SDL_SCANCODE_INSERT,
|
||||
/* 111 */ SDL_SCANCODE_DELETE,
|
||||
/* 112 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 113 */ SDL_SCANCODE_MUTE,
|
||||
/* 114 */ SDL_SCANCODE_VOLUMEDOWN,
|
||||
/* 115 */ SDL_SCANCODE_VOLUMEUP,
|
||||
/* 116 */ SDL_SCANCODE_POWER,
|
||||
/* 117 */ SDL_SCANCODE_KP_EQUALS,
|
||||
/* 118 */ SDL_SCANCODE_KP_PLUSMINUS, /* plusminus */
|
||||
/* 119 */ SDL_SCANCODE_PAUSE,
|
||||
/* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */
|
||||
/* 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,
|
||||
/* 127 */ SDL_SCANCODE_APPLICATION,
|
||||
/* 128 */ SDL_SCANCODE_CANCEL,
|
||||
/* 129 */ SDL_SCANCODE_AGAIN,
|
||||
/* 130 */ SDL_SCANCODE_UNKNOWN, /* SunProps */
|
||||
/* 131 */ SDL_SCANCODE_UNDO,
|
||||
/* 132 */ SDL_SCANCODE_UNKNOWN, /* SunFront */
|
||||
/* 133 */ SDL_SCANCODE_COPY,
|
||||
/* 134 */ SDL_SCANCODE_UNKNOWN, /* SunOpen */
|
||||
/* 135 */ SDL_SCANCODE_PASTE,
|
||||
/* 136 */ SDL_SCANCODE_FIND,
|
||||
/* 137 */ SDL_SCANCODE_CUT,
|
||||
/* 138 */ SDL_SCANCODE_HELP,
|
||||
/* 139 */ SDL_SCANCODE_MENU, /* XF86MenuKB */
|
||||
/* 140 */ SDL_SCANCODE_CALCULATOR,
|
||||
/* 141 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 142 */ SDL_SCANCODE_SLEEP,
|
||||
/* 143 */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */
|
||||
/* 144 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */
|
||||
/* 145 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
|
||||
/* 146 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 147 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */
|
||||
/* 148 */ SDL_SCANCODE_APP1, /* XF86Launch1 */
|
||||
/* 149 */ SDL_SCANCODE_APP2, /* XF86Launch2 */
|
||||
/* 150 */ SDL_SCANCODE_WWW,
|
||||
/* 151 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */
|
||||
/* 152 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */
|
||||
/* 153 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 154 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */
|
||||
/* 155 */ SDL_SCANCODE_MAIL,
|
||||
/* 156 */ SDL_SCANCODE_AC_BOOKMARKS, /* XF86Favorites */
|
||||
/* 157 */ SDL_SCANCODE_COMPUTER,
|
||||
/* 158 */ SDL_SCANCODE_AC_BACK,
|
||||
/* 159 */ SDL_SCANCODE_AC_FORWARD,
|
||||
/* 160 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 161 */ SDL_SCANCODE_EJECT,
|
||||
/* 162 */ SDL_SCANCODE_EJECT,
|
||||
/* 163 */ SDL_SCANCODE_AUDIONEXT,
|
||||
/* 164 */ SDL_SCANCODE_AUDIOPLAY,
|
||||
/* 165 */ SDL_SCANCODE_AUDIOPREV,
|
||||
/* 166 */ SDL_SCANCODE_AUDIOSTOP,
|
||||
/* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */
|
||||
/* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */
|
||||
/* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */
|
||||
/* 170 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 171 */ SDL_SCANCODE_F13, /* XF86Tools */
|
||||
/* 172 */ SDL_SCANCODE_AC_HOME,
|
||||
/* 173 */ SDL_SCANCODE_AC_REFRESH,
|
||||
/* 174 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
|
||||
/* 175 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 176 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */
|
||||
/* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */
|
||||
/* 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 */
|
||||
/* 184 */ SDL_SCANCODE_F14, /* XF86Launch5 */
|
||||
/* 185 */ SDL_SCANCODE_F15, /* XF86Launch6 */
|
||||
/* 186 */ SDL_SCANCODE_F16, /* XF86Launch7 */
|
||||
/* 187 */ SDL_SCANCODE_F17, /* XF86Launch8 */
|
||||
/* 188 */ SDL_SCANCODE_F18, /* XF86Launch9 */
|
||||
/* 189 */ SDL_SCANCODE_F19, /* null keysym */
|
||||
/* 190 */ SDL_SCANCODE_F20,
|
||||
/* 191 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */
|
||||
/* 193 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 194 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 195 */ SDL_SCANCODE_MODE,
|
||||
/* 196 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 197 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 198 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 199 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 200 */ SDL_SCANCODE_AUDIOPLAY,
|
||||
/* 201 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */
|
||||
/* 202 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */
|
||||
/* 203 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */
|
||||
/* 204 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */
|
||||
/* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */
|
||||
/* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
|
||||
/* 207 */ SDL_SCANCODE_AUDIOPLAY,
|
||||
/* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD,
|
||||
/* 209 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 210 */ SDL_SCANCODE_PRINTSCREEN,
|
||||
/* 211 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 212 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */
|
||||
/* 213 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 214 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 215 */ SDL_SCANCODE_MAIL,
|
||||
/* 216 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 217 */ SDL_SCANCODE_AC_SEARCH,
|
||||
/* 218 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 219 */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */
|
||||
/* 220 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 221 */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */
|
||||
/* 222 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 223 */ SDL_SCANCODE_STOP,
|
||||
/* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN,
|
||||
/* 225 */ SDL_SCANCODE_BRIGHTNESSUP,
|
||||
/* 226 */ SDL_SCANCODE_MEDIASELECT,
|
||||
/* 227 */ SDL_SCANCODE_DISPLAYSWITCH,
|
||||
/* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE,
|
||||
/* 229 */ SDL_SCANCODE_KBDILLUMDOWN,
|
||||
/* 230 */ SDL_SCANCODE_KBDILLUMUP,
|
||||
/* 231 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
|
||||
/* 232 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */
|
||||
/* 233 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */
|
||||
/* 234 */ SDL_SCANCODE_UNKNOWN, /* XF86Save */
|
||||
/* 235 */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */
|
||||
/* 236 */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */
|
||||
/* 237 */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */
|
||||
/* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */
|
||||
};
|
||||
|
||||
/* Xvnc / Xtightvnc scancodes from xmodmap -pk */
|
||||
static const SDL_Scancode xvnc_scancode_table[] = {
|
||||
/* 0 */ SDL_SCANCODE_LCTRL,
|
||||
/* 1 */ SDL_SCANCODE_RCTRL,
|
||||
/* 2 */ SDL_SCANCODE_LSHIFT,
|
||||
/* 3 */ SDL_SCANCODE_RSHIFT,
|
||||
/* 4 */ SDL_SCANCODE_UNKNOWN, /* Meta_L */
|
||||
/* 5 */ SDL_SCANCODE_UNKNOWN, /* Meta_R */
|
||||
/* 6 */ SDL_SCANCODE_LALT,
|
||||
/* 7 */ SDL_SCANCODE_RALT,
|
||||
/* 8 */ SDL_SCANCODE_SPACE,
|
||||
/* 9 */ SDL_SCANCODE_0,
|
||||
/* 10 */ SDL_SCANCODE_1,
|
||||
/* 11 */ SDL_SCANCODE_2,
|
||||
/* 12 */ SDL_SCANCODE_3,
|
||||
/* 13 */ SDL_SCANCODE_4,
|
||||
/* 14 */ SDL_SCANCODE_5,
|
||||
/* 15 */ SDL_SCANCODE_6,
|
||||
/* 16 */ SDL_SCANCODE_7,
|
||||
/* 17 */ SDL_SCANCODE_8,
|
||||
/* 18 */ SDL_SCANCODE_9,
|
||||
/* 19 */ SDL_SCANCODE_MINUS,
|
||||
/* 20 */ SDL_SCANCODE_EQUALS,
|
||||
/* 21 */ SDL_SCANCODE_LEFTBRACKET,
|
||||
/* 22 */ SDL_SCANCODE_RIGHTBRACKET,
|
||||
/* 23 */ SDL_SCANCODE_SEMICOLON,
|
||||
/* 24 */ SDL_SCANCODE_APOSTROPHE,
|
||||
/* 25 */ SDL_SCANCODE_GRAVE,
|
||||
/* 26 */ SDL_SCANCODE_COMMA,
|
||||
/* 27 */ SDL_SCANCODE_PERIOD,
|
||||
/* 28 */ SDL_SCANCODE_SLASH,
|
||||
/* 29 */ SDL_SCANCODE_BACKSLASH,
|
||||
/* 30 */ SDL_SCANCODE_A,
|
||||
/* 31 */ SDL_SCANCODE_B,
|
||||
/* 32 */ SDL_SCANCODE_C,
|
||||
/* 33 */ SDL_SCANCODE_D,
|
||||
/* 34 */ SDL_SCANCODE_E,
|
||||
/* 35 */ SDL_SCANCODE_F,
|
||||
/* 36 */ SDL_SCANCODE_G,
|
||||
/* 37 */ SDL_SCANCODE_H,
|
||||
/* 38 */ SDL_SCANCODE_I,
|
||||
/* 39 */ SDL_SCANCODE_J,
|
||||
/* 40 */ SDL_SCANCODE_K,
|
||||
/* 41 */ SDL_SCANCODE_L,
|
||||
/* 42 */ SDL_SCANCODE_M,
|
||||
/* 43 */ SDL_SCANCODE_N,
|
||||
/* 44 */ SDL_SCANCODE_O,
|
||||
/* 45 */ SDL_SCANCODE_P,
|
||||
/* 46 */ SDL_SCANCODE_Q,
|
||||
/* 47 */ SDL_SCANCODE_R,
|
||||
/* 48 */ SDL_SCANCODE_S,
|
||||
/* 49 */ SDL_SCANCODE_T,
|
||||
/* 50 */ SDL_SCANCODE_U,
|
||||
/* 51 */ SDL_SCANCODE_V,
|
||||
/* 52 */ SDL_SCANCODE_W,
|
||||
/* 53 */ SDL_SCANCODE_X,
|
||||
/* 54 */ SDL_SCANCODE_Y,
|
||||
/* 55 */ SDL_SCANCODE_Z,
|
||||
/* 56 */ SDL_SCANCODE_BACKSPACE,
|
||||
/* 57 */ SDL_SCANCODE_RETURN,
|
||||
/* 58 */ SDL_SCANCODE_TAB,
|
||||
/* 59 */ SDL_SCANCODE_ESCAPE,
|
||||
/* 60 */ SDL_SCANCODE_DELETE,
|
||||
/* 61 */ SDL_SCANCODE_HOME,
|
||||
/* 62 */ SDL_SCANCODE_END,
|
||||
/* 63 */ SDL_SCANCODE_PAGEUP,
|
||||
/* 64 */ SDL_SCANCODE_PAGEDOWN,
|
||||
/* 65 */ SDL_SCANCODE_UP,
|
||||
/* 66 */ SDL_SCANCODE_DOWN,
|
||||
/* 67 */ SDL_SCANCODE_LEFT,
|
||||
/* 68 */ SDL_SCANCODE_RIGHT,
|
||||
/* 69 */ SDL_SCANCODE_F1,
|
||||
/* 70 */ SDL_SCANCODE_F2,
|
||||
/* 71 */ SDL_SCANCODE_F3,
|
||||
/* 72 */ SDL_SCANCODE_F4,
|
||||
/* 73 */ SDL_SCANCODE_F5,
|
||||
/* 74 */ SDL_SCANCODE_F6,
|
||||
/* 75 */ SDL_SCANCODE_F7,
|
||||
/* 76 */ SDL_SCANCODE_F8,
|
||||
/* 77 */ SDL_SCANCODE_F9,
|
||||
/* 78 */ SDL_SCANCODE_F10,
|
||||
/* 79 */ SDL_SCANCODE_F11,
|
||||
/* 80 */ SDL_SCANCODE_F12,
|
||||
};
|
||||
|
||||
#endif /* scancodes_xfree86_h_ */
|
||||
|
||||
/* *INDENT-ON* */
|
Reference in New Issue
Block a user