diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-01-24 11:57:18 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-01-24 12:31:53 +0200 |
commit | 9f7690fa3de0d28ed93c88f2a80537a79bfd2847 (patch) | |
tree | d77b4dcb9bae94df0def065c515df0e49dbe6dd9 /system | |
parent | d655dd640096c0de8df62eac6259766773e378d9 (diff) |
Rename library_events to library_html5 and other suggested renamings. Add better support for reporting EMSCRIPTEN_RESULT_NOT_SUPPORTED for unsupported features.
Diffstat (limited to 'system')
-rw-r--r-- | system/include/emscripten/html5.h (renamed from system/include/emscripten/events.h) | 149 |
1 files changed, 76 insertions, 73 deletions
diff --git a/system/include/emscripten/events.h b/system/include/emscripten/html5.h index 4caae3cf..06c647bf 100644 --- a/system/include/emscripten/events.h +++ b/system/include/emscripten/html5.h @@ -99,14 +99,17 @@ extern "C" { // The given target element for the operation is invalid. #define EMSCRIPTEN_RESULT_INVALID_TARGET -3 +// The given target element for the operation was not found. +#define EMSCRIPTEN_RESULT_UNKNOWN_TARGET -4 + // An invalid parameter was passed to the function. -#define EMSCRIPTEN_RESULT_INVALID_PARAM -4 +#define EMSCRIPTEN_RESULT_INVALID_PARAM -5 // The operation failed due to some generic reason. -#define EMSCRIPTEN_RESULT_FAILED -5 +#define EMSCRIPTEN_RESULT_FAILED -6 // Operation failed since no data is currently available. -#define EMSCRIPTEN_RESULT_NO_DATA -6 +#define EMSCRIPTEN_RESULT_NO_DATA -7 #define EM_BOOL int #define EM_UTF8 char @@ -121,7 +124,7 @@ extern "C" { * The event structure passed in keyboard events keypress, keydown and keyup. * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keys */ -typedef struct emscripten_KeyboardEvent { +typedef struct EmscriptenKeyboardEvent { // The printed representation of the pressed key. EM_UTF8 key[32]; // A string that identifies the physical key being pressed. The value is not affected by the current keyboard @@ -150,22 +153,22 @@ typedef struct emscripten_KeyboardEvent { unsigned long keyCode; // A system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keyCode. unsigned long which; -} emscripten_KeyboardEvent; +} EmscriptenKeyboardEvent; /* * Registers a callback function for receiving browser-generated keyboard input events. * See https://developer.mozilla.org/en/DOM/Event/UIEvent/KeyEvent * and http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml */ -extern EMSCRIPTEN_RESULT emscripten_set_keypress_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_KeyboardEvent *keyEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_keydown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_KeyboardEvent *keyEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_keyup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_KeyboardEvent *keyEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_keypress_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_keydown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_keyup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); /* * The event structure passed in mouse events click, mousedown, mouseup, dblclick and mousemove. * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-MouseEvent */ -typedef struct emscripten_MouseEvent { +typedef struct EmscriptenMouseEvent { // A timestamp of when this data was generated by the browser. This is an absolute wallclock time in milliseconds. double timestamp; // The coordinate relative to the browser screen coordinate system. @@ -191,22 +194,22 @@ typedef struct emscripten_MouseEvent { long canvasY; // Pad this struct to multiple of 8 bytes to make WheelEvent unambiguously align to 8 bytes. long padding; -} emscripten_MouseEvent; +} EmscriptenMouseEvent; /* * Registers a callback function for receiving browser-generated mouse input events. * See https://developer.mozilla.org/en/DOM/MouseEvent */ -extern EMSCRIPTEN_RESULT emscripten_set_click_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_MouseEvent *mouseEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_mousedown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_MouseEvent *mouseEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_mouseup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_MouseEvent *mouseEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_dblclick_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_MouseEvent *mouseEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_mousemove_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const emscripten_MouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_click_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mousedown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mouseup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_dblclick_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mousemove_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); /* * Returns the most recently received mouse event state. Note that for this function call to succeed, emscripten_set_xx_callback must have first * been called with one of the mouse event types and a non-zero callback function pointer to enable the Mouse state capture. */ -extern EMSCRIPTEN_RESULT emscripten_get_mouse_status(emscripten_MouseEvent *mouseState); +extern EMSCRIPTEN_RESULT emscripten_get_mouse_status(EmscriptenMouseEvent *mouseState); #define DOM_DELTA_PIXEL 0x00 #define DOM_DELTA_LINE 0x01 @@ -216,28 +219,28 @@ extern EMSCRIPTEN_RESULT emscripten_get_mouse_status(emscripten_MouseEvent *mous * The event structure passed in mouse wheelevent. * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-WheelEvent */ -typedef struct emscripten_WheelEvent { +typedef struct EmscriptenWheelEvent { // Specifies general mouse information related to this event. - emscripten_MouseEvent mouse; + EmscriptenMouseEvent mouse; // Measures along different axes the movement of the wheel. double deltaX; double deltaY; double deltaZ; // One of the DOM_DELTA_ values that indicates the units of measurement for the delta values. unsigned long deltaMode; -} emscripten_WheelEvent; +} EmscriptenWheelEvent; /* * Registers a callback function for receiving browser-generated mouse wheel events. * See http://www.w3.org/TR/DOM-Level-3-Events/#event-type-wheel */ -extern EMSCRIPTEN_RESULT emscripten_set_wheel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_WheelEvent *wheelEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_wheel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)); /* * The event structure passed in DOM element resize and scroll events. * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent */ -typedef struct emscripten_UiEvent { +typedef struct EmscriptenUiEvent { // Specifies detail information about this event. long detail; // The clientWidth/clientHeight of the document.body element. @@ -252,40 +255,40 @@ typedef struct emscripten_UiEvent { // The page scroll position. int scrollTop; int scrollLeft; -} emscripten_UiEvent; +} EmscriptenUiEvent; /* * Registers a callback function for receiving DOM element resize and scroll events. * See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize */ -extern EMSCRIPTEN_RESULT emscripten_set_resize_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_UiEvent *uiEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_scroll_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_UiEvent *uiEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_resize_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_scroll_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)); /* * The event structure passed in DOM element blur, focus, focusin and focusout events. * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-FocusEvent */ -typedef struct emscripten_FocusEvent { +typedef struct EmscriptenFocusEvent { // The nodeName of the target HTML Element. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName EM_UTF8 nodeName[128]; // The HTML Element ID of the target element. EM_UTF8 id[128]; -} emscripten_FocusEvent; +} EmscriptenFocusEvent; /* * Registers a callback function for receiving DOM element blur, focus, focusin and focusout events. * See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-blur */ -extern EMSCRIPTEN_RESULT emscripten_set_blur_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_FocusEvent *focusEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_focus_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_FocusEvent *focusEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_focusin_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_FocusEvent *focusEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_focusout_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_FocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_blur_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focus_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focusin_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focusout_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); /* * The event structure passed in the deviceorientation event. * http://dev.w3.org/geo/api/spec-source-orientation.html#deviceorientation */ -typedef struct emscripten_DeviceOrientationEvent { +typedef struct EmscriptenDeviceOrientationEvent { // Absolute wallclock time in msec units of when the event occurred. double timestamp; // The orientation of the device in terms of the transformation from a coordinate frame fixed on the Earth to a coordinate frame fixed in the device. @@ -294,24 +297,24 @@ typedef struct emscripten_DeviceOrientationEvent { double gamma; // If false, the orientation is only relative to some other bas orinetation, not to the fixed coordinate frame. EM_BOOL absolute; -} emscripten_DeviceOrientationEvent; +} EmscriptenDeviceOrientationEvent; /* * Registers a callback function for receiving the deviceorientation event. * See http://dev.w3.org/geo/api/spec-source-orientation.html */ -extern EMSCRIPTEN_RESULT emscripten_set_deviceorientation_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_DeviceOrientationEvent *orientationEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_deviceorientation_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenDeviceOrientationEvent *orientationEvent, void *userData)); /* * Returns the most recently received deviceorientation event state. Note that for this function call to succeed, emscripten_set_deviceorientation_callback * must have first been called with one of the mouse event types and a non-zero callback function pointer to enable the Device Orientation state capture. */ -extern EMSCRIPTEN_RESULT emscripten_get_deviceorientation_status(emscripten_DeviceOrientationEvent *orientationState); +extern EMSCRIPTEN_RESULT emscripten_get_deviceorientation_status(EmscriptenDeviceOrientationEvent *orientationState); /* * The event structure passed in the devicemotion event. * http://dev.w3.org/geo/api/spec-source-orientation.html#devicemotion */ -typedef struct emscripten_DeviceMotionEvent { +typedef struct EmscriptenDeviceMotionEvent { // Absolute wallclock time in msec units of when the event occurred. double timestamp; // Acceleration of the device excluding gravity. @@ -326,18 +329,18 @@ typedef struct emscripten_DeviceMotionEvent { double rotationRateAlpha; double rotationRateBeta; double rotationRateGamma; -} emscripten_DeviceMotionEvent; +} EmscriptenDeviceMotionEvent; /* * Registers a callback function for receiving the devicemotion event. * See http://dev.w3.org/geo/api/spec-source-orientation.html */ -extern EMSCRIPTEN_RESULT emscripten_set_devicemotion_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_DeviceMotionEvent *motionEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_devicemotion_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenDeviceMotionEvent *motionEvent, void *userData)); /* * Returns the most recently received deviceomotion event state. Note that for this function call to succeed, emscripten_set_devicemotion_callback * must have first been called with one of the mouse event types and a non-zero callback function pointer to enable the Device Motion state capture. */ -extern EMSCRIPTEN_RESULT emscripten_get_devicemotion_status(emscripten_DeviceMotionEvent *motionState); +extern EMSCRIPTEN_RESULT emscripten_get_devicemotion_status(EmscriptenDeviceMotionEvent *motionState); #define EMSCRIPTEN_ORIENTATION_PORTRAIT_PRIMARY 1 #define EMSCRIPTEN_ORIENTATION_PORTRAIT_SECONDARY 2 @@ -348,23 +351,23 @@ extern EMSCRIPTEN_RESULT emscripten_get_devicemotion_status(emscripten_DeviceMot * The event structure passed in the orientationchange event. * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html */ -typedef struct emscripten_OrientationChangeEvent { +typedef struct EmscriptenOrientationChangeEvent { // One of EM_ORIENTATION_PORTRAIT_xx fields, or -1 if unknown. int orientationIndex; // Emscripten-specific extension: Some browsers refer to 'window.orientation', so report that as well. // Orientation angle in degrees. 0: "default orientation", i.e. default upright orientation to hold the mobile device in. Could be either landscape or portrait. int orientationAngle; -} emscripten_OrientationChangeEvent; +} EmscriptenOrientationChangeEvent; /* * Registers a callback function for receiving the orientationchange event. * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html */ -extern EMSCRIPTEN_RESULT emscripten_set_orientationchange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_OrientationChangeEvent *orientationChangeEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_orientationchange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenOrientationChangeEvent *orientationChangeEvent, void *userData)); /* * Returns the current device orientation state. */ -extern EMSCRIPTEN_RESULT emscripten_get_orientation_status(emscripten_OrientationChangeEvent *orientationStatus); +extern EMSCRIPTEN_RESULT emscripten_get_orientation_status(EmscriptenOrientationChangeEvent *orientationStatus); /* * Locks the screen orientation to the given set of allowed orientations. * allowedOrientations: A bitfield set of EM_ORIENTATION_xx flags. @@ -379,7 +382,7 @@ extern EMSCRIPTEN_RESULT emscripten_unlock_orientation(); * The event structure passed in the fullscreenchange event. * https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html */ -typedef struct emscripten_FullscreenChangeEvent { +typedef struct EmscriptenFullscreenChangeEvent { // Specifies whether an element on the browser page is currently fullscreen. EM_BOOL isFullscreen; // Specifies if the current page has the ability to display elements fullscreen. @@ -388,17 +391,17 @@ typedef struct emscripten_FullscreenChangeEvent { EM_UTF8 nodeName[128]; // The HTML Element ID of the target HTML element that is in full screen mode. EM_UTF8 id[128]; -} emscripten_FullscreenChangeEvent; +} EmscriptenFullscreenChangeEvent; /* * Registers a callback function for receiving the fullscreenchange event. * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html */ -extern EMSCRIPTEN_RESULT emscripten_set_fullscreenchange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_FullscreenChangeEvent *fullscreenChangeEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_fullscreenchange_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)); /* * Returns the current page fullscreen state. */ -extern EMSCRIPTEN_RESULT emscripten_get_fullscreen_status(emscripten_FullscreenChangeEvent *fullscreenStatus); +extern EMSCRIPTEN_RESULT emscripten_get_fullscreen_status(EmscriptenFullscreenChangeEvent *fullscreenStatus); /* * Requests the given target element to transition to full screen mode. * Note: This function can only run inside a user-generated JavaScript event handler. @@ -416,25 +419,25 @@ extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen(); * The event structure passed in the pointerlockchange event. * http://www.w3.org/TR/pointerlock/ */ -typedef struct emscripten_PointerlockChangeEvent { +typedef struct EmscriptenPointerlockChangeEvent { // Specifies whether an element on the browser page currently has pointer lock enabled. EM_BOOL isActive; // The nodeName of the target HTML Element that has the pointer lock active. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName EM_UTF8 nodeName[128]; // The HTML Element ID of the target HTML element that has the pointer lock active. EM_UTF8 id[128]; -} emscripten_PointerlockChangeEvent; +} EmscriptenPointerlockChangeEvent; /* * Registers a callback function for receiving the pointerlockchange event. * Pointer lock hides the mouse cursor and exclusively gives the target element relative mouse movement events via the mousemove event. * http://www.w3.org/TR/pointerlock/ */ -extern EMSCRIPTEN_RESULT emscripten_set_pointerlockchange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_PointerlockChangeEvent *pointerlockChangeEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_pointerlockchange_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenPointerlockChangeEvent *pointerlockChangeEvent, void *userData)); /* * Returns the current page pointerlock state. */ -extern EMSCRIPTEN_RESULT emscripten_get_pointerlock_status(emscripten_PointerlockChangeEvent *pointerlockStatus); +extern EMSCRIPTEN_RESULT emscripten_get_pointerlock_status(EmscriptenPointerlockChangeEvent *pointerlockStatus); /* * Requests the given target element to grab pointerlock. * Note: This function can only run inside a user-generated JavaScript event handler. @@ -457,28 +460,28 @@ extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock(); * The event structure passed in the visibilitychange event. * http://www.w3c-test.org/webperf/specs/PageVisibility/ */ -typedef struct emscripten_VisibilityChangeEvent { +typedef struct EmscriptenVisibilityChangeEvent { // If true, the current browser page is now hidden. EM_BOOL hidden; // Specifies a more fine-grained state of the current page visibility status. One of the EMSCRIPTEN_VISIBILITY_ values. int visibilityState; -} emscripten_VisibilityChangeEvent; +} EmscriptenVisibilityChangeEvent; /* * Registers a callback function for receiving the visibilitychange event. * http://www.w3c-test.org/webperf/specs/PageVisibility/ */ -extern EMSCRIPTEN_RESULT emscripten_set_visibilitychange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_VisibilityChangeEvent *visibilityChangeEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_visibilitychange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData)); /* * Returns the current page visibility state. */ -extern EMSCRIPTEN_RESULT emscripten_get_visibility_status(emscripten_VisibilityChangeEvent *visibilityStatus); +extern EMSCRIPTEN_RESULT emscripten_get_visibility_status(EmscriptenVisibilityChangeEvent *visibilityStatus); /* * Specifies the status of a single touch point on the page. * See http://www.w3.org/TR/touch-events/#touch-interface */ -typedef struct emscripten_TouchPoint +typedef struct EmscriptenTouchPoint { // An identification number for each touch point. long identifier; @@ -498,13 +501,13 @@ typedef struct emscripten_TouchPoint // The touch coordinates mapped to the Emscripten canvas client area, in pixels. long canvasX; long canvasY; -} emscripten_TouchPoint; +} EmscriptenTouchPoint; /* * Specifies the data of a single touch event. * See http://www.w3.org/TR/touch-events/#touchevent-interface */ -typedef struct emscripten_TouchEvent { +typedef struct EmscriptenTouchEvent { // The number of valid elements in the touches array. int numTouches; // Specifies which modifiers were active during the key event. @@ -513,23 +516,23 @@ typedef struct emscripten_TouchEvent { EM_BOOL altKey; EM_BOOL metaKey; // An array of currently active touches, one for each finger. - emscripten_TouchPoint touches[32]; -} emscripten_TouchEvent; + EmscriptenTouchPoint touches[32]; +} EmscriptenTouchEvent; /* * Registers a callback function for receiving the touchstart, touchend, touchmove and touchcancel events. * http://www.w3.org/TR/touch-events/ */ -extern EMSCRIPTEN_RESULT emscripten_set_touchstart_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_TouchEvent *touchEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_touchend_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_TouchEvent *touchEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_touchmove_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_TouchEvent *touchEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_touchcancel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_TouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchstart_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchend_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchmove_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchcancel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); /* * Represents the current snapshot state of a gamepad. * http://www.w3.org/TR/gamepad/#gamepad-interface */ -typedef struct emscripten_GamepadEvent { +typedef struct EmscriptenGamepadEvent { // Absolute wallclock time in msec units of when the data was recorded. double timestamp; // The number of valid axes entries in the axis array. @@ -550,14 +553,14 @@ typedef struct emscripten_GamepadEvent { EM_UTF8 id[64]; // A string that identifies the layout or control mapping of this device. EM_UTF8 mapping[64]; -} emscripten_GamepadEvent; +} EmscriptenGamepadEvent; /* * Registers a callback function for receiving the gamepadconnected and gamepaddisconnected events. * http://www.w3.org/TR/gamepad/ */ -extern EMSCRIPTEN_RESULT emscripten_set_gamepadconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_GamepadEvent *gamepadEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const emscripten_GamepadEvent *gamepadEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_gamepadconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)); /* * Returns the number of gamepads connected to the system or EMSCRIPTEN_RESULT_NOT_SUPPORTED if the current browser does not support gamepads. @@ -567,29 +570,29 @@ extern int emscripten_get_num_gamepads(); /* * Returns a snapshot of the current gamepad state. */ -extern EMSCRIPTEN_RESULT emscripten_get_gamepad_status(int index, emscripten_GamepadEvent *gamepadState); +extern EMSCRIPTEN_RESULT emscripten_get_gamepad_status(int index, EmscriptenGamepadEvent *gamepadState); /* * The event structure passed in the battery chargingchange and levelchange event. * http://www.w3.org/TR/battery-status/#batterymanager-interface */ -typedef struct emscripten_BatteryEvent { +typedef struct EmscriptenBatteryEvent { double chargingTime; double dischargingTime; double level; EM_BOOL charging; -} emscripten_BatteryEvent; +} EmscriptenBatteryEvent; /* * Registers a callback function for receiving the battery chargingchange and levelchange events. * http://www.w3.org/TR/battery-status/ */ -extern EMSCRIPTEN_RESULT emscripten_set_batterychargingchange_callback(void *userData, EM_BOOL (*func)(int eventType, const emscripten_BatteryEvent *batteryEvent, void *userData)); -extern EMSCRIPTEN_RESULT emscripten_set_batterylevelchange_callback(void *userData, EM_BOOL (*func)(int eventType, const emscripten_BatteryEvent *batteryEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_batterychargingchange_callback(void *userData, EM_BOOL (*func)(int eventType, const EmscriptenBatteryEvent *batteryEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_batterylevelchange_callback(void *userData, EM_BOOL (*func)(int eventType, const EmscriptenBatteryEvent *batteryEvent, void *userData)); /* * Returns the current battery status. */ -extern EMSCRIPTEN_RESULT emscripten_get_battery_status(emscripten_BatteryEvent *batteryState); +extern EMSCRIPTEN_RESULT emscripten_get_battery_status(EmscriptenBatteryEvent *batteryState); /* * Produces a vibration feedback for given msecs. |