Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm support #759

Merged
merged 45 commits into from
Apr 15, 2020
Merged

Wasm support #759

merged 45 commits into from
Apr 15, 2020

Commits on Apr 12, 2020

  1. Add wasm backend + fix std::time dep

    A basic wasm backend is added as a continuation of linebender#30.
    Since std::time isn't available on wasm, an additional dependency is
    added to abstract std::time::Instant to work with wasm.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    19c186f View commit details
    Browse the repository at this point in the history
  2. Disable simple logger on wasm

    This commit ensures that all examples run with minimal changes.
    More specifically we don't need to remove the .use_simple_logger() call
    on all Apps.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    30d66ba View commit details
    Browse the repository at this point in the history
  3. Fix resizing in wasm backends

    The resize callback should be registered to the window, since resizing
    the window doesn't call the resize callback for canvases even if those
    do get resized.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    cfb3627 View commit details
    Browse the repository at this point in the history
  4. Added scrolling support + fixed hidpi handling

    The scroll example now works as expected on hi and low dpi screens.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    fbce712 View commit details
    Browse the repository at this point in the history
  5. Use explicit lifetime in StrOrChar

    This makes passing it easier to pass owned strings when creating a new
    KeyEvent, which is necessary when interfacing with WASM.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    999ef45 View commit details
    Browse the repository at this point in the history
  6. Added keyboard support on wasm

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    8ee237f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    659e136 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4658a17 View commit details
    Browse the repository at this point in the history
  9. Format with cargo fmt

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    439b319 View commit details
    Browse the repository at this point in the history
  10. Prevent the browser from going back on backspace

    This should be the default behavior to make text widgets usable.
    At a later iteration it may be better to only disable the browser from
    going back when a widget is selected that is expecting keyboard input
    where backspace is intended for something else.
    
    I expect this functionality would require some way of accessing the
    web_sys event from within a druid callback.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    85f400b View commit details
    Browse the repository at this point in the history
  11. Fix key text + require console_log + adjust style

    This commit addresses comments in the code review:
    
    Key text:
      - web_sys returns the name of each pressed key from which we can
        generate a viable printable string. This mechanism is revised to
        include all non-printable keys as listed in MDN.
      - notably, the tab character and numpad characters have gained
        printable text in this commit.
    
    console_log:
      - console_log is not required in wasm builds.
      - integrated console_log with the use_simple_logger api. `console_log`
        is initialized with log level `trace` as is done in simple logger by
        default.
    
    Style:
      - non std use statements are now before third party use statements.
      - key_to_text function signature refactor
      - specify the log module when calling log::{warn, error} explicitly.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    3316120 View commit details
    Browse the repository at this point in the history
  12. Run rustfmt on stepper.rs

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    e2d8e00 View commit details
    Browse the repository at this point in the history
  13. Fix up console_log dependency

    Moved console_log dependency from druid-shell to druid, since this is
    where it is initialized. This fixes the wasm build.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    204230c View commit details
    Browse the repository at this point in the history
  14. Add wasm build to ci

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    c191012 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    844cbc2 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    a37c3b4 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    2d67cd7 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    481b796 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    9b2a3d8 View commit details
    Browse the repository at this point in the history
  20. Fix windows build for druid-wasm-examples

    This commit creates a symlink to the examples directory on demand.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    fbd6073 View commit details
    Browse the repository at this point in the history
  21. Added simple_logger dep for wasm

    This allows the wasm examples to build even when the target arch is not
    wasm32.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    23424af View commit details
    Browse the repository at this point in the history
  22. Remove invald cfg feature guard

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    510a60a View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    e7e257c View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    cfe5153 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    4b6150d View commit details
    Browse the repository at this point in the history
  26. Fix the build script for wasm examples

    This addresses the CI failures caused by the weird build of the wasm
    examples.
    
    To elaborate:
    In order to include each of the examples in the wasm example, a
    symlink to the examples directory is created in build.rs along with the
    corresponding examples.rs module which declares examples known to work
    with wasm. To satisfy CI, the examples.rs committed to the repo must be
    empty since rustfmt does not call "build.rs".
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    5609e38 View commit details
    Browse the repository at this point in the history
  27. Add .gitignore to wasm examples + fix clippy bugs

    The included .gitignore ignores the generated examples module. The
    examples.rs should remain committed, but it need not be ever changed.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    5ed32cb View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    ad3c7e8 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    d101869 View commit details
    Browse the repository at this point in the history
  30. Fix examples for wasm

    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    8d05b09 View commit details
    Browse the repository at this point in the history
  31. Fix x11 keycodes StrOrChar conversion

    The newly introduced lifetime parameter must be specified exmplicitly.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    ea81ffe View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    78b4631 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    3cd4144 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    1dbb4e9 View commit details
    Browse the repository at this point in the history
  35. Add --no-run to cargo test for wasm targets

    wasm targets cannot be run in the normal way.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    2102f82 View commit details
    Browse the repository at this point in the history
  36. Do not build the unit test module for wasm32

    The tests cannot be run in the normal way anyways. Leaving this for a
    future PR to flush out.
    elrnv committed Apr 12, 2020
    Configuration menu
    Copy the full SHA
    5021017 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    a143692 View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2020

  1. Add warnings for unimplemented file ops in web backend

    This commit exposes the error of the missing implementation for file dialogs in the web backend using log::warn. This is a temporary solution until the `open_file_sync` and `save_as_sync` functions propagate the error downstream using Result instead of Option.
    
    Co-Authored-By: Leopold Luley <[email protected]>
    elrnv and luleyleo authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    e0949ff View commit details
    Browse the repository at this point in the history
  2. Remove windows specific comment from web/window.rs

    Co-Authored-By: Leopold Luley <[email protected]>
    elrnv and luleyleo authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    0df38af View commit details
    Browse the repository at this point in the history
  3. Ignore automatically generated html files in wasm example

    Co-Authored-By: Leopold Luley <[email protected]>
    elrnv and luleyleo authored Apr 13, 2020
    Configuration menu
    Copy the full SHA
    5f64d4b View commit details
    Browse the repository at this point in the history
  4. Remove unused dialog module from web backend

    The types in that module have since made their way into druid itself.
    elrnv committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    ee88c7f View commit details
    Browse the repository at this point in the history
  5. Remove TODO for adding to app state in web backend

    This is most likely not needed.
    elrnv committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    ea79c84 View commit details
    Browse the repository at this point in the history
  6. Rework the generated examples in the wasm example

    This commit attempts a different approach at including the automatically
    generated examples from the parent directory.
    This method satisfies both rustfmt and cargo test as before, but it also
    doesn't modify any files in the source tree, keeping the diff clean
    after a build.
    elrnv committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    e072555 View commit details
    Browse the repository at this point in the history
  7. Update Cargo.lock

    elrnv committed Apr 13, 2020
    Configuration menu
    Copy the full SHA
    d0bc9df View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2020

  1. Rename switch example js entry point for wasm build

    This commit fixes the generated html file for the switch example to load
    "switch_demo" instead of "switch" for the switch example. The word
    switch conflicts with JavaScript's switch statement, which is the reason
    for this awkwardness.
    elrnv committed Apr 14, 2020
    Configuration menu
    Copy the full SHA
    3a528fa View commit details
    Browse the repository at this point in the history