mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 04:05:09 +02:00
Updated SDL2 to the latest Mercurial revision.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -75,12 +75,13 @@ static struct
|
||||
SDL_mutex *lock;
|
||||
volatile SDL_bool active;
|
||||
volatile int count;
|
||||
volatile int max_events_seen;
|
||||
SDL_EventEntry *head;
|
||||
SDL_EventEntry *tail;
|
||||
SDL_EventEntry *free;
|
||||
SDL_SysWMEntry *wmmsg_used;
|
||||
SDL_SysWMEntry *wmmsg_free;
|
||||
} SDL_EventQ = { NULL, SDL_TRUE };
|
||||
} SDL_EventQ = { NULL, SDL_TRUE, 0, 0, NULL, NULL, NULL, NULL, NULL };
|
||||
|
||||
|
||||
/* Public functions */
|
||||
@@ -88,6 +89,7 @@ static struct
|
||||
void
|
||||
SDL_StopEventLoop(void)
|
||||
{
|
||||
const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS");
|
||||
int i;
|
||||
SDL_EventEntry *entry;
|
||||
SDL_SysWMEntry *wmmsg;
|
||||
@@ -98,6 +100,11 @@ SDL_StopEventLoop(void)
|
||||
|
||||
SDL_EventQ.active = SDL_FALSE;
|
||||
|
||||
if (report && SDL_atoi(report)) {
|
||||
SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n",
|
||||
SDL_EventQ.max_events_seen);
|
||||
}
|
||||
|
||||
/* Clean out EventQ */
|
||||
for (entry = SDL_EventQ.head; entry; ) {
|
||||
SDL_EventEntry *next = entry->next;
|
||||
@@ -119,7 +126,9 @@ SDL_StopEventLoop(void)
|
||||
SDL_free(wmmsg);
|
||||
wmmsg = next;
|
||||
}
|
||||
|
||||
SDL_EventQ.count = 0;
|
||||
SDL_EventQ.max_events_seen = 0;
|
||||
SDL_EventQ.head = NULL;
|
||||
SDL_EventQ.tail = NULL;
|
||||
SDL_EventQ.free = NULL;
|
||||
@@ -218,6 +227,10 @@ SDL_AddEvent(SDL_Event * event)
|
||||
}
|
||||
++SDL_EventQ.count;
|
||||
|
||||
if (SDL_EventQ.count > SDL_EventQ.max_events_seen) {
|
||||
SDL_EventQ.max_events_seen = SDL_EventQ.count;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -393,6 +406,8 @@ SDL_PumpEvents(void)
|
||||
SDL_JoystickUpdate();
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */
|
||||
}
|
||||
|
||||
/* Public functions */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -43,6 +43,8 @@ extern int SDL_QuitInit(void);
|
||||
extern int SDL_SendQuit(void);
|
||||
extern void SDL_QuitQuit(void);
|
||||
|
||||
extern void SDL_SendPendingQuit(void);
|
||||
|
||||
/* The event filter function */
|
||||
extern SDL_EventFilter SDL_EventOK;
|
||||
extern void *SDL_EventOKParam;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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,6 +24,7 @@
|
||||
/* General mouse handling code for SDL */
|
||||
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_events_c.h"
|
||||
#include "SDL_gesture_c.h"
|
||||
|
||||
@@ -114,14 +115,34 @@ static unsigned long SDL_HashDollar(SDL_FloatPoint* points)
|
||||
|
||||
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst)
|
||||
{
|
||||
if (dst == NULL) return 0;
|
||||
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)
|
||||
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;
|
||||
}
|
||||
@@ -184,7 +205,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
|
||||
int index = -1;
|
||||
int i = 0;
|
||||
if (inTouch == NULL) {
|
||||
if (SDL_numGestureTouches == 0) return -1;
|
||||
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);
|
||||
@@ -203,17 +224,33 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
|
||||
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)
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
if (SDL_gestureTouch[i].id == touchId) {
|
||||
touch = &SDL_gestureTouch[i];
|
||||
if (touch == NULL) return -1;
|
||||
}
|
||||
}
|
||||
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) break;
|
||||
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"); */
|
||||
@@ -612,8 +649,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
|
||||
break;
|
||||
pressure? */
|
||||
}
|
||||
|
||||
if (event->type == SDL_FINGERDOWN) {
|
||||
else if (event->type == SDL_FINGERDOWN) {
|
||||
|
||||
inTouch->numDownFingers++;
|
||||
inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers - 1)+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -662,6 +662,8 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
int posted;
|
||||
SDL_Keymod modifier;
|
||||
SDL_Keycode keycode;
|
||||
Uint16 modstate;
|
||||
Uint32 type;
|
||||
Uint8 repeat;
|
||||
@@ -673,82 +675,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
|
||||
state == SDL_PRESSED ? "pressed" : "released");
|
||||
#endif
|
||||
if (state == SDL_PRESSED) {
|
||||
modstate = keyboard->modstate;
|
||||
switch (scancode) {
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
keyboard->modstate ^= KMOD_NUM;
|
||||
break;
|
||||
case SDL_SCANCODE_CAPSLOCK:
|
||||
keyboard->modstate ^= KMOD_CAPS;
|
||||
break;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
keyboard->modstate |= KMOD_LCTRL;
|
||||
break;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
keyboard->modstate |= KMOD_RCTRL;
|
||||
break;
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
keyboard->modstate |= KMOD_LSHIFT;
|
||||
break;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
keyboard->modstate |= KMOD_RSHIFT;
|
||||
break;
|
||||
case SDL_SCANCODE_LALT:
|
||||
keyboard->modstate |= KMOD_LALT;
|
||||
break;
|
||||
case SDL_SCANCODE_RALT:
|
||||
keyboard->modstate |= KMOD_RALT;
|
||||
break;
|
||||
case SDL_SCANCODE_LGUI:
|
||||
keyboard->modstate |= KMOD_LGUI;
|
||||
break;
|
||||
case SDL_SCANCODE_RGUI:
|
||||
keyboard->modstate |= KMOD_RGUI;
|
||||
break;
|
||||
case SDL_SCANCODE_MODE:
|
||||
keyboard->modstate |= KMOD_MODE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (scancode) {
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
case SDL_SCANCODE_CAPSLOCK:
|
||||
break;
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
keyboard->modstate &= ~KMOD_LCTRL;
|
||||
break;
|
||||
case SDL_SCANCODE_RCTRL:
|
||||
keyboard->modstate &= ~KMOD_RCTRL;
|
||||
break;
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
keyboard->modstate &= ~KMOD_LSHIFT;
|
||||
break;
|
||||
case SDL_SCANCODE_RSHIFT:
|
||||
keyboard->modstate &= ~KMOD_RSHIFT;
|
||||
break;
|
||||
case SDL_SCANCODE_LALT:
|
||||
keyboard->modstate &= ~KMOD_LALT;
|
||||
break;
|
||||
case SDL_SCANCODE_RALT:
|
||||
keyboard->modstate &= ~KMOD_RALT;
|
||||
break;
|
||||
case SDL_SCANCODE_LGUI:
|
||||
keyboard->modstate &= ~KMOD_LGUI;
|
||||
break;
|
||||
case SDL_SCANCODE_RGUI:
|
||||
keyboard->modstate &= ~KMOD_RGUI;
|
||||
break;
|
||||
case SDL_SCANCODE_MODE:
|
||||
keyboard->modstate &= ~KMOD_MODE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
modstate = keyboard->modstate;
|
||||
}
|
||||
|
||||
/* Figure out what type of event this is */
|
||||
switch (state) {
|
||||
@@ -775,6 +701,59 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
/* Update internal keyboard state */
|
||||
keyboard->keystate[scancode] = state;
|
||||
|
||||
keycode = keyboard->keymap[scancode];
|
||||
|
||||
/* Update modifiers state if applicable */
|
||||
switch (keycode) {
|
||||
case SDLK_LCTRL:
|
||||
modifier = KMOD_LCTRL;
|
||||
break;
|
||||
case SDLK_RCTRL:
|
||||
modifier = KMOD_RCTRL;
|
||||
break;
|
||||
case SDLK_LSHIFT:
|
||||
modifier = KMOD_LSHIFT;
|
||||
break;
|
||||
case SDLK_RSHIFT:
|
||||
modifier = KMOD_RSHIFT;
|
||||
break;
|
||||
case SDLK_LALT:
|
||||
modifier = KMOD_LALT;
|
||||
break;
|
||||
case SDLK_RALT:
|
||||
modifier = KMOD_RALT;
|
||||
break;
|
||||
case SDLK_LGUI:
|
||||
modifier = KMOD_LGUI;
|
||||
break;
|
||||
case SDLK_RGUI:
|
||||
modifier = KMOD_RGUI;
|
||||
break;
|
||||
case SDLK_MODE:
|
||||
modifier = KMOD_MODE;
|
||||
break;
|
||||
default:
|
||||
modifier = KMOD_NONE;
|
||||
break;
|
||||
}
|
||||
if (SDL_KEYDOWN == type) {
|
||||
modstate = keyboard->modstate;
|
||||
switch (keycode) {
|
||||
case SDLK_NUMLOCKCLEAR:
|
||||
keyboard->modstate ^= KMOD_NUM;
|
||||
break;
|
||||
case SDLK_CAPSLOCK:
|
||||
keyboard->modstate ^= KMOD_CAPS;
|
||||
break;
|
||||
default:
|
||||
keyboard->modstate |= modifier;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
keyboard->modstate &= ~modifier;
|
||||
modstate = keyboard->modstate;
|
||||
}
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(type) == SDL_ENABLE) {
|
||||
@@ -783,7 +762,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
|
||||
event.key.state = state;
|
||||
event.key.repeat = repeat;
|
||||
event.key.keysym.scancode = scancode;
|
||||
event.key.keysym.sym = keyboard->keymap[scancode];
|
||||
event.key.keysym.sym = keycode;
|
||||
event.key.keysym.mod = modstate;
|
||||
event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -293,9 +293,14 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
||||
event.motion.yrel = yrel;
|
||||
posted = (SDL_PushEvent(&event) > 0);
|
||||
}
|
||||
/* Use unclamped values if we're getting events outside the window */
|
||||
mouse->last_x = x;
|
||||
mouse->last_y = y;
|
||||
if (relative) {
|
||||
mouse->last_x = mouse->x;
|
||||
mouse->last_y = mouse->y;
|
||||
} else {
|
||||
/* Use unclamped values if we're getting events outside the window */
|
||||
mouse->last_x = x;
|
||||
mouse->last_y = y;
|
||||
}
|
||||
return posted;
|
||||
}
|
||||
|
||||
@@ -530,14 +535,16 @@ SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
SDL_WarpMouseGlobal(int x, int y)
|
||||
{
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
if (mouse->WarpMouseGlobal) {
|
||||
mouse->WarpMouseGlobal(x, y);
|
||||
return mouse->WarpMouseGlobal(x, y);
|
||||
}
|
||||
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -61,7 +61,7 @@ typedef struct
|
||||
void (*WarpMouse) (SDL_Window * window, int x, int y);
|
||||
|
||||
/* Warp the mouse to (x,y) in screen space */
|
||||
void (*WarpMouseGlobal) (int x, int y);
|
||||
int (*WarpMouseGlobal) (int x, int y);
|
||||
|
||||
/* Set relative mode */
|
||||
int (*SetRelativeMouseMode) (SDL_bool enabled);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -19,6 +19,8 @@
|
||||
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 */
|
||||
|
||||
@@ -29,6 +31,8 @@
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_events_c.h"
|
||||
|
||||
static SDL_bool disable_signals = SDL_FALSE;
|
||||
static SDL_bool send_quit_pending = SDL_FALSE;
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
static void
|
||||
@@ -37,14 +41,15 @@ SDL_HandleSIG(int sig)
|
||||
/* Reset the signal handler */
|
||||
signal(sig, SDL_HandleSIG);
|
||||
|
||||
/* Signal a quit interrupt */
|
||||
SDL_SendQuit();
|
||||
/* Send a quit event next time the event loop pumps. */
|
||||
/* We can't send it in signal handler; malloc() might be interrupted! */
|
||||
send_quit_pending = SDL_TRUE;
|
||||
}
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
|
||||
/* Public functions */
|
||||
int
|
||||
SDL_QuitInit(void)
|
||||
static int
|
||||
SDL_QuitInit_Internal(void)
|
||||
{
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
@@ -80,11 +85,22 @@ SDL_QuitInit(void)
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
|
||||
/* That's it! */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_QuitQuit(void)
|
||||
int
|
||||
SDL_QuitInit(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_NO_SIGNAL_HANDLERS);
|
||||
disable_signals = hint && (SDL_atoi(hint) == 1);
|
||||
if (!disable_signals) {
|
||||
return SDL_QuitInit_Internal();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_QuitQuit_Internal(void)
|
||||
{
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction action;
|
||||
@@ -110,11 +126,29 @@ SDL_QuitQuit(void)
|
||||
#endif /* HAVE_SIGNAL_H */
|
||||
}
|
||||
|
||||
void
|
||||
SDL_QuitQuit(void)
|
||||
{
|
||||
if (!disable_signals) {
|
||||
SDL_QuitQuit_Internal();
|
||||
}
|
||||
}
|
||||
|
||||
/* This function returns 1 if it's okay to close the application window */
|
||||
int
|
||||
SDL_SendQuit(void)
|
||||
{
|
||||
send_quit_pending = SDL_FALSE;
|
||||
return SDL_SendAppEvent(SDL_QUIT);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SendPendingQuit(void)
|
||||
{
|
||||
if (send_quit_pending) {
|
||||
SDL_SendQuit();
|
||||
SDL_assert(!send_quit_pending);
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -145,13 +145,16 @@ SDL_AddTouch(SDL_TouchID touchID, const char *name)
|
||||
}
|
||||
|
||||
SDL_touchDevices = touchDevices;
|
||||
index = SDL_num_touch++;
|
||||
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]->num_fingers = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -110,5 +110,5 @@ static const unsigned char default_cmask[] = {
|
||||
0x03, 0x00
|
||||
};
|
||||
|
||||
#endif /* TRUE_MACINTOSH_CURSOR */
|
||||
#endif /* USE_MACOS_CURSOR */
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -49,7 +49,7 @@ static const SDL_Scancode windows_scancode_table[] =
|
||||
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_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */
|
||||
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* */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2015 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
|
||||
@@ -141,15 +141,15 @@ static const SDL_Scancode xfree86_scancode_table[] = {
|
||||
/* 112 */ SDL_SCANCODE_F15,
|
||||
/* 113 */ SDL_SCANCODE_F16,
|
||||
/* 114 */ SDL_SCANCODE_F17,
|
||||
/* 115 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 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_UNKNOWN,
|
||||
/* 121 */ SDL_SCANCODE_INTERNATIONAL4, /* Henkan_Mode */
|
||||
/* 122 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 123 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 123 */ SDL_SCANCODE_INTERNATIONAL5, /* Muhenkan */
|
||||
/* 124 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 125 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
|
||||
/* 126 */ SDL_SCANCODE_UNKNOWN,
|
||||
@@ -266,12 +266,12 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
||||
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
|
||||
/* 87 */ SDL_SCANCODE_F11,
|
||||
/* 88 */ SDL_SCANCODE_F12,
|
||||
/* 89 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 89 */ SDL_SCANCODE_INTERNATIONAL1, /* \_ */
|
||||
/* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */
|
||||
/* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */
|
||||
/* 92 */ SDL_SCANCODE_UNKNOWN, /* Henkan_Mode */
|
||||
/* 93 */ SDL_SCANCODE_UNKNOWN, /* Hiragana_Katakana */
|
||||
/* 94 */ SDL_SCANCODE_UNKNOWN, /* Muhenkan */
|
||||
/* 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,
|
||||
@@ -301,7 +301,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
||||
/* 121 */ SDL_SCANCODE_UNKNOWN, /* KP_Decimal */
|
||||
/* 122 */ SDL_SCANCODE_UNKNOWN, /* Hangul */
|
||||
/* 123 */ SDL_SCANCODE_UNKNOWN, /* Hangul_Hanja */
|
||||
/* 124 */ SDL_SCANCODE_UNKNOWN,
|
||||
/* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* Yen */
|
||||
/* 125 */ SDL_SCANCODE_LGUI,
|
||||
/* 126 */ SDL_SCANCODE_RGUI,
|
||||
/* 127 */ SDL_SCANCODE_APPLICATION,
|
||||
|
||||
Reference in New Issue
Block a user