@@ -168,9 +168,10 @@ typedef struct EmscriptenKeyboardEvent {
168
168
* See https://developer.mozilla.org/en/DOM/Event/UIEvent/KeyEvent
169
169
* and http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml
170
170
*/
171
- extern EMSCRIPTEN_RESULT emscripten_set_keypress_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenKeyboardEvent * keyEvent , void * userData ));
172
- extern EMSCRIPTEN_RESULT emscripten_set_keydown_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenKeyboardEvent * keyEvent , void * userData ));
173
- extern EMSCRIPTEN_RESULT emscripten_set_keyup_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenKeyboardEvent * keyEvent , void * userData ));
171
+ typedef EM_BOOL (* em_key_callback_func )(int eventType , const EmscriptenKeyboardEvent * keyEvent , void * userData );
172
+ extern EMSCRIPTEN_RESULT emscripten_set_keypress_callback (const char * target , void * userData , EM_BOOL useCapture , em_key_callback_func callback );
173
+ extern EMSCRIPTEN_RESULT emscripten_set_keydown_callback (const char * target , void * userData , EM_BOOL useCapture , em_key_callback_func callback );
174
+ extern EMSCRIPTEN_RESULT emscripten_set_keyup_callback (const char * target , void * userData , EM_BOOL useCapture , em_key_callback_func callback );
174
175
175
176
/*
176
177
* The event structure passed in mouse events click, mousedown, mouseup, dblclick and mousemove.
@@ -209,11 +210,12 @@ typedef struct EmscriptenMouseEvent {
209
210
* Registers a callback function for receiving browser-generated mouse input events.
210
211
* See https://developer.mozilla.org/en/DOM/MouseEvent
211
212
*/
212
- extern EMSCRIPTEN_RESULT emscripten_set_click_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData ));
213
- extern EMSCRIPTEN_RESULT emscripten_set_mousedown_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData ));
214
- extern EMSCRIPTEN_RESULT emscripten_set_mouseup_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData ));
215
- extern EMSCRIPTEN_RESULT emscripten_set_dblclick_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData ));
216
- extern EMSCRIPTEN_RESULT emscripten_set_mousemove_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenMouseEvent * mouseEvent , void * userData ));
213
+ typedef EM_BOOL (* em_mouse_callback_func )(int eventType , const EmscriptenMouseEvent * keyEvent , void * userData );
214
+ extern EMSCRIPTEN_RESULT emscripten_set_click_callback (const char * target , void * userData , EM_BOOL useCapture , em_mouse_callback_func callback );
215
+ extern EMSCRIPTEN_RESULT emscripten_set_mousedown_callback (const char * target , void * userData , EM_BOOL useCapture , em_mouse_callback_func callback );
216
+ extern EMSCRIPTEN_RESULT emscripten_set_mouseup_callback (const char * target , void * userData , EM_BOOL useCapture , em_mouse_callback_func callback );
217
+ extern EMSCRIPTEN_RESULT emscripten_set_dblclick_callback (const char * target , void * userData , EM_BOOL useCapture , em_mouse_callback_func callback );
218
+ extern EMSCRIPTEN_RESULT emscripten_set_mousemove_callback (const char * target , void * userData , EM_BOOL useCapture , em_mouse_callback_func callback );
217
219
/*
218
220
* Returns the most recently received mouse event state. Note that for this function call to succeed, emscripten_set_xx_callback must have first
219
221
* been called with one of the mouse event types and a non-zero callback function pointer to enable the Mouse state capture.
@@ -243,7 +245,8 @@ typedef struct EmscriptenWheelEvent {
243
245
* Registers a callback function for receiving browser-generated mouse wheel events.
244
246
* See http://www.w3.org/TR/DOM-Level-3-Events/#event-type-wheel
245
247
*/
246
- extern EMSCRIPTEN_RESULT emscripten_set_wheel_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenWheelEvent * wheelEvent , void * userData ));
248
+ typedef EM_BOOL (* em_wheel_callback_func )(int eventType , const EmscriptenWheelEvent * keyEvent , void * userData );
249
+ extern EMSCRIPTEN_RESULT emscripten_set_wheel_callback (const char * target , void * userData , EM_BOOL useCapture , em_wheel_callback_func callback );
247
250
248
251
/*
249
252
* The event structure passed in DOM element resize and scroll events.
@@ -273,8 +276,9 @@ typedef struct EmscriptenUiEvent {
273
276
* requires that the Window object sends resize events. It is valid to register a resize callback to other DOM elements,
274
277
* but the browser is not required to fire resize events on them.
275
278
*/
276
- extern EMSCRIPTEN_RESULT emscripten_set_resize_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenUiEvent * uiEvent , void * userData ));
277
- extern EMSCRIPTEN_RESULT emscripten_set_scroll_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenUiEvent * uiEvent , void * userData ));
279
+ typedef EM_BOOL (* em_ui_callback_func )(int eventType , const EmscriptenUiEvent * keyEvent , void * userData );
280
+ extern EMSCRIPTEN_RESULT emscripten_set_resize_callback (const char * target , void * userData , EM_BOOL useCapture , em_ui_callback_func callback );
281
+ extern EMSCRIPTEN_RESULT emscripten_set_scroll_callback (const char * target , void * userData , EM_BOOL useCapture , em_ui_callback_func callback );
278
282
279
283
/*
280
284
* The event structure passed in DOM element blur, focus, focusin and focusout events.
@@ -291,10 +295,11 @@ typedef struct EmscriptenFocusEvent {
291
295
* Registers a callback function for receiving DOM element blur, focus, focusin and focusout events.
292
296
* See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-blur
293
297
*/
294
- extern EMSCRIPTEN_RESULT emscripten_set_blur_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenFocusEvent * focusEvent , void * userData ));
295
- extern EMSCRIPTEN_RESULT emscripten_set_focus_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenFocusEvent * focusEvent , void * userData ));
296
- extern EMSCRIPTEN_RESULT emscripten_set_focusin_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenFocusEvent * focusEvent , void * userData ));
297
- extern EMSCRIPTEN_RESULT emscripten_set_focusout_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenFocusEvent * focusEvent , void * userData ));
298
+ typedef EM_BOOL (* em_focus_callback_func )(int eventType , const EmscriptenFocusEvent * keyEvent , void * userData );
299
+ extern EMSCRIPTEN_RESULT emscripten_set_blur_callback (const char * target , void * userData , EM_BOOL useCapture , em_focus_callback_func callback );
300
+ extern EMSCRIPTEN_RESULT emscripten_set_focus_callback (const char * target , void * userData , EM_BOOL useCapture , em_focus_callback_func callback );
301
+ extern EMSCRIPTEN_RESULT emscripten_set_focusin_callback (const char * target , void * userData , EM_BOOL useCapture , em_focus_callback_func callback );
302
+ extern EMSCRIPTEN_RESULT emscripten_set_focusout_callback (const char * target , void * userData , EM_BOOL useCapture , em_focus_callback_func callback );
298
303
299
304
/*
300
305
* The event structure passed in the deviceorientation event.
@@ -315,7 +320,8 @@ typedef struct EmscriptenDeviceOrientationEvent {
315
320
* Registers a callback function for receiving the deviceorientation event.
316
321
* See http://dev.w3.org/geo/api/spec-source-orientation.html
317
322
*/
318
- extern EMSCRIPTEN_RESULT emscripten_set_deviceorientation_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenDeviceOrientationEvent * orientationEvent , void * userData ));
323
+ typedef EM_BOOL (* em_deviceorientation_callback_func )(int eventType , const EmscriptenDeviceOrientationEvent * keyEvent , void * userData );
324
+ extern EMSCRIPTEN_RESULT emscripten_set_deviceorientation_callback (void * userData , EM_BOOL useCapture , em_deviceorientation_callback_func callback );
319
325
/*
320
326
* Returns the most recently received deviceorientation event state. Note that for this function call to succeed, emscripten_set_deviceorientation_callback
321
327
* 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.
@@ -347,7 +353,8 @@ typedef struct EmscriptenDeviceMotionEvent {
347
353
* Registers a callback function for receiving the devicemotion event.
348
354
* See http://dev.w3.org/geo/api/spec-source-orientation.html
349
355
*/
350
- extern EMSCRIPTEN_RESULT emscripten_set_devicemotion_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenDeviceMotionEvent * motionEvent , void * userData ));
356
+ typedef EM_BOOL (* em_devicemotion_callback_func )(int eventType , const EmscriptenDeviceMotionEvent * keyEvent , void * userData );
357
+ extern EMSCRIPTEN_RESULT emscripten_set_devicemotion_callback (void * userData , EM_BOOL useCapture , em_devicemotion_callback_func callback );
351
358
/*
352
359
* Returns the most recently received deviceomotion event state. Note that for this function call to succeed, emscripten_set_devicemotion_callback
353
360
* 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.
@@ -375,7 +382,8 @@ typedef struct EmscriptenOrientationChangeEvent {
375
382
* Registers a callback function for receiving the orientationchange event.
376
383
* https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html
377
384
*/
378
- extern EMSCRIPTEN_RESULT emscripten_set_orientationchange_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenOrientationChangeEvent * orientationChangeEvent , void * userData ));
385
+ typedef EM_BOOL (* em_orientationchange_callback_func )(int eventType , const EmscriptenOrientationChangeEvent * keyEvent , void * userData );
386
+ extern EMSCRIPTEN_RESULT emscripten_set_orientationchange_callback (void * userData , EM_BOOL useCapture , em_orientationchange_callback_func callback );
379
387
/*
380
388
* Returns the current device orientation state.
381
389
*/
@@ -416,7 +424,8 @@ typedef struct EmscriptenFullscreenChangeEvent {
416
424
* Registers a callback function for receiving the fullscreenchange event.
417
425
* https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html
418
426
*/
419
- extern EMSCRIPTEN_RESULT emscripten_set_fullscreenchange_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenFullscreenChangeEvent * fullscreenChangeEvent , void * userData ));
427
+ typedef EM_BOOL (* em_fullscreenchange_callback_func )(int eventType , const EmscriptenFullscreenChangeEvent * keyEvent , void * userData );
428
+ extern EMSCRIPTEN_RESULT emscripten_set_fullscreenchange_callback (const char * target , void * userData , EM_BOOL useCapture , em_fullscreenchange_callback_func callback );
420
429
/*
421
430
* Returns the current page fullscreen state.
422
431
*/
@@ -452,7 +461,8 @@ typedef struct EmscriptenPointerlockChangeEvent {
452
461
* Pointer lock hides the mouse cursor and exclusively gives the target element relative mouse movement events via the mousemove event.
453
462
* http://www.w3.org/TR/pointerlock/
454
463
*/
455
- extern EMSCRIPTEN_RESULT emscripten_set_pointerlockchange_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenPointerlockChangeEvent * pointerlockChangeEvent , void * userData ));
464
+ typedef EM_BOOL (* em_pointerlockchange_callback_func )(int eventType , const EmscriptenPointerlockChangeEvent * keyEvent , void * userData );
465
+ extern EMSCRIPTEN_RESULT emscripten_set_pointerlockchange_callback (const char * target , void * userData , EM_BOOL useCapture , em_pointerlockchange_callback_func callback );
456
466
/*
457
467
* Returns the current page pointerlock state.
458
468
*/
@@ -490,7 +500,8 @@ typedef struct EmscriptenVisibilityChangeEvent {
490
500
* Registers a callback function for receiving the visibilitychange event.
491
501
* http://www.w3.org/TR/page-visibility/
492
502
*/
493
- extern EMSCRIPTEN_RESULT emscripten_set_visibilitychange_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenVisibilityChangeEvent * visibilityChangeEvent , void * userData ));
503
+ typedef EM_BOOL (* em_visibilitychange_callback_func )(int eventType , const EmscriptenVisibilityChangeEvent * keyEvent , void * userData );
504
+ extern EMSCRIPTEN_RESULT emscripten_set_visibilitychange_callback (void * userData , EM_BOOL useCapture , em_visibilitychange_callback_func callback );
494
505
/*
495
506
* Returns the current page visibility state.
496
507
*/
@@ -542,10 +553,11 @@ typedef struct EmscriptenTouchEvent {
542
553
* Registers a callback function for receiving the touchstart, touchend, touchmove and touchcancel events.
543
554
* http://www.w3.org/TR/touch-events/
544
555
*/
545
- extern EMSCRIPTEN_RESULT emscripten_set_touchstart_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenTouchEvent * touchEvent , void * userData ));
546
- extern EMSCRIPTEN_RESULT emscripten_set_touchend_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenTouchEvent * touchEvent , void * userData ));
547
- extern EMSCRIPTEN_RESULT emscripten_set_touchmove_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenTouchEvent * touchEvent , void * userData ));
548
- extern EMSCRIPTEN_RESULT emscripten_set_touchcancel_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenTouchEvent * touchEvent , void * userData ));
556
+ typedef EM_BOOL (* em_touch_callback_func )(int eventType , const EmscriptenTouchEvent * keyEvent , void * userData );
557
+ extern EMSCRIPTEN_RESULT emscripten_set_touchstart_callback (const char * target , void * userData , EM_BOOL useCapture , em_touch_callback_func callback );
558
+ extern EMSCRIPTEN_RESULT emscripten_set_touchend_callback (const char * target , void * userData , EM_BOOL useCapture , em_touch_callback_func callback );
559
+ extern EMSCRIPTEN_RESULT emscripten_set_touchmove_callback (const char * target , void * userData , EM_BOOL useCapture , em_touch_callback_func callback );
560
+ extern EMSCRIPTEN_RESULT emscripten_set_touchcancel_callback (const char * target , void * userData , EM_BOOL useCapture , em_touch_callback_func callback );
549
561
550
562
/*
551
563
* Represents the current snapshot state of a gamepad.
@@ -578,8 +590,9 @@ typedef struct EmscriptenGamepadEvent {
578
590
* Registers a callback function for receiving the gamepadconnected and gamepaddisconnected events.
579
591
* http://www.w3.org/TR/gamepad/
580
592
*/
581
- extern EMSCRIPTEN_RESULT emscripten_set_gamepadconnected_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenGamepadEvent * gamepadEvent , void * userData ));
582
- extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback (void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const EmscriptenGamepadEvent * gamepadEvent , void * userData ));
593
+ typedef EM_BOOL (* em_gamepad_callback_func )(int eventType , const EmscriptenGamepadEvent * keyEvent , void * userData );
594
+ extern EMSCRIPTEN_RESULT emscripten_set_gamepadconnected_callback (void * userData , EM_BOOL useCapture , em_gamepad_callback_func callback );
595
+ extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback (void * userData , EM_BOOL useCapture , em_gamepad_callback_func callback );
583
596
584
597
/*
585
598
* Returns the number of gamepads connected to the system or EMSCRIPTEN_RESULT_NOT_SUPPORTED if the current browser does not support gamepads.
@@ -606,8 +619,9 @@ typedef struct EmscriptenBatteryEvent {
606
619
* Registers a callback function for receiving the battery chargingchange and levelchange events.
607
620
* http://www.w3.org/TR/battery-status/
608
621
*/
609
- extern EMSCRIPTEN_RESULT emscripten_set_batterychargingchange_callback (void * userData , EM_BOOL (* func )(int eventType , const EmscriptenBatteryEvent * batteryEvent , void * userData ));
610
- extern EMSCRIPTEN_RESULT emscripten_set_batterylevelchange_callback (void * userData , EM_BOOL (* func )(int eventType , const EmscriptenBatteryEvent * batteryEvent , void * userData ));
622
+ typedef EM_BOOL (* em_battery_callback_func )(int eventType , const EmscriptenBatteryEvent * keyEvent , void * userData );
623
+ extern EMSCRIPTEN_RESULT emscripten_set_batterychargingchange_callback (void * userData , em_battery_callback_func callback );
624
+ extern EMSCRIPTEN_RESULT emscripten_set_batterylevelchange_callback (void * userData , em_battery_callback_func callback );
611
625
/*
612
626
* Returns the current battery status.
613
627
*/
@@ -631,14 +645,16 @@ extern EMSCRIPTEN_RESULT emscripten_vibrate_pattern(int *msecsArray, int numEntr
631
645
* Hook onto this event to perform process right prior to page close, and/or display a confirmation notification asking if the user really wants to leave the page.
632
646
* http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#beforeunloadevent
633
647
*/
634
- extern EMSCRIPTEN_RESULT emscripten_set_beforeunload_callback (void * userData , const char * (* func )(int eventType , const void * reserved , void * userData ));
648
+ typedef const char * (* em_beforeunload_callback )(int eventType , const void * reserved , void * userData );
649
+ extern EMSCRIPTEN_RESULT emscripten_set_beforeunload_callback (void * userData , em_beforeunload_callback callback );
635
650
636
651
/*
637
652
* Registers a callback function for the canvas webgl context webglcontextlost and webglcontextrestored events.
638
653
* See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
639
654
*/
640
- extern EMSCRIPTEN_RESULT emscripten_set_webglcontextlost_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const void * reserved , void * userData ));
641
- extern EMSCRIPTEN_RESULT emscripten_set_webglcontextrestored_callback (const char * target , void * userData , EM_BOOL useCapture , EM_BOOL (* func )(int eventType , const void * reserved , void * userData ));
655
+ typedef EM_BOOL (* em_webgl_context_callback )(int eventType , const void * reserved , void * userData );
656
+ extern EMSCRIPTEN_RESULT emscripten_set_webglcontextlost_callback (const char * target , void * userData , EM_BOOL useCapture , em_webgl_context_callback callback );
657
+ extern EMSCRIPTEN_RESULT emscripten_set_webglcontextrestored_callback (const char * target , void * userData , EM_BOOL useCapture , em_webgl_context_callback callback );
642
658
643
659
/*
644
660
* Queries the given canvas element for whether its WebGL context is in a lost state.
0 commit comments