@@ -62,23 +62,23 @@ var LibraryGLFW = {
6262 this . domKeys = new Array ( ) ;
6363 this . shouldClose = 0 ;
6464 this . title = null ;
65- this . windowPosFunc = null ; // GLFWwindowposfun
66- this . windowSizeFunc = null ; // GLFWwindowsizefun
67- this . windowCloseFunc = null ; // GLFWwindowclosefun
68- this . windowRefreshFunc = null ; // GLFWwindowrefreshfun
69- this . windowFocusFunc = null ; // GLFWwindowfocusfun
70- this . windowIconifyFunc = null ; // GLFWwindowiconifyfun
71- this . windowMaximizeFunc = null ; // GLFWwindowmaximizefun
72- this . framebufferSizeFunc = null ; // GLFWframebuffersizefun
73- this . windowContentScaleFunc = null ; // GLFWwindowcontentscalefun
74- this . mouseButtonFunc = null ; // GLFWmousebuttonfun
75- this . cursorPosFunc = null ; // GLFWcursorposfun
76- this . cursorEnterFunc = null ; // GLFWcursorenterfun
77- this . scrollFunc = null ; // GLFWscrollfun
78- this . dropFunc = null ; // GLFWdropfun
79- this . keyFunc = null ; // GLFWkeyfun
80- this . charFunc = null ; // GLFWcharfun
81- this . userptr = null ;
65+ this . windowPosFunc = 0 ; // GLFWwindowposfun
66+ this . windowSizeFunc = 0 ; // GLFWwindowsizefun
67+ this . windowCloseFunc = 0 ; // GLFWwindowclosefun
68+ this . windowRefreshFunc = 0 ; // GLFWwindowrefreshfun
69+ this . windowFocusFunc = 0 ; // GLFWwindowfocusfun
70+ this . windowIconifyFunc = 0 ; // GLFWwindowiconifyfun
71+ this . windowMaximizeFunc = 0 ; // GLFWwindowmaximizefun
72+ this . framebufferSizeFunc = 0 ; // GLFWframebuffersizefun
73+ this . windowContentScaleFunc = 0 ; // GLFWwindowcontentscalefun
74+ this . mouseButtonFunc = 0 ; // GLFWmousebuttonfun
75+ this . cursorPosFunc = 0 ; // GLFWcursorposfun
76+ this . cursorEnterFunc = 0 ; // GLFWcursorenterfun
77+ this . scrollFunc = 0 ; // GLFWscrollfun
78+ this . dropFunc = 0 ; // GLFWdropfun
79+ this . keyFunc = 0 ; // GLFWkeyfun
80+ this . charFunc = 0 ; // GLFWcharfun
81+ this . userptr = 0 ;
8282 } ,
8383
8484 $GLFW__deps : [ 'emscripten_get_now' , '$GL' , '$Browser' , '$GLFW_Window' ,
@@ -94,9 +94,9 @@ var LibraryGLFW = {
9494 return GLFW . windows [ id - 1 ] ;
9595 } ,
9696
97- joystickFunc : null , // GLFWjoystickfun
98- errorFunc : null , // GLFWerrorfun
99- monitorFunc : null , // GLFWmonitorfun
97+ joystickFunc : 0 , // GLFWjoystickfun
98+ errorFunc : 0 , // GLFWerrorfun
99+ monitorFunc : 0 , // GLFWmonitorfun
100100 active : null , // active window
101101 scale : null ,
102102 windows : null ,
@@ -372,7 +372,7 @@ var LibraryGLFW = {
372372 { { { makeDynCall ( 'vii' , 'GLFW.active.charFunc' ) } } } ( charCode , 1 ) ;
373373#endif
374374#if USE_GLFW == 3
375- { { { makeDynCall ( 'vii ' , 'GLFW.active.charFunc' ) } } } ( GLFW . active . id , charCode ) ;
375+ { { { makeDynCall ( 'vpi ' , 'GLFW.active.charFunc' ) } } } ( GLFW . active . id , charCode ) ;
376376#endif
377377 } ,
378378
@@ -394,7 +394,7 @@ var LibraryGLFW = {
394394#endif
395395#if USE_GLFW == 3
396396 if ( repeat ) status = 2 ; // GLFW_REPEAT
397- { { { makeDynCall ( 'viiiii ' , 'GLFW.active.keyFunc' ) } } } ( GLFW . active . id , key , keyCode , status , GLFW . getModBits ( GLFW . active ) ) ;
397+ { { { makeDynCall ( 'vpiiii ' , 'GLFW.active.keyFunc' ) } } } ( GLFW . active . id , key , keyCode , status , GLFW . getModBits ( GLFW . active ) ) ;
398398#endif
399399 }
400400 } ,
@@ -510,7 +510,7 @@ var LibraryGLFW = {
510510 { { { makeDynCall ( 'vii' , 'GLFW.active.mouseButtonFunc' ) } } } ( eventButton , status ) ;
511511#endif
512512#if USE_GLFW == 3
513- { { { makeDynCall ( 'viiii ' , 'GLFW.active.mouseButtonFunc' ) } } } ( GLFW . active . id , eventButton , status , GLFW . getModBits ( GLFW . active ) ) ;
513+ { { { makeDynCall ( 'vpiii ' , 'GLFW.active.mouseButtonFunc' ) } } } ( GLFW . active . id , eventButton , status , GLFW . getModBits ( GLFW . active ) ) ;
514514#endif
515515 }
516516 } ,
@@ -601,7 +601,7 @@ var LibraryGLFW = {
601601 { { { makeDynCall ( 'vii' , 'GLFW.active.windowSizeFunc' ) } } } ( GLFW . active . width , GLFW . active . height ) ;
602602#endif
603603#if USE_GLFW == 3
604- { { { makeDynCall ( 'viii ' , 'GLFW.active.windowSizeFunc' ) } } } ( GLFW . active . id , GLFW . active . width , GLFW . active . height ) ;
604+ { { { makeDynCall ( 'vpii ' , 'GLFW.active.windowSizeFunc' ) } } } ( GLFW . active . id , GLFW . active . width , GLFW . active . height ) ;
605605#endif
606606 }
607607 } ,
@@ -611,7 +611,7 @@ var LibraryGLFW = {
611611
612612#if USE_GLFW == 3
613613 if ( GLFW . active . framebufferSizeFunc ) {
614- { { { makeDynCall ( 'viii ' , 'GLFW.active.framebufferSizeFunc' ) } } } ( GLFW . active . id , GLFW . active . width , GLFW . active . height ) ;
614+ { { { makeDynCall ( 'vpii ' , 'GLFW.active.framebufferSizeFunc' ) } } } ( GLFW . active . id , GLFW . active . width , GLFW . active . height ) ;
615615 }
616616#endif
617617 } ,
@@ -642,8 +642,10 @@ var LibraryGLFW = {
642642 } ,
643643
644644 setJoystickCallback : ( cbfun ) => {
645+ var prevcbfun = GLFW . joystickFunc ;
645646 GLFW . joystickFunc = cbfun ;
646647 GLFW . refreshJoysticks ( ) ;
648+ return prevcbfun ;
647649 } ,
648650
649651 joys : { } , // glfw joystick data
@@ -780,7 +782,7 @@ var LibraryGLFW = {
780782 var data = e . target . result ;
781783 FS . writeFile ( path , new Uint8Array ( data ) ) ;
782784 if ( ++ written === count ) {
783- { { { makeDynCall ( 'viii ' , 'GLFW.active.dropFunc' ) } } } ( GLFW . active . id , count , filenames ) ;
785+ { { { makeDynCall ( 'vpii ' , 'GLFW.active.dropFunc' ) } } } ( GLFW . active . id , count , filenames ) ;
784786
785787 for ( var i = 0 ; i < filenamesArray . length ; ++ i ) {
786788 _free ( filenamesArray [ i ] ) ;
@@ -994,7 +996,7 @@ var LibraryGLFW = {
994996 { { { makeDynCall ( 'vii' , 'win.windowSizeFunc' ) } } } ( width , height ) ;
995997#endif
996998#if USE_GLFW == 3
997- { { { makeDynCall ( 'viii ' , 'win.windowSizeFunc' ) } } } ( win . id , width , height ) ;
999+ { { { makeDynCall ( 'vpii ' , 'win.windowSizeFunc' ) } } } ( win . id , width , height ) ;
9981000#endif
9991001 }
10001002 } ,
@@ -1064,7 +1066,7 @@ var LibraryGLFW = {
10641066
10651067#if USE_GLFW == 3
10661068 if ( win . windowCloseFunc ) {
1067- { { { makeDynCall ( 'vi ' , 'win.windowCloseFunc' ) } } } ( win . id ) ;
1069+ { { { makeDynCall ( 'vp ' , 'win.windowCloseFunc' ) } } } ( win . id ) ;
10681070 }
10691071#endif
10701072
@@ -1220,7 +1222,7 @@ var LibraryGLFW = {
12201222 glfwExtensionSupported__deps : [ 'glGetString' ] ,
12211223 glfwExtensionSupported : ( extension ) => {
12221224 if ( ! GLFW . extensions ) {
1223- GLFW . extensions = UTF8ToString ( _glGetString ( 0x1F03 ) ) . split ( ' ' ) ;
1225+ GLFW . extensions = GLctx . getSupportedExtensions ( ) || [ ] ;
12241226 }
12251227
12261228 if ( GLFW . extensions . includes ( extension ) ) return 1 ;
@@ -1758,7 +1760,7 @@ var LibraryGLFW = {
17581760 } ,
17591761
17601762 glfwCreateThread : ( fun , arg ) => {
1761- { { { makeDynCall ( 'vi ' , 'fun' ) } } } ( arg ) ;
1763+ { { { makeDynCall ( 'vp ' , 'fun' ) } } } ( arg ) ;
17621764 // One single thread
17631765 return 0 ;
17641766 } ,
0 commit comments