mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
sdl 2.0.8 update
This commit is contained in:
parent
d6f6bc65a5
commit
ec8f56b3b0
894 changed files with 66879 additions and 43299 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,11 +20,11 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_clipboardevents_c_h
|
||||
#define _SDL_clipboardevents_c_h
|
||||
#ifndef SDL_clipboardevents_c_h_
|
||||
#define SDL_clipboardevents_c_h_
|
||||
|
||||
extern int SDL_SendClipboardUpdate(void);
|
||||
|
||||
#endif /* _SDL_clipboardevents_c_h */
|
||||
#endif /* SDL_clipboardevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,13 +20,13 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_dropevents_c_h
|
||||
#define _SDL_dropevents_c_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 */
|
||||
#endif /* SDL_dropevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "SDL.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "../timer/SDL_timer_c.h"
|
||||
|
|
@ -32,21 +31,25 @@
|
|||
#include "../joystick/SDL_joystick_c.h"
|
||||
#endif
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
#include "SDL_syswm.h"
|
||||
|
||||
/*#define SDL_DEBUG_EVENTS 1*/
|
||||
|
||||
/* An arbitrary limit so we don't have unbounded growth */
|
||||
#define SDL_MAX_QUEUED_EVENTS 65535
|
||||
|
||||
/* Public data -- the event filter */
|
||||
SDL_EventFilter SDL_EventOK = NULL;
|
||||
void *SDL_EventOKParam;
|
||||
|
||||
typedef struct SDL_EventWatcher {
|
||||
SDL_EventFilter callback;
|
||||
void *userdata;
|
||||
struct SDL_EventWatcher *next;
|
||||
SDL_bool removed;
|
||||
} SDL_EventWatcher;
|
||||
|
||||
static SDL_mutex *SDL_event_watchers_lock;
|
||||
static SDL_EventWatcher SDL_EventOK;
|
||||
static SDL_EventWatcher *SDL_event_watchers = NULL;
|
||||
static int SDL_event_watchers_count = 0;
|
||||
static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE;
|
||||
static SDL_bool SDL_event_watchers_removed = SDL_FALSE;
|
||||
|
||||
typedef struct {
|
||||
Uint32 bits[8];
|
||||
|
|
@ -84,6 +87,230 @@ static struct
|
|||
} SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL };
|
||||
|
||||
|
||||
#ifdef SDL_DEBUG_EVENTS
|
||||
|
||||
/* this is to make printf() calls cleaner. */
|
||||
#define uint unsigned int
|
||||
|
||||
static void
|
||||
SDL_DebugPrintEvent(const SDL_Event *event)
|
||||
{
|
||||
/* !!! FIXME: This code is kinda ugly, sorry. */
|
||||
printf("SDL EVENT: ");
|
||||
|
||||
if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) {
|
||||
printf("SDL_USEREVENT");
|
||||
if (event->type > SDL_USEREVENT) {
|
||||
printf("+%u", ((uint) event->type) - SDL_USEREVENT);
|
||||
}
|
||||
printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)",
|
||||
(uint) event->user.timestamp, (uint) event->user.windowID,
|
||||
(int) event->user.code, event->user.data1, event->user.data2);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->type) {
|
||||
#define SDL_EVENT_CASE(x) case x: printf("%s", #x);
|
||||
SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break;
|
||||
SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break;
|
||||
SDL_EVENT_CASE(SDL_APP_TERMINATING) break;
|
||||
SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break;
|
||||
SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break;
|
||||
SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break;
|
||||
SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break;
|
||||
SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break;
|
||||
SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break;
|
||||
SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break;
|
||||
SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break;
|
||||
SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break;
|
||||
#undef SDL_EVENT_CASE
|
||||
|
||||
#define SDL_EVENT_CASE(x) case x: printf("%s ", #x);
|
||||
|
||||
SDL_EVENT_CASE(SDL_WINDOWEVENT)
|
||||
printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID);
|
||||
switch(event->window.event) {
|
||||
case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break;
|
||||
#define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS);
|
||||
SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST);
|
||||
#undef SDL_WINDOWEVENT_CASE
|
||||
default: printf("UNKNOWN(bug? fixme?)"); break;
|
||||
}
|
||||
printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2);
|
||||
break;
|
||||
|
||||
SDL_EVENT_CASE(SDL_SYSWMEVENT)
|
||||
printf("(timestamp=%u)", (uint) event->syswm.timestamp);
|
||||
/* !!! FIXME: we don't delve further at the moment. */
|
||||
break;
|
||||
|
||||
#define PRINT_KEY_EVENT(event) \
|
||||
printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \
|
||||
(uint) event->key.timestamp, (uint) event->key.windowID, \
|
||||
event->key.state == SDL_PRESSED ? "pressed" : "released", \
|
||||
event->key.repeat ? "true" : "false", \
|
||||
(uint) event->key.keysym.scancode, \
|
||||
(uint) event->key.keysym.sym, \
|
||||
(uint) event->key.keysym.mod)
|
||||
SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break;
|
||||
#undef PRINT_KEY_EVENT
|
||||
|
||||
SDL_EVENT_CASE(SDL_TEXTEDITING)
|
||||
printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)",
|
||||
(uint) event->edit.timestamp, (uint) event->edit.windowID,
|
||||
event->edit.text, (int) event->edit.start, (int) event->edit.length);
|
||||
break;
|
||||
|
||||
SDL_EVENT_CASE(SDL_TEXTINPUT)
|
||||
printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text);
|
||||
break;
|
||||
|
||||
|
||||
SDL_EVENT_CASE(SDL_MOUSEMOTION)
|
||||
printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)",
|
||||
(uint) event->motion.timestamp, (uint) event->motion.windowID,
|
||||
(uint) event->motion.which, (uint) event->motion.state,
|
||||
(int) event->motion.x, (int) event->motion.y,
|
||||
(int) event->motion.xrel, (int) event->motion.yrel);
|
||||
break;
|
||||
|
||||
#define PRINT_MBUTTON_EVENT(event) \
|
||||
printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \
|
||||
(uint) event->button.timestamp, (uint) event->button.windowID, \
|
||||
(uint) event->button.which, (uint) event->button.button, \
|
||||
event->button.state == SDL_PRESSED ? "pressed" : "released", \
|
||||
(uint) event->button.clicks, (int) event->button.x, (int) event->button.y)
|
||||
SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break;
|
||||
#undef PRINT_MBUTTON_EVENT
|
||||
|
||||
|
||||
SDL_EVENT_CASE(SDL_MOUSEWHEEL)
|
||||
printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)",
|
||||
(uint) event->wheel.timestamp, (uint) event->wheel.windowID,
|
||||
(uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y,
|
||||
event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
|
||||
break;
|
||||
|
||||
SDL_EVENT_CASE(SDL_JOYAXISMOTION)
|
||||
printf("(timestamp=%u which=%d axis=%u value=%d)",
|
||||
(uint) event->jaxis.timestamp, (int) event->jaxis.which,
|
||||
(uint) event->jaxis.axis, (int) event->jaxis.value);
|
||||
break;
|
||||
|
||||
SDL_EVENT_CASE(SDL_JOYBALLMOTION)
|
||||
printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)",
|
||||
(uint) event->jball.timestamp, (int) event->jball.which,
|
||||
(uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel);
|
||||
break;
|
||||
|
||||
SDL_EVENT_CASE(SDL_JOYHATMOTION)
|
||||
printf("(timestamp=%u which=%d hat=%u value=%u)",
|
||||
(uint) event->jhat.timestamp, (int) event->jhat.which,
|
||||
(uint) event->jhat.hat, (uint) event->jhat.value);
|
||||
break;
|
||||
|
||||
#define PRINT_JBUTTON_EVENT(event) \
|
||||
printf("(timestamp=%u which=%d button=%u state=%s)", \
|
||||
(uint) event->jbutton.timestamp, (int) event->jbutton.which, \
|
||||
(uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released")
|
||||
SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break;
|
||||
#undef PRINT_JBUTTON_EVENT
|
||||
|
||||
#define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which)
|
||||
SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break;
|
||||
#undef PRINT_JOYDEV_EVENT
|
||||
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION)
|
||||
printf("(timestamp=%u which=%d axis=%u value=%d)",
|
||||
(uint) event->caxis.timestamp, (int) event->caxis.which,
|
||||
(uint) event->caxis.axis, (int) event->caxis.value);
|
||||
break;
|
||||
|
||||
#define PRINT_CBUTTON_EVENT(event) \
|
||||
printf("(timestamp=%u which=%d button=%u state=%s)", \
|
||||
(uint) event->cbutton.timestamp, (int) event->cbutton.which, \
|
||||
(uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released")
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break;
|
||||
#undef PRINT_CBUTTON_EVENT
|
||||
|
||||
#define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which)
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break;
|
||||
#undef PRINT_CONTROLLERDEV_EVENT
|
||||
|
||||
#define PRINT_FINGER_EVENT(event) \
|
||||
printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \
|
||||
(uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \
|
||||
(long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
||||
SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
|
||||
#undef PRINT_FINGER_EVENT
|
||||
|
||||
#define PRINT_DOLLAR_EVENT(event) \
|
||||
printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \
|
||||
(uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \
|
||||
(long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
|
||||
event->dgesture.error, event->dgesture.x, event->dgesture.y);
|
||||
SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
|
||||
#undef PRINT_DOLLAR_EVENT
|
||||
|
||||
SDL_EVENT_CASE(SDL_MULTIGESTURE)
|
||||
printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
|
||||
(uint) event->mgesture.timestamp, (long long) event->mgesture.touchId,
|
||||
event->mgesture.dTheta, event->mgesture.dDist,
|
||||
event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers);
|
||||
break;
|
||||
|
||||
#define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID)
|
||||
SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break;
|
||||
#undef PRINT_DROP_EVENT
|
||||
|
||||
#define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false");
|
||||
SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break;
|
||||
SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break;
|
||||
#undef PRINT_AUDIODEV_EVENT
|
||||
|
||||
#undef SDL_EVENT_CASE
|
||||
|
||||
default:
|
||||
printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type);
|
||||
break;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
#undef uint
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Public functions */
|
||||
|
||||
void
|
||||
|
|
@ -141,12 +368,16 @@ SDL_StopEventLoop(void)
|
|||
SDL_disabled_events[i] = NULL;
|
||||
}
|
||||
|
||||
while (SDL_event_watchers) {
|
||||
SDL_EventWatcher *tmp = SDL_event_watchers;
|
||||
SDL_event_watchers = tmp->next;
|
||||
SDL_free(tmp);
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_DestroyMutex(SDL_event_watchers_lock);
|
||||
SDL_event_watchers_lock = NULL;
|
||||
}
|
||||
SDL_EventOK = NULL;
|
||||
if (SDL_event_watchers) {
|
||||
SDL_free(SDL_event_watchers);
|
||||
SDL_event_watchers = NULL;
|
||||
SDL_event_watchers_count = 0;
|
||||
}
|
||||
SDL_zero(SDL_EventOK);
|
||||
|
||||
if (SDL_EventQ.lock) {
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
|
|
@ -169,9 +400,16 @@ SDL_StartEventLoop(void)
|
|||
#if !SDL_THREADS_DISABLED
|
||||
if (!SDL_EventQ.lock) {
|
||||
SDL_EventQ.lock = SDL_CreateMutex();
|
||||
if (SDL_EventQ.lock == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (SDL_EventQ.lock == NULL) {
|
||||
return -1;
|
||||
|
||||
if (!SDL_event_watchers_lock) {
|
||||
SDL_event_watchers_lock = SDL_CreateMutex();
|
||||
if (SDL_event_watchers_lock == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif /* !SDL_THREADS_DISABLED */
|
||||
|
||||
|
|
@ -209,6 +447,10 @@ SDL_AddEvent(SDL_Event * event)
|
|||
SDL_EventQ.free = entry->next;
|
||||
}
|
||||
|
||||
#ifdef SDL_DEBUG_EVENTS
|
||||
SDL_DebugPrintEvent(event);
|
||||
#endif
|
||||
|
||||
entry->event = *event;
|
||||
if (event->type == SDL_SYSWMEVENT) {
|
||||
entry->msg = *event->syswm.msg;
|
||||
|
|
@ -376,7 +618,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
|
|||
#endif
|
||||
|
||||
/* Lock the event queue */
|
||||
if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
SDL_EventEntry *entry, *next;
|
||||
Uint32 type;
|
||||
for (entry = SDL_EventQ.head; entry; entry = next) {
|
||||
|
|
@ -386,7 +628,9 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
|
|||
SDL_CutEvent(entry);
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
if (SDL_EventQ.lock) {
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -458,16 +702,46 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
|
|||
int
|
||||
SDL_PushEvent(SDL_Event * event)
|
||||
{
|
||||
SDL_EventWatcher *curr;
|
||||
|
||||
event->common.timestamp = SDL_GetTicks();
|
||||
|
||||
if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
|
||||
return 0;
|
||||
}
|
||||
if (SDL_EventOK.callback || SDL_event_watchers_count > 0) {
|
||||
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
|
||||
if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) {
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (curr = SDL_event_watchers; curr; curr = curr->next) {
|
||||
curr->callback(curr->userdata, event);
|
||||
if (SDL_event_watchers_count > 0) {
|
||||
/* Make sure we only dispatch the current watcher list */
|
||||
int i, event_watchers_count = SDL_event_watchers_count;
|
||||
|
||||
SDL_event_watchers_dispatching = SDL_TRUE;
|
||||
for (i = 0; i < event_watchers_count; ++i) {
|
||||
if (!SDL_event_watchers[i].removed) {
|
||||
SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event);
|
||||
}
|
||||
}
|
||||
SDL_event_watchers_dispatching = SDL_FALSE;
|
||||
|
||||
if (SDL_event_watchers_removed) {
|
||||
for (i = SDL_event_watchers_count; i--; ) {
|
||||
if (SDL_event_watchers[i].removed) {
|
||||
--SDL_event_watchers_count;
|
||||
if (i < SDL_event_watchers_count) {
|
||||
SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_event_watchers_removed = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) {
|
||||
|
|
@ -482,69 +756,89 @@ SDL_PushEvent(SDL_Event * event)
|
|||
void
|
||||
SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)
|
||||
{
|
||||
/* Set filter and discard pending events */
|
||||
SDL_EventOK = NULL;
|
||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
SDL_EventOKParam = userdata;
|
||||
SDL_EventOK = filter;
|
||||
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
|
||||
/* Set filter and discard pending events */
|
||||
SDL_EventOK.callback = filter;
|
||||
SDL_EventOK.userdata = userdata;
|
||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)
|
||||
{
|
||||
SDL_EventWatcher event_ok;
|
||||
|
||||
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
|
||||
event_ok = SDL_EventOK;
|
||||
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
} else {
|
||||
SDL_zero(event_ok);
|
||||
}
|
||||
|
||||
if (filter) {
|
||||
*filter = SDL_EventOK;
|
||||
*filter = event_ok.callback;
|
||||
}
|
||||
if (userdata) {
|
||||
*userdata = SDL_EventOKParam;
|
||||
*userdata = event_ok.userdata;
|
||||
}
|
||||
return SDL_EventOK ? SDL_TRUE : SDL_FALSE;
|
||||
return event_ok.callback ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
/* FIXME: This is not thread-safe yet */
|
||||
void
|
||||
SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)
|
||||
{
|
||||
SDL_EventWatcher *watcher, *tail;
|
||||
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
|
||||
SDL_EventWatcher *event_watchers;
|
||||
|
||||
watcher = (SDL_EventWatcher *)SDL_malloc(sizeof(*watcher));
|
||||
if (!watcher) {
|
||||
/* Uh oh... */
|
||||
return;
|
||||
}
|
||||
event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers));
|
||||
if (event_watchers) {
|
||||
SDL_EventWatcher *watcher;
|
||||
|
||||
/* create the watcher */
|
||||
watcher->callback = filter;
|
||||
watcher->userdata = userdata;
|
||||
watcher->next = NULL;
|
||||
|
||||
/* add the watcher to the end of the list */
|
||||
if (SDL_event_watchers) {
|
||||
for (tail = SDL_event_watchers; tail->next; tail = tail->next) {
|
||||
continue;
|
||||
SDL_event_watchers = event_watchers;
|
||||
watcher = &SDL_event_watchers[SDL_event_watchers_count];
|
||||
watcher->callback = filter;
|
||||
watcher->userdata = userdata;
|
||||
watcher->removed = SDL_FALSE;
|
||||
++SDL_event_watchers_count;
|
||||
}
|
||||
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
tail->next = watcher;
|
||||
} else {
|
||||
SDL_event_watchers = watcher;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: This is not thread-safe yet */
|
||||
void
|
||||
SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
|
||||
{
|
||||
SDL_EventWatcher *prev = NULL;
|
||||
SDL_EventWatcher *curr;
|
||||
if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) {
|
||||
int i;
|
||||
|
||||
for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->next) {
|
||||
if (curr->callback == filter && curr->userdata == userdata) {
|
||||
if (prev) {
|
||||
prev->next = curr->next;
|
||||
} else {
|
||||
SDL_event_watchers = curr->next;
|
||||
for (i = 0; i < SDL_event_watchers_count; ++i) {
|
||||
if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) {
|
||||
if (SDL_event_watchers_dispatching) {
|
||||
SDL_event_watchers[i].removed = SDL_TRUE;
|
||||
SDL_event_watchers_removed = SDL_TRUE;
|
||||
} else {
|
||||
--SDL_event_watchers_count;
|
||||
if (i < SDL_event_watchers_count) {
|
||||
SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
SDL_free(curr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SDL_event_watchers_lock) {
|
||||
SDL_UnlockMutex(SDL_event_watchers_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -552,7 +846,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)
|
|||
void
|
||||
SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
|
||||
{
|
||||
if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) {
|
||||
SDL_EventEntry *entry, *next;
|
||||
for (entry = SDL_EventQ.head; entry; entry = next) {
|
||||
next = entry->next;
|
||||
|
|
@ -560,7 +854,9 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata)
|
|||
SDL_CutEvent(entry);
|
||||
}
|
||||
}
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
if (SDL_EventQ.lock) {
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -46,8 +46,4 @@ extern void SDL_QuitQuit(void);
|
|||
|
||||
extern void SDL_SendPendingQuit(void);
|
||||
|
||||
/* The event filter function */
|
||||
extern SDL_EventFilter SDL_EventOK;
|
||||
extern void *SDL_EventOKParam;
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -71,9 +71,9 @@ typedef struct {
|
|||
SDL_bool recording;
|
||||
} SDL_GestureTouch;
|
||||
|
||||
SDL_GestureTouch *SDL_gestureTouch;
|
||||
int SDL_numGestureTouches = 0;
|
||||
SDL_bool recordAll;
|
||||
static SDL_GestureTouch *SDL_gestureTouch;
|
||||
static int SDL_numGestureTouches = 0;
|
||||
static SDL_bool recordAll;
|
||||
|
||||
#if 0
|
||||
static void PrintPath(SDL_FloatPoint *path)
|
||||
|
|
@ -101,6 +101,12 @@ int SDL_RecordGesture(SDL_TouchID touchId)
|
|||
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;
|
||||
|
|
@ -374,7 +380,7 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
|
|||
dist += d;
|
||||
}
|
||||
if (numPoints < DOLLARNPOINTS-1) {
|
||||
SDL_SetError("ERROR: NumPoints = %i\n",numPoints);
|
||||
SDL_SetError("ERROR: NumPoints = %i", numPoints);
|
||||
return 0;
|
||||
}
|
||||
/* copy the last point */
|
||||
|
|
@ -457,6 +463,28 @@ int SDL_GestureAddTouch(SDL_TouchID touchId)
|
|||
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;
|
||||
|
|
@ -468,7 +496,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
|
||||
static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.mgesture.type = SDL_MULTIGESTURE;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,15 +20,16 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_gesture_c_h
|
||||
#define _SDL_gesture_c_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 int SDL_RecordGesture(SDL_TouchID touchId);
|
||||
extern void SDL_GestureQuit(void);
|
||||
|
||||
#endif /* _SDL_gesture_c_h */
|
||||
#endif /* SDL_gesture_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -273,6 +273,10 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
|
|||
SDLK_KBDILLUMUP,
|
||||
SDLK_EJECT,
|
||||
SDLK_SLEEP,
|
||||
SDLK_APP1,
|
||||
SDLK_APP2,
|
||||
SDLK_AUDIOREWIND,
|
||||
SDLK_AUDIOFASTFORWARD,
|
||||
};
|
||||
|
||||
static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
|
||||
|
|
@ -505,6 +509,10 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
|
|||
"KBDIllumUp",
|
||||
"Eject",
|
||||
"Sleep",
|
||||
"App1",
|
||||
"App2",
|
||||
"AudioRewind",
|
||||
"AudioFastForward",
|
||||
};
|
||||
|
||||
/* Taken from SDL_iconv() */
|
||||
|
|
@ -569,7 +577,7 @@ SDL_ResetKeyboard(void)
|
|||
#ifdef DEBUG_KEYBOARD
|
||||
printf("Resetting keyboard\n");
|
||||
#endif
|
||||
for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
|
||||
for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
|
||||
if (keyboard->keystate[scancode] == SDL_PRESSED) {
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
|
|
@ -586,12 +594,22 @@ void
|
|||
SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
SDL_Scancode scancode;
|
||||
|
||||
if (start < 0 || start + length > SDL_NUM_SCANCODES) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length);
|
||||
|
||||
/* The number key scancodes always map to the number key keycodes.
|
||||
* On AZERTY layouts these technically are symbols, but users (and games)
|
||||
* always think of them and view them in UI as number keys.
|
||||
*/
|
||||
keyboard->keymap[SDL_SCANCODE_0] = SDLK_0;
|
||||
for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) {
|
||||
keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -664,7 +682,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
|||
int posted;
|
||||
SDL_Keymod modifier;
|
||||
SDL_Keycode keycode;
|
||||
Uint16 modstate;
|
||||
Uint32 type;
|
||||
Uint8 repeat;
|
||||
|
||||
|
|
@ -737,7 +754,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
|||
break;
|
||||
}
|
||||
if (SDL_KEYDOWN == type) {
|
||||
modstate = keyboard->modstate;
|
||||
switch (keycode) {
|
||||
case SDLK_NUMLOCKCLEAR:
|
||||
keyboard->modstate ^= KMOD_NUM;
|
||||
|
|
@ -751,7 +767,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
|||
}
|
||||
} else {
|
||||
keyboard->modstate &= ~modifier;
|
||||
modstate = keyboard->modstate;
|
||||
}
|
||||
|
||||
/* Post the event, if desired */
|
||||
|
|
@ -763,7 +778,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
|||
event.key.repeat = repeat;
|
||||
event.key.keysym.scancode = scancode;
|
||||
event.key.keysym.sym = keycode;
|
||||
event.key.keysym.mod = modstate;
|
||||
event.key.keysym.mod = keyboard->modstate;
|
||||
event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
|
|
@ -834,7 +849,7 @@ SDL_GetModState(void)
|
|||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
return keyboard->modstate;
|
||||
return (SDL_Keymod) keyboard->modstate;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -863,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
|
|||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -890,7 +905,7 @@ const char *
|
|||
SDL_GetScancodeName(SDL_Scancode scancode)
|
||||
{
|
||||
const char *name;
|
||||
if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
|
||||
if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
|
||||
SDL_InvalidParamError("scancode");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -968,8 +983,10 @@ SDL_GetKeyFromName(const char *name)
|
|||
{
|
||||
SDL_Keycode key;
|
||||
|
||||
/* Check input */
|
||||
if (name == NULL) return SDLK_UNKNOWN;
|
||||
/* Check input */
|
||||
if (name == NULL) {
|
||||
return SDLK_UNKNOWN;
|
||||
}
|
||||
|
||||
/* If it's a single UTF-8 character, then that's the keycode itself */
|
||||
key = *(const unsigned char *)name;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_keyboard_c_h
|
||||
#define _SDL_keyboard_c_h
|
||||
#ifndef SDL_keyboard_c_h_
|
||||
#define SDL_keyboard_c_h_
|
||||
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_events.h"
|
||||
|
|
@ -65,6 +65,6 @@ 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 */
|
||||
#endif /* SDL_keyboard_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
#include "SDL_timer.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "default_cursor.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
/* #define DEBUG_MOUSE */
|
||||
|
|
@ -40,12 +39,59 @@ static int SDL_double_click_radius = 1;
|
|||
static int
|
||||
SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
|
||||
|
||||
static void SDLCALL
|
||||
SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||
|
||||
if (hint && *hint) {
|
||||
mouse->normal_speed_scale = (float)SDL_atof(hint);
|
||||
} else {
|
||||
mouse->normal_speed_scale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||
|
||||
if (hint && *hint) {
|
||||
mouse->relative_speed_scale = (float)SDL_atof(hint);
|
||||
} else {
|
||||
mouse->relative_speed_scale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void SDLCALL
|
||||
SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
|
||||
{
|
||||
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
|
||||
|
||||
if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) {
|
||||
mouse->touch_mouse_events = SDL_FALSE;
|
||||
} else {
|
||||
mouse->touch_mouse_events = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Public functions */
|
||||
int
|
||||
SDL_MouseInit(void)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
SDL_zerop(mouse);
|
||||
|
||||
SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
|
||||
SDL_MouseNormalSpeedScaleChanged, mouse);
|
||||
|
||||
SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE,
|
||||
SDL_MouseRelativeSpeedScaleChanged, mouse);
|
||||
|
||||
SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS,
|
||||
SDL_TouchMouseEventsChanged, mouse);
|
||||
|
||||
mouse->cursor_shown = SDL_TRUE;
|
||||
|
||||
return (0);
|
||||
|
|
@ -82,6 +128,7 @@ SDL_GetMouseFocus(void)
|
|||
return mouse->focus;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
SDL_ResetMouse(void)
|
||||
{
|
||||
|
|
@ -98,6 +145,7 @@ SDL_ResetMouse(void)
|
|||
}
|
||||
SDL_assert(mouse->buttonstate == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
SDL_SetMouseFocus(SDL_Window * window)
|
||||
|
|
@ -126,6 +174,7 @@ SDL_SetMouseFocus(SDL_Window * window)
|
|||
}
|
||||
|
||||
mouse->focus = window;
|
||||
mouse->has_position = SDL_FALSE;
|
||||
|
||||
if (mouse->focus) {
|
||||
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
|
||||
|
|
@ -176,10 +225,10 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate)
|
|||
|
||||
if (window != mouse->focus) {
|
||||
#ifdef DEBUG_MOUSE
|
||||
printf("Mouse entered window, synthesizing focus gain & move event\n");
|
||||
printf("Mouse entered window, synthesizing focus gain & move event\n");
|
||||
#endif
|
||||
SDL_SetMouseFocus(window);
|
||||
SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y);
|
||||
SDL_SetMouseFocus(window);
|
||||
SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y);
|
||||
}
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
|
@ -197,6 +246,21 @@ SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int
|
|||
return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y);
|
||||
}
|
||||
|
||||
static int
|
||||
GetScaledMouseDelta(float scale, int value, float *accum)
|
||||
{
|
||||
if (scale != 1.0f) {
|
||||
*accum += scale * value;
|
||||
if (*accum >= 0.0f) {
|
||||
value = (int)SDL_floor(*accum);
|
||||
} else {
|
||||
value = (int)SDL_ceil(*accum);
|
||||
}
|
||||
*accum -= value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y)
|
||||
{
|
||||
|
|
@ -205,7 +269,11 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
int xrel;
|
||||
int yrel;
|
||||
|
||||
if (mouse->relative_mode_warp) {
|
||||
if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
|
||||
int center_x = 0, center_y = 0;
|
||||
SDL_GetWindowSize(window, ¢er_x, ¢er_y);
|
||||
center_x /= 2;
|
||||
|
|
@ -219,6 +287,13 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
}
|
||||
|
||||
if (relative) {
|
||||
if (mouse->relative_mode) {
|
||||
x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x);
|
||||
y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y);
|
||||
} else {
|
||||
x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x);
|
||||
y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y);
|
||||
}
|
||||
xrel = x;
|
||||
yrel = y;
|
||||
x = (mouse->last_x + xrel);
|
||||
|
|
@ -236,6 +311,19 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Ignore relative motion when first positioning the mouse */
|
||||
if (!mouse->has_position) {
|
||||
xrel = 0;
|
||||
yrel = 0;
|
||||
mouse->has_position = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* Ignore relative motion positioning the first touch */
|
||||
if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) {
|
||||
xrel = 0;
|
||||
yrel = 0;
|
||||
}
|
||||
|
||||
/* Update internal mouse coordinates */
|
||||
if (!mouse->relative_mode) {
|
||||
mouse->x = x;
|
||||
|
|
@ -250,7 +338,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
|||
if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
|
||||
int x_max = 0, y_max = 0;
|
||||
|
||||
// !!! FIXME: shouldn't this be (window) instead of (mouse->focus)?
|
||||
/* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */
|
||||
SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
|
||||
--x_max;
|
||||
--y_max;
|
||||
|
|
@ -330,6 +418,10 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state
|
|||
Uint32 type;
|
||||
Uint32 buttonstate = mouse->buttonstate;
|
||||
|
||||
if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Figure out which event to perform */
|
||||
switch (state) {
|
||||
case SDL_PRESSED:
|
||||
|
|
@ -417,10 +509,11 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8
|
|||
}
|
||||
|
||||
int
|
||||
SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
|
||||
SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
int posted;
|
||||
int integral_x, integral_y;
|
||||
|
||||
if (window) {
|
||||
SDL_SetMouseFocus(window);
|
||||
|
|
@ -430,6 +523,26 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M
|
|||
return 0;
|
||||
}
|
||||
|
||||
mouse->accumulated_wheel_x += x;
|
||||
if (mouse->accumulated_wheel_x > 0) {
|
||||
integral_x = (int)SDL_floor(mouse->accumulated_wheel_x);
|
||||
} else if (mouse->accumulated_wheel_x < 0) {
|
||||
integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x);
|
||||
} else {
|
||||
integral_x = 0;
|
||||
}
|
||||
mouse->accumulated_wheel_x -= integral_x;
|
||||
|
||||
mouse->accumulated_wheel_y += y;
|
||||
if (mouse->accumulated_wheel_y > 0) {
|
||||
integral_y = (int)SDL_floor(mouse->accumulated_wheel_y);
|
||||
} else if (mouse->accumulated_wheel_y < 0) {
|
||||
integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y);
|
||||
} else {
|
||||
integral_y = 0;
|
||||
}
|
||||
mouse->accumulated_wheel_y -= integral_y;
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
|
||||
|
|
@ -437,8 +550,12 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M
|
|||
event.type = SDL_MOUSEWHEEL;
|
||||
event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
|
||||
event.wheel.which = mouseID;
|
||||
event.wheel.x = x;
|
||||
event.wheel.y = y;
|
||||
#if 0 /* Uncomment this when it goes in for SDL 2.1 */
|
||||
event.wheel.preciseX = x;
|
||||
event.wheel.preciseY = y;
|
||||
#endif
|
||||
event.wheel.x = integral_x;
|
||||
event.wheel.y = integral_y;
|
||||
event.wheel.direction = (Uint32)direction;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
|
|
@ -463,16 +580,23 @@ SDL_MouseQuit(void)
|
|||
SDL_FreeCursor(cursor);
|
||||
cursor = next;
|
||||
}
|
||||
mouse->cursors = NULL;
|
||||
|
||||
if (mouse->def_cursor && mouse->FreeCursor) {
|
||||
mouse->FreeCursor(mouse->def_cursor);
|
||||
mouse->def_cursor = NULL;
|
||||
}
|
||||
|
||||
if (mouse->clickstate) {
|
||||
SDL_free(mouse->clickstate);
|
||||
mouse->clickstate = NULL;
|
||||
}
|
||||
|
||||
SDL_zerop(mouse);
|
||||
SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
|
||||
SDL_MouseNormalSpeedScaleChanged, mouse);
|
||||
|
||||
SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE,
|
||||
SDL_MouseRelativeSpeedScaleChanged, mouse);
|
||||
}
|
||||
|
||||
Uint32
|
||||
|
|
@ -522,7 +646,6 @@ SDL_GetGlobalMouseState(int *x, int *y)
|
|||
*x = *y = 0;
|
||||
|
||||
if (!mouse->GetGlobalMouseState) {
|
||||
SDL_assert(0 && "This should really be implemented for every target.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -601,6 +724,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled)
|
|||
}
|
||||
}
|
||||
mouse->relative_mode = enabled;
|
||||
mouse->scale_accum_x = 0.0f;
|
||||
mouse->scale_accum_y = 0.0f;
|
||||
|
||||
if (mouse->focus) {
|
||||
SDL_UpdateWindowGrab(mouse->focus);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_mouse_c_h
|
||||
#define _SDL_mouse_c_h
|
||||
#ifndef SDL_mouse_c_h_
|
||||
#define SDL_mouse_c_h_
|
||||
|
||||
#include "SDL_mouse.h"
|
||||
|
||||
|
|
@ -80,9 +80,17 @@ typedef struct
|
|||
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;
|
||||
SDL_bool touch_mouse_events;
|
||||
|
||||
/* Data for double-click tracking */
|
||||
int num_clickstates;
|
||||
|
|
@ -123,11 +131,11 @@ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 s
|
|||
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, int x, int y, SDL_MouseWheelDirection direction);
|
||||
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 */
|
||||
#endif /* SDL_mouse_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -55,7 +55,7 @@ SDL_QuitInit_Internal(void)
|
|||
struct sigaction action;
|
||||
sigaction(SIGINT, NULL, &action);
|
||||
#ifdef HAVE_SA_SIGACTION
|
||||
if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) {
|
||||
if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) {
|
||||
#else
|
||||
if ( action.sa_handler == SIG_DFL ) {
|
||||
#endif
|
||||
|
|
@ -65,7 +65,7 @@ SDL_QuitInit_Internal(void)
|
|||
sigaction(SIGTERM, NULL, &action);
|
||||
|
||||
#ifdef HAVE_SA_SIGACTION
|
||||
if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) {
|
||||
if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) {
|
||||
#else
|
||||
if ( action.sa_handler == SIG_DFL ) {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#include "SDL_assert.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
|
||||
static int SDL_num_touch = 0;
|
||||
|
|
@ -48,7 +49,7 @@ SDL_TouchID
|
|||
SDL_GetTouchDevice(int index)
|
||||
{
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
SDL_SetError("Unknown touch device");
|
||||
SDL_SetError("Unknown touch device index %d", index);
|
||||
return 0;
|
||||
}
|
||||
return SDL_touchDevices[index]->id;
|
||||
|
|
@ -74,7 +75,12 @@ SDL_GetTouch(SDL_TouchID id)
|
|||
{
|
||||
int index = SDL_GetTouchIndex(id);
|
||||
if (index < 0 || index >= SDL_num_touch) {
|
||||
SDL_SetError("Unknown touch device");
|
||||
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];
|
||||
|
|
@ -92,7 +98,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
|
|||
return -1;
|
||||
}
|
||||
|
||||
SDL_Finger *
|
||||
static SDL_Finger *
|
||||
SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id)
|
||||
{
|
||||
int index = SDL_GetFingerIndex(touch, id);
|
||||
|
|
@ -346,6 +352,9 @@ SDL_DelTouch(SDL_TouchID id)
|
|||
|
||||
SDL_num_touch--;
|
||||
SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch];
|
||||
|
||||
/* Delete this touch device for gestures */
|
||||
SDL_GestureDelTouch(id);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -360,6 +369,7 @@ SDL_TouchQuit(void)
|
|||
|
||||
SDL_free(SDL_touchDevices);
|
||||
SDL_touchDevices = NULL;
|
||||
SDL_GestureQuit();
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -21,8 +21,8 @@
|
|||
#include "../SDL_internal.h"
|
||||
#include "../../include/SDL_touch.h"
|
||||
|
||||
#ifndef _SDL_touch_c_h
|
||||
#define _SDL_touch_c_h
|
||||
#ifndef SDL_touch_c_h_
|
||||
#define SDL_touch_c_h_
|
||||
|
||||
typedef struct SDL_Touch
|
||||
{
|
||||
|
|
@ -56,6 +56,6 @@ extern void SDL_DelTouch(SDL_TouchID id);
|
|||
/* Shutdown the touch subsystem */
|
||||
extern void SDL_TouchQuit(void);
|
||||
|
||||
#endif /* _SDL_touch_c_h */
|
||||
#endif /* SDL_touch_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
|
||||
static int
|
||||
static int SDLCALL
|
||||
RemovePendingResizedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
|
@ -42,7 +42,7 @@ RemovePendingResizedEvents(void * userdata, SDL_Event *event)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int SDLCALL
|
||||
RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
|
@ -56,7 +56,7 @@ RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int SDLCALL
|
||||
RemovePendingMoveEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
|
@ -70,7 +70,7 @@ RemovePendingMoveEvents(void * userdata, SDL_Event *event)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
static int SDLCALL
|
||||
RemovePendingExposedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#ifndef _SDL_windowevents_c_h
|
||||
#define _SDL_windowevents_c_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 */
|
||||
#endif /* SDL_windowevents_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -194,7 +194,7 @@ static SDL_Scancode const linux_scancode_table[] = {
|
|||
/* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */
|
||||
/* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */
|
||||
/* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */
|
||||
/* 168 */ SDL_SCANCODE_UNKNOWN, /* KEY_REWIND */
|
||||
/* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */
|
||||
/* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */
|
||||
/* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */
|
||||
/* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */
|
||||
|
|
@ -230,7 +230,7 @@ static SDL_Scancode const linux_scancode_table[] = {
|
|||
/* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */
|
||||
/* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */
|
||||
/* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */
|
||||
/* 208 */ SDL_SCANCODE_UNKNOWN, /* KEY_FASTFORWARD */
|
||||
/* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */
|
||||
/* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */
|
||||
/* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */
|
||||
/* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2018 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
|
||||
|
|
@ -345,7 +345,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 165 */ SDL_SCANCODE_AUDIOPREV,
|
||||
/* 166 */ SDL_SCANCODE_AUDIOSTOP,
|
||||
/* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */
|
||||
/* 168 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRewind */
|
||||
/* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */
|
||||
/* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */
|
||||
/* 170 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 171 */ SDL_SCANCODE_F13, /* XF86Tools */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue