src/video/emscripten/SDL_emscriptenevents.c
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 9998 f67cf37e9cd4
permissions -rw-r--r--
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
/*
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
  Simple DirectMedia Layer
9998
f67cf37e9cd4 Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents: 9725
diff changeset
     3
  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
  arising from the use of this software.
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
     appreciated but is not required.
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
     misrepresented as being the original software.
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
#include "../../SDL_internal.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
#if SDL_VIDEO_DRIVER_EMSCRIPTEN
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
#include <emscripten/html5.h>
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
#include "../../events/SDL_events_c.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#include "../../events/SDL_keyboard_c.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
#include "../../events/SDL_touch_c.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
#include "SDL_emscriptenevents.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
#include "SDL_emscriptenvideo.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
#include "SDL_hints.h"
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
/*
9601
4c65108b7ac3 Emscripten: Fixed wrong source comment and updated web link.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9591
diff changeset
    41
.keyCode to scancode
4c65108b7ac3 Emscripten: Fixed wrong source comment and updated web link.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9591
diff changeset
    42
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
4c65108b7ac3 Emscripten: Fixed wrong source comment and updated web link.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9591
diff changeset
    43
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
static const SDL_Scancode emscripten_scancode_table[] = {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
    /*  0 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
    /*  1 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
    /*  2 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
    /*  3 */    SDL_SCANCODE_CANCEL,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
    /*  4 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
    /*  5 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
    /*  6 */    SDL_SCANCODE_HELP,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
    /*  7 */    SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
    /*  8 */    SDL_SCANCODE_BACKSPACE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
    /*  9 */    SDL_SCANCODE_TAB,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
    /*  10 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
    /*  11 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
    /*  12 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
    /*  13 */   SDL_SCANCODE_RETURN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
    /*  14 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
    /*  15 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
    /*  16 */   SDL_SCANCODE_LSHIFT,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
    /*  17 */   SDL_SCANCODE_LCTRL,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
    /*  18 */   SDL_SCANCODE_LALT,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
    /*  19 */   SDL_SCANCODE_PAUSE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
    /*  20 */   SDL_SCANCODE_CAPSLOCK,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
    /*  21 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
    /*  22 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
    /*  23 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
    /*  24 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    /*  25 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    /*  26 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    /*  27 */   SDL_SCANCODE_ESCAPE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
    /*  28 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
    /*  29 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
    /*  30 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
    /*  31 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
    /*  32 */   SDL_SCANCODE_SPACE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
    /*  33 */   SDL_SCANCODE_PAGEUP,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
    /*  34 */   SDL_SCANCODE_PAGEDOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
    /*  35 */   SDL_SCANCODE_END,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
    /*  36 */   SDL_SCANCODE_HOME,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    /*  37 */   SDL_SCANCODE_LEFT,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
    /*  38 */   SDL_SCANCODE_UP,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
    /*  39 */   SDL_SCANCODE_RIGHT,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
    /*  40 */   SDL_SCANCODE_DOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
    /*  41 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
    /*  42 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
    /*  43 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
    /*  44 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
    /*  45 */   SDL_SCANCODE_INSERT,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
    /*  46 */   SDL_SCANCODE_DELETE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
    /*  47 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    /*  48 */   SDL_SCANCODE_0,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
    /*  49 */   SDL_SCANCODE_1,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
    /*  50 */   SDL_SCANCODE_2,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
    /*  51 */   SDL_SCANCODE_3,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
    /*  52 */   SDL_SCANCODE_4,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
    /*  53 */   SDL_SCANCODE_5,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
    /*  54 */   SDL_SCANCODE_6,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
    /*  55 */   SDL_SCANCODE_7,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
    /*  56 */   SDL_SCANCODE_8,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
    /*  57 */   SDL_SCANCODE_9,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
    /*  58 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
    /*  59 */   SDL_SCANCODE_SEMICOLON,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
    /*  60 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
    /*  61 */   SDL_SCANCODE_EQUALS,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
    /*  62 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
    /*  63 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
    /*  64 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
    /*  65 */   SDL_SCANCODE_A,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
    /*  66 */   SDL_SCANCODE_B,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
    /*  67 */   SDL_SCANCODE_C,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
    /*  68 */   SDL_SCANCODE_D,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
    /*  69 */   SDL_SCANCODE_E,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
    /*  70 */   SDL_SCANCODE_F,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
    /*  71 */   SDL_SCANCODE_G,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
    /*  72 */   SDL_SCANCODE_H,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
    /*  73 */   SDL_SCANCODE_I,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
    /*  74 */   SDL_SCANCODE_J,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
    /*  75 */   SDL_SCANCODE_K,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
    /*  76 */   SDL_SCANCODE_L,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    /*  77 */   SDL_SCANCODE_M,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
    /*  78 */   SDL_SCANCODE_N,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
    /*  79 */   SDL_SCANCODE_O,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
    /*  80 */   SDL_SCANCODE_P,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
    /*  81 */   SDL_SCANCODE_Q,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    /*  82 */   SDL_SCANCODE_R,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
    /*  83 */   SDL_SCANCODE_S,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
    /*  84 */   SDL_SCANCODE_T,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
    /*  85 */   SDL_SCANCODE_U,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
    /*  86 */   SDL_SCANCODE_V,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
    /*  87 */   SDL_SCANCODE_W,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
    /*  88 */   SDL_SCANCODE_X,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
    /*  89 */   SDL_SCANCODE_Y,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
    /*  90 */   SDL_SCANCODE_Z,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
    /*  91 */   SDL_SCANCODE_LGUI,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
    /*  92 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
    /*  93 */   SDL_SCANCODE_APPLICATION,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    /*  94 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
    /*  95 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
    /*  96 */   SDL_SCANCODE_KP_0,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
    /*  97 */   SDL_SCANCODE_KP_1,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
    /*  98 */   SDL_SCANCODE_KP_2,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
    /*  99 */   SDL_SCANCODE_KP_3,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
    /* 100 */   SDL_SCANCODE_KP_4,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    /* 101 */   SDL_SCANCODE_KP_5,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
    /* 102 */   SDL_SCANCODE_KP_6,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
    /* 103 */   SDL_SCANCODE_KP_7,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
    /* 104 */   SDL_SCANCODE_KP_8,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
    /* 105 */   SDL_SCANCODE_KP_9,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
    /* 106 */   SDL_SCANCODE_KP_MULTIPLY,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
    /* 107 */   SDL_SCANCODE_KP_PLUS,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
    /* 108 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
    /* 109 */   SDL_SCANCODE_KP_MINUS,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
    /* 110 */   SDL_SCANCODE_KP_PERIOD,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
    /* 111 */   SDL_SCANCODE_KP_DIVIDE,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
    /* 112 */   SDL_SCANCODE_F1,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
    /* 113 */   SDL_SCANCODE_F2,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
    /* 114 */   SDL_SCANCODE_F3,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
    /* 115 */   SDL_SCANCODE_F4,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
    /* 116 */   SDL_SCANCODE_F5,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
    /* 117 */   SDL_SCANCODE_F6,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
    /* 118 */   SDL_SCANCODE_F7,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
    /* 119 */   SDL_SCANCODE_F8,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
    /* 120 */   SDL_SCANCODE_F9,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
    /* 121 */   SDL_SCANCODE_F10,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
    /* 122 */   SDL_SCANCODE_F11,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
    /* 123 */   SDL_SCANCODE_F12,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
    /* 124 */   SDL_SCANCODE_F13,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
    /* 125 */   SDL_SCANCODE_F14,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
    /* 126 */   SDL_SCANCODE_F15,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
    /* 127 */   SDL_SCANCODE_F16,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
    /* 128 */   SDL_SCANCODE_F17,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
    /* 129 */   SDL_SCANCODE_F18,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
    /* 130 */   SDL_SCANCODE_F19,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
    /* 131 */   SDL_SCANCODE_F20,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
    /* 132 */   SDL_SCANCODE_F21,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
    /* 133 */   SDL_SCANCODE_F22,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
    /* 134 */   SDL_SCANCODE_F23,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
    /* 135 */   SDL_SCANCODE_F24,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
    /* 136 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
    /* 137 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
    /* 138 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
    /* 139 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
    /* 140 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
    /* 141 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
    /* 142 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
    /* 143 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
    /* 144 */   SDL_SCANCODE_NUMLOCKCLEAR,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
    /* 145 */   SDL_SCANCODE_SCROLLLOCK,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
    /* 146 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
    /* 147 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
    /* 148 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
    /* 149 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
    /* 150 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
    /* 151 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
    /* 152 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
    /* 153 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
    /* 154 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
    /* 155 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
    /* 156 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
    /* 157 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
    /* 158 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
    /* 159 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
    /* 160 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
    /* 161 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
    /* 162 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
    /* 163 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
    /* 164 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
    /* 165 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
    /* 166 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
    /* 167 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
    /* 168 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
    /* 169 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
    /* 170 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
    /* 171 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
    /* 172 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
    /* 173 */   SDL_SCANCODE_MINUS, /*FX*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
    /* 174 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
    /* 175 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
    /* 176 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
    /* 177 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
    /* 178 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
    /* 179 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
    /* 180 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
    /* 181 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
    /* 182 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
    /* 183 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
    /* 184 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
    /* 185 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
    /* 186 */   SDL_SCANCODE_SEMICOLON, /*IE, Chrome, D3E legacy*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
    /* 187 */   SDL_SCANCODE_EQUALS, /*IE, Chrome, D3E legacy*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
    /* 188 */   SDL_SCANCODE_COMMA,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
    /* 189 */   SDL_SCANCODE_MINUS, /*IE, Chrome, D3E legacy*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
    /* 190 */   SDL_SCANCODE_PERIOD,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
    /* 191 */   SDL_SCANCODE_SLASH,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
    /* 192 */   SDL_SCANCODE_GRAVE, /*FX, D3E legacy (SDL_SCANCODE_APOSTROPHE in IE/Chrome)*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
    /* 193 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
    /* 194 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
    /* 195 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
    /* 196 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
    /* 197 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
    /* 198 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
    /* 199 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   246
    /* 200 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   247
    /* 201 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   248
    /* 202 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   249
    /* 203 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   250
    /* 204 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   251
    /* 205 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
    /* 206 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   253
    /* 207 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   254
    /* 208 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   255
    /* 209 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   256
    /* 210 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   257
    /* 211 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   258
    /* 212 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
    /* 213 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   260
    /* 214 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   261
    /* 215 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   262
    /* 216 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   263
    /* 217 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   264
    /* 218 */   SDL_SCANCODE_UNKNOWN,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   265
    /* 219 */   SDL_SCANCODE_LEFTBRACKET,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
    /* 220 */   SDL_SCANCODE_BACKSLASH,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
    /* 221 */   SDL_SCANCODE_RIGHTBRACKET,
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   268
    /* 222 */   SDL_SCANCODE_APOSTROPHE, /*FX, D3E legacy*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
};
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
/* "borrowed" from SDL_windowsevents.c */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
int
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   276
    if (codepoint <= 0x7F) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   277
        text[0] = (char) codepoint;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   278
        text[1] = '\0';
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
    } else if (codepoint <= 0x7FF) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   280
        text[0] = 0xC0 | (char) ((codepoint >> 6) & 0x1F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   281
        text[1] = 0x80 | (char) (codepoint & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   282
        text[2] = '\0';
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   283
    } else if (codepoint <= 0xFFFF) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   284
        text[0] = 0xE0 | (char) ((codepoint >> 12) & 0x0F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   285
        text[1] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   286
        text[2] = 0x80 | (char) (codepoint & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   287
        text[3] = '\0';
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   288
    } else if (codepoint <= 0x10FFFF) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   289
        text[0] = 0xF0 | (char) ((codepoint >> 18) & 0x0F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   290
        text[1] = 0x80 | (char) ((codepoint >> 12) & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   291
        text[2] = 0x80 | (char) ((codepoint >> 6) & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   292
        text[3] = 0x80 | (char) (codepoint & 0x3F);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   293
        text[4] = '\0';
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   294
    } else {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   295
        return SDL_FALSE;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   296
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   297
    return SDL_TRUE;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   298
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   299
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   300
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   301
Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   302
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   303
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   304
    int mx = mouseEvent->canvasX, my = mouseEvent->canvasY;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   305
    EmscriptenPointerlockChangeEvent pointerlock_status;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   306
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   307
    /* check for pointer lock */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   308
    emscripten_get_pointerlock_status(&pointerlock_status);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   309
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   310
    if (pointerlock_status.isActive) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   311
        mx = mouseEvent->movementX;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   312
        my = mouseEvent->movementY;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   313
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   314
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   315
    /* rescale (in case canvas is being scaled)*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   316
    double client_w, client_h;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   317
    emscripten_get_element_css_size(NULL, &client_w, &client_h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   318
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   319
    mx = mx * (window_data->window->w / (client_w * window_data->pixel_ratio));
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   320
    my = my * (window_data->window->h / (client_h * window_data->pixel_ratio));
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   321
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   322
    SDL_SendMouseMotion(window_data->window, 0, pointerlock_status.isActive, mx, my);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   323
    return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   324
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   325
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   326
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   327
Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   328
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   329
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   330
    uint32_t sdl_button;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   331
    switch (mouseEvent->button) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   332
        case 0:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   333
            sdl_button = SDL_BUTTON_LEFT;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   334
            break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   335
        case 1:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   336
            sdl_button = SDL_BUTTON_MIDDLE;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   337
            break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   338
        case 2:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   339
            sdl_button = SDL_BUTTON_RIGHT;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   340
            break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   341
        default:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   342
            return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   343
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   344
    SDL_SendMouseButton(window_data->window, 0, eventType == EMSCRIPTEN_EVENT_MOUSEDOWN ? SDL_PRESSED : SDL_RELEASED, sdl_button);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   345
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   346
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   347
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   348
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   349
Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   350
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   351
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   352
    SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? SDL_WINDOWEVENT_ENTER : SDL_WINDOWEVENT_LEAVE, 0, 0);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   353
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   354
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   355
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   356
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   357
Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   358
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   359
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   360
    SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   361
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   362
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   363
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   364
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   365
Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   366
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   367
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   368
    SDL_SendWindowEvent(window_data->window, eventType == EMSCRIPTEN_EVENT_FOCUS ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   369
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   370
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   371
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   372
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   373
Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   374
{
9591
ebc2a308211b Emscripten: Fixed touch coordinates not being normalized.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9378
diff changeset
   375
    SDL_WindowData *window_data = userData;
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   376
    int i;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   377
9725
6bfe2f6069b0 Emscripten: Fixed SDL_GetTouchDevice() returning 0 for the valid device index.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9679
diff changeset
   378
    SDL_TouchID deviceId = 1;
9679
7fc4a8be47a8 Fixed bug 2054 - SDL_GetError: "Unknown touch device"
Sam Lantinga <slouken@libsdl.org>
parents: 9619
diff changeset
   379
    if (SDL_AddTouch(deviceId, "") < 0) {
7fc4a8be47a8 Fixed bug 2054 - SDL_GetError: "Unknown touch device"
Sam Lantinga <slouken@libsdl.org>
parents: 9619
diff changeset
   380
         return 0;
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   381
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   382
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   383
    for (i = 0; i < touchEvent->numTouches; i++) {
9591
ebc2a308211b Emscripten: Fixed touch coordinates not being normalized.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9378
diff changeset
   384
        SDL_FingerID id;
ebc2a308211b Emscripten: Fixed touch coordinates not being normalized.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9378
diff changeset
   385
        float x, y;
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   386
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   387
        if (!touchEvent->touches[i].isChanged)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   388
            continue;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   389
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   390
        id = touchEvent->touches[i].identifier;
9591
ebc2a308211b Emscripten: Fixed touch coordinates not being normalized.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9378
diff changeset
   391
        x = touchEvent->touches[i].canvasX / (float)window_data->windowed_width;
ebc2a308211b Emscripten: Fixed touch coordinates not being normalized.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9378
diff changeset
   392
        y = touchEvent->touches[i].canvasY / (float)window_data->windowed_height;
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   393
10266
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   394
        if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) {
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   395
            if (!window_data->finger_touching) {
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   396
                window_data->finger_touching = SDL_TRUE;
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   397
                window_data->first_finger = id;
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   398
                SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y);
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   399
                SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   400
            }
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   401
            SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f);
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   402
        } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   403
            if ((window_data->finger_touching) && (window_data->first_finger == id)) {
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   404
                SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y);
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   405
            }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   406
            SDL_SendTouchMotion(deviceId, id, x, y, 1.0f);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   407
        } else {
10266
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   408
            if ((window_data->finger_touching) && (window_data->first_finger == id)) {
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   409
                SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   410
                window_data->finger_touching = SDL_FALSE;
c09f06c4e8c8 emscripten: send fake mouse events for touches, like other targets do.
Ryan C. Gordon <icculus@icculus.org>
parents: 9998
diff changeset
   411
            }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   412
            SDL_SendTouch(deviceId, id, SDL_FALSE, x, y, 1.0f);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   413
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   414
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   415
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   416
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   417
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   418
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   419
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   420
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   421
Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   422
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   423
    Uint32 scancode;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   424
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   425
    /* .keyCode is deprecated, but still the most reliable way to get keys */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   426
    if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   427
        scancode = emscripten_scancode_table[keyEvent->keyCode];
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   428
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   429
        if (scancode != SDL_SCANCODE_UNKNOWN) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   430
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   431
            if (keyEvent->location == DOM_KEY_LOCATION_RIGHT) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   432
                switch (scancode) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   433
                    case SDL_SCANCODE_LSHIFT:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   434
                        scancode = SDL_SCANCODE_RSHIFT;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   435
                        break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   436
                    case SDL_SCANCODE_LCTRL:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   437
                        scancode = SDL_SCANCODE_RCTRL;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   438
                        break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   439
                    case SDL_SCANCODE_LALT:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   440
                        scancode = SDL_SCANCODE_RALT;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   441
                        break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   442
                    case SDL_SCANCODE_LGUI:
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   443
                        scancode = SDL_SCANCODE_RGUI;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   444
                        break;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   445
                }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   446
            }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   447
            SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ?
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   448
                                SDL_PRESSED : SDL_RELEASED, scancode);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   449
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   450
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   451
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   452
    /* if we prevent keydown, we won't get keypress
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   453
     * also we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   454
     */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   455
    return SDL_GetEventState(SDL_TEXTINPUT) != SDL_ENABLE || eventType != EMSCRIPTEN_EVENT_KEYDOWN
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   456
            || keyEvent->keyCode == 8 /* backspace */ || keyEvent->keyCode == 9 /* tab */;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   457
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   458
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   459
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   460
Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   461
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   462
    char text[5];
9378
71743b696c06 Emscripten: Fixed ignoring return value of internal function.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9377
diff changeset
   463
    if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
71743b696c06 Emscripten: Fixed ignoring return value of internal function.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9377
diff changeset
   464
        SDL_SendKeyboardText(text);
71743b696c06 Emscripten: Fixed ignoring return value of internal function.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9377
diff changeset
   465
    }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   466
    return 1;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   467
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   468
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   469
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   470
Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   471
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   472
    /*make sure this is actually our element going fullscreen*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   473
    if(SDL_strcmp(fullscreenChangeEvent->id, "SDLFullscreenElement") != 0)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   474
        return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   475
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   476
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   477
    if(fullscreenChangeEvent->isFullscreen)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   478
    {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   479
        SDL_bool is_desktop_fullscreen;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   480
        window_data->window->flags |= window_data->requested_fullscreen_mode;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   481
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   482
        if(!window_data->requested_fullscreen_mode)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   483
            window_data->window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; /*we didn't reqest fullscreen*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   484
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   485
        window_data->requested_fullscreen_mode = 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   486
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   487
        is_desktop_fullscreen = (window_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   488
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   489
        /*update size*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   490
        if(window_data->window->flags & SDL_WINDOW_RESIZABLE || is_desktop_fullscreen)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   491
        {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   492
            emscripten_set_canvas_size(fullscreenChangeEvent->screenWidth, fullscreenChangeEvent->screenHeight);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   493
            SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, fullscreenChangeEvent->screenWidth, fullscreenChangeEvent->screenHeight);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   494
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   495
        else
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   496
        {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   497
            /*preserve ratio*/
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   498
            double w = window_data->window->w;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   499
            double h = window_data->window->h;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   500
            double factor = SDL_min(fullscreenChangeEvent->screenWidth / w, fullscreenChangeEvent->screenHeight / h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   501
            emscripten_set_element_css_size(NULL, w * factor, h * factor);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   502
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   503
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   504
    else
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   505
    {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   506
        EM_ASM({
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   507
            //un-reparent canvas (similar to Module.requestFullscreen)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   508
            var canvas = Module['canvas'];
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   509
            if(canvas.parentNode.id == "SDLFullscreenElement") {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   510
                var canvasContainer = canvas.parentNode;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   511
                canvasContainer.parentNode.insertBefore(canvas, canvasContainer);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   512
                canvasContainer.parentNode.removeChild(canvasContainer);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   513
            }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   514
        });
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   515
        double unscaled_w = window_data->windowed_width / window_data->pixel_ratio;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   516
        double unscaled_h = window_data->windowed_height / window_data->pixel_ratio;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   517
        emscripten_set_canvas_size(window_data->windowed_width, window_data->windowed_height);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   518
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   519
        if (!window_data->external_size && window_data->pixel_ratio != 1.0f) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   520
            emscripten_set_element_css_size(NULL, unscaled_w, unscaled_h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   521
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   522
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   523
        SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, unscaled_w, unscaled_h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   524
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   525
        window_data->window->flags &= ~FULLSCREEN_MASK;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   526
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   527
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   528
    return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   529
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   530
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   531
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   532
Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   533
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   534
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   535
    if(window_data->window->flags & FULLSCREEN_MASK)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   536
    {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   537
        SDL_bool is_desktop_fullscreen = (window_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   538
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   539
        if(window_data->window->flags & SDL_WINDOW_RESIZABLE || is_desktop_fullscreen)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   540
        {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   541
            emscripten_set_canvas_size(uiEvent->windowInnerWidth * window_data->pixel_ratio, uiEvent->windowInnerHeight * window_data->pixel_ratio);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   542
            SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, uiEvent->windowInnerWidth, uiEvent->windowInnerHeight);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   543
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   544
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   545
    else
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   546
    {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   547
        /* this will only work if the canvas size is set through css */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   548
        if(window_data->window->flags & SDL_WINDOW_RESIZABLE)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   549
        {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   550
            double w = window_data->window->w;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   551
            double h = window_data->window->h;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   552
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   553
            if(window_data->external_size) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   554
                emscripten_get_element_css_size(NULL, &w, &h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   555
            }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   556
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   557
            emscripten_set_canvas_size(w * window_data->pixel_ratio, h * window_data->pixel_ratio);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   558
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   559
            /* set_canvas_size unsets this */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   560
            if (!window_data->external_size && window_data->pixel_ratio != 1.0f) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   561
                emscripten_set_element_css_size(NULL, w, h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   562
            }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   563
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   564
            SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   565
        }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   566
    }
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   567
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   568
    return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   569
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   570
9352
2cbf791a601c Emscripten: Changed return type of callback implementations from int to EM_BOOL.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
   571
EM_BOOL
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   572
Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   573
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   574
    SDL_WindowData *window_data = userData;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   575
    SDL_SendWindowEvent(window_data->window, visEvent->hidden ? SDL_WINDOWEVENT_HIDDEN : SDL_WINDOWEVENT_SHOWN, 0, 0);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   576
    return 0;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   577
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   578
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   579
void
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   580
Emscripten_RegisterEventHandlers(SDL_WindowData *data)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   581
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   582
    /* There is only one window and that window is the canvas */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   583
    emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   584
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   585
    emscripten_set_mousedown_callback("#canvas", data, 0, Emscripten_HandleMouseButton);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   586
    emscripten_set_mouseup_callback("#canvas", data, 0, Emscripten_HandleMouseButton);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   587
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   588
    emscripten_set_mouseenter_callback("#canvas", data, 0, Emscripten_HandleMouseFocus);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   589
    emscripten_set_mouseleave_callback("#canvas", data, 0, Emscripten_HandleMouseFocus);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   590
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   591
    emscripten_set_wheel_callback("#canvas", data, 0, Emscripten_HandleWheel);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   592
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   593
    emscripten_set_focus_callback("#canvas", data, 0, Emscripten_HandleFocus);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   594
    emscripten_set_blur_callback("#canvas", data, 0, Emscripten_HandleFocus);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   595
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   596
    emscripten_set_touchstart_callback("#canvas", data, 0, Emscripten_HandleTouch);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   597
    emscripten_set_touchend_callback("#canvas", data, 0, Emscripten_HandleTouch);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   598
    emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   599
    emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   600
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   601
    /* Keyboard events are awkward */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   602
    const char *keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   603
    if (!keyElement) keyElement = "#window";
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   604
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   605
    emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   606
    emscripten_set_keyup_callback(keyElement, data, 0, Emscripten_HandleKey);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   607
    emscripten_set_keypress_callback(keyElement, data, 0, Emscripten_HandleKeyPress);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   608
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   609
    emscripten_set_fullscreenchange_callback("#document", data, 0, Emscripten_HandleFullscreenChange);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   610
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   611
    emscripten_set_resize_callback("#window", data, 0, Emscripten_HandleResize);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   612
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   613
    emscripten_set_visibilitychange_callback(data, 0, Emscripten_HandleVisibilityChange);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   614
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   615
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   616
void
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   617
Emscripten_UnregisterEventHandlers(SDL_WindowData *data)
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   618
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   619
    /* only works due to having one window */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   620
    emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   621
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   622
    emscripten_set_mousedown_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   623
    emscripten_set_mouseup_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   624
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   625
    emscripten_set_mouseenter_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   626
    emscripten_set_mouseleave_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   627
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   628
    emscripten_set_wheel_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   629
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   630
    emscripten_set_focus_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   631
    emscripten_set_blur_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   632
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   633
    emscripten_set_touchstart_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   634
    emscripten_set_touchend_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   635
    emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   636
    emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   637
9377
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   638
    const char *target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT);
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   639
    if (!target) {
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   640
        target = "#window";
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   641
    }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   642
9377
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   643
    emscripten_set_keydown_callback(target, NULL, 0, NULL);
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   644
    emscripten_set_keyup_callback(target, NULL, 0, NULL);
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   645
4c29dc2baaa8 Emscripten: Partially fixed not removing key event callbacks if hint was used.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9352
diff changeset
   646
    emscripten_set_keypress_callback(target, NULL, 0, NULL);
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   647
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   648
    emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   649
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   650
    emscripten_set_resize_callback("#window", NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   651
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   652
    emscripten_set_visibilitychange_callback(NULL, 0, NULL);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   653
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   654
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   655
#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   656
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   657
/* vi: set ts=4 sw=4 expandtab: */