diff --git a/src/library_browser.js b/src/library_browser.js index 4e25d9d05..eb7f02930 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -208,6 +208,18 @@ mergeInto(LibraryManager.library, { } else { Browser.requestAnimationFrame(asyncCall); } + }, + + emscripten_hide_mouse: function() { + var styleSheet = document.styleSheets[0]; + var rules = styleSheet.cssRules; + for (var i = 0; i < rules.length; i++) { + if (rules[i].cssText.substr(0, 5) == 'canvas') { + styleSheet.deleteRule(i); + i--; + } + } + styleSheet.insertRule('canvas.emscripten { border: 1px solid black; cursor: none; }', 0); } }); diff --git a/system/include/emscripten.h b/system/include/emscripten.h index fdccfe828..a4f158689 100644 --- a/system/include/emscripten.h +++ b/system/include/emscripten.h @@ -56,6 +56,14 @@ void emscripten_async_call(void (*func)(), int millis) { } #endif +/* + * Hide the OS mouse cursor over the canvas. Note that SDL's + * SDL_ShowCursor command shows and hides the SDL cursor, not + * the OS one. This command is useful to hide the OS cursor + * if your app draws its own cursor. + */ +void emscripten_hide_mouse(); + /* * This macro-looking function will cause Emscripten to * generate a comment in the generated code.