... actually update.

This commit is contained in:
Alex Szpakowski
2016-10-29 00:29:20 -03:00
parent 25d889fa38
commit 06ff0e775e
340 changed files with 10970 additions and 5082 deletions
+4 -2
View File
@@ -332,7 +332,9 @@ SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action,
}
}
}
SDL_UnlockMutex(SDL_EventQ.lock);
if (SDL_EventQ.lock) {
SDL_UnlockMutex(SDL_EventQ.lock);
}
} else {
return SDL_SetError("Couldn't lock event queue");
}
@@ -374,7 +376,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType)
#endif
/* Lock the event queue */
if (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) {
+1 -1
View File
@@ -21,7 +21,7 @@
#include "../SDL_internal.h"
/* General mouse handling code for SDL */
/* General gesture handling code for SDL */
#include "SDL_events.h"
#include "SDL_endian.h"
+37 -33
View File
@@ -322,15 +322,13 @@ static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button)
return &mouse->clickstate[button];
}
int
SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
static int
SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks)
{
SDL_Mouse *mouse = SDL_GetMouse();
int posted;
Uint32 type;
Uint32 buttonstate = mouse->buttonstate;
SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button);
Uint8 click_count;
/* Figure out which event to perform */
switch (state) {
@@ -358,25 +356,28 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8
}
mouse->buttonstate = buttonstate;
if (clickstate) {
if (state == SDL_PRESSED) {
Uint32 now = SDL_GetTicks();
if (clicks < 0) {
SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button);
if (clickstate) {
if (state == SDL_PRESSED) {
Uint32 now = SDL_GetTicks();
if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + SDL_double_click_time) ||
SDL_abs(mouse->x - clickstate->last_x) > SDL_double_click_radius ||
SDL_abs(mouse->y - clickstate->last_y) > SDL_double_click_radius) {
clickstate->click_count = 0;
}
clickstate->last_timestamp = now;
clickstate->last_x = mouse->x;
clickstate->last_y = mouse->y;
if (clickstate->click_count < 255) {
++clickstate->click_count;
if (SDL_TICKS_PASSED(now, clickstate->last_timestamp + SDL_double_click_time) ||
SDL_abs(mouse->x - clickstate->last_x) > SDL_double_click_radius ||
SDL_abs(mouse->y - clickstate->last_y) > SDL_double_click_radius) {
clickstate->click_count = 0;
}
clickstate->last_timestamp = now;
clickstate->last_x = mouse->x;
clickstate->last_y = mouse->y;
if (clickstate->click_count < 255) {
++clickstate->click_count;
}
}
clicks = clickstate->click_count;
} else {
clicks = 1;
}
click_count = clickstate->click_count;
} else {
click_count = 1;
}
/* Post the event, if desired */
@@ -388,7 +389,7 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8
event.button.which = mouseID;
event.button.state = state;
event.button.button = button;
event.button.clicks = click_count;
event.button.clicks = (Uint8) SDL_min(clicks, 255);
event.button.x = mouse->x;
event.button.y = mouse->y;
posted = (SDL_PushEvent(&event) > 0);
@@ -398,10 +399,23 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8
if (window && state == SDL_RELEASED) {
SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate);
}
return posted;
}
int
SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks)
{
clicks = SDL_max(clicks, 0);
return SDL_PrivateSendMouseButton(window, mouseID, state, button, clicks);
}
int
SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button)
{
return SDL_PrivateSendMouseButton(window, mouseID, state, button, -1);
}
int
SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
{
@@ -550,21 +564,11 @@ SDL_WarpMouseGlobal(int x, int y)
static SDL_bool
ShouldUseRelativeModeWarp(SDL_Mouse *mouse)
{
const char *hint;
if (!mouse->SetRelativeMouseMode) {
return SDL_TRUE;
}
hint = SDL_GetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP);
if (hint) {
if (*hint == '0') {
return SDL_FALSE;
} else {
return SDL_TRUE;
}
}
return SDL_FALSE;
return SDL_GetHintBoolean(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, SDL_FALSE);
}
int
+3
View File
@@ -119,6 +119,9 @@ extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int rel
/* 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, int x, int y, SDL_MouseWheelDirection direction);
+1 -3
View File
@@ -91,9 +91,7 @@ SDL_QuitInit_Internal(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) {
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
return SDL_QuitInit_Internal();
}
return 0;
+17 -1
View File
@@ -70,6 +70,20 @@ RemovePendingMoveEvents(void * userdata, SDL_Event *event)
return 1;
}
static int
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)
@@ -195,7 +209,9 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
if (windowevent == SDL_WINDOWEVENT_MOVED) {
SDL_FilterEvents(RemovePendingMoveEvents, &event);
}
if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
SDL_FilterEvents(RemovePendingExposedEvents, &event);
}
posted = (SDL_PushEvent(&event) > 0);
}
+7 -7
View File
@@ -111,7 +111,7 @@ static SDL_Scancode const linux_scancode_table[] = {
/* 82 */ SDL_SCANCODE_KP_0,
/* 83 */ SDL_SCANCODE_KP_PERIOD,
0,
/* 85 */ SDL_SCANCODE_UNKNOWN, /* KEY_ZENKAKUHANKAKU */
/* 85 */ SDL_SCANCODE_LANG5, /* KEY_ZENKAKUHANKAKU */
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* KEY_102ND */
/* 87 */ SDL_SCANCODE_F11,
/* 88 */ SDL_SCANCODE_F12,
@@ -153,7 +153,7 @@ static SDL_Scancode const linux_scancode_table[] = {
/* 124 */ SDL_SCANCODE_INTERNATIONAL3, /* KEY_YEN */
/* 125 */ SDL_SCANCODE_LGUI,
/* 126 */ SDL_SCANCODE_RGUI,
/* 127 */ SDL_SCANCODE_UNKNOWN, /* KEY_COMPOSE */
/* 127 */ SDL_SCANCODE_APPLICATION, /* KEY_COMPOSE */
/* 128 */ SDL_SCANCODE_STOP,
/* 129 */ SDL_SCANCODE_AGAIN,
/* 130 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROPS */
@@ -174,9 +174,9 @@ static SDL_Scancode const linux_scancode_table[] = {
/* 145 */ SDL_SCANCODE_UNKNOWN, /* KEY_SENDFILE */
/* 146 */ SDL_SCANCODE_UNKNOWN, /* KEY_DELETEFILE */
/* 147 */ SDL_SCANCODE_UNKNOWN, /* KEY_XFER */
/* 148 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG1 */
/* 149 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG2 */
/* 150 */ SDL_SCANCODE_UNKNOWN, /* KEY_WWW */
/* 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 */
@@ -192,7 +192,7 @@ static SDL_Scancode const linux_scancode_table[] = {
/* 163 */ SDL_SCANCODE_AUDIONEXT, /* KEY_NEXTSONG */
/* 164 */ SDL_SCANCODE_AUDIOPLAY, /* KEY_PLAYPAUSE */
/* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */
/* 166 */ SDL_SCANCODE_UNKNOWN, /* KEY_STOPCD */
/* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */
/* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */
/* 168 */ SDL_SCANCODE_UNKNOWN, /* KEY_REWIND */
/* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */
@@ -221,7 +221,7 @@ static SDL_Scancode const linux_scancode_table[] = {
/* 192 */ SDL_SCANCODE_F22,
/* 193 */ SDL_SCANCODE_F23,
/* 194 */ SDL_SCANCODE_F24,
0, 0, 0, 0,
0, 0, 0, 0, 0,
/* 200 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAYCD */
/* 201 */ SDL_SCANCODE_UNKNOWN, /* KEY_PAUSECD */
/* 202 */ SDL_SCANCODE_UNKNOWN, /* KEY_PROG3 */
+85
View File
@@ -418,4 +418,89 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
/* 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,
};
/* *INDENT-ON* */