Overhaul the keyboard API in winit to mimic the W3C specification
to achieve better crossplatform parity. The `KeyboardInput` event
is now uses `KeyEvent` which consists of:
- `physical_key` - a cross platform way to refer to scancodes;
- `logical_key` - keysym value, which shows your key respecting the
layout;
- `text` - the text produced by this keypress;
- `location` - the location of the key on the keyboard;
- `repeat` - whether the key was produced by the repeat.
And also a `platform_specific` field which encapsulates extra
information on desktop platforms, like key without modifiers
and text with all modifiers.
The `Modifiers` were also slightly reworked as in, the information
whether the left or right modifier is pressed is now also exposed
on platforms where it could be queried reliably. The support was
also added for the web and orbital platforms finishing the API
change.
This change made the `OptionAsAlt` API on macOS redundant thus it
was removed all together.
Co-authored-by: Artúr Kovács <kovacs.artur.barnabas@gmail.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: daxpedda <daxpedda@gmail.com>
Fixes: #2631.
Fixes: #2055.
Fixes: #2032.
Fixes: #1904.
Fixes: #1810.
Fixes: #1700.
Fixes: #1443.
Fixes: #1343.
Fixes: #1208.
Fixes: #1151.
Fixes: #812.
Fixes: #600.
Fixes: #361.
Fixes: #343.
151 lines
5.8 KiB
YAML
151 lines
5.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
Check_Formatting:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: stable
|
|
components: rustfmt
|
|
- name: Check Formatting
|
|
run: cargo +stable fmt --all -- --check
|
|
|
|
cargo-deny:
|
|
name: cargo-deny
|
|
|
|
# TODO: remove this matrix when https://github.com/EmbarkStudios/cargo-deny/issues/324 is resolved
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- aarch64-apple-ios
|
|
- aarch64-linux-android
|
|
- i686-pc-windows-gnu
|
|
- i686-pc-windows-msvc
|
|
- i686-unknown-linux-gnu
|
|
- wasm32-unknown-unknown
|
|
- x86_64-apple-darwin
|
|
- x86_64-apple-ios
|
|
- x86_64-pc-windows-gnu
|
|
- x86_64-pc-windows-msvc
|
|
- x86_64-unknown-linux-gnu
|
|
- x86_64-unknown-redox
|
|
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
|
with:
|
|
command: check
|
|
log-level: error
|
|
arguments: --all-features --target ${{ matrix.platform }}
|
|
|
|
tests:
|
|
name: Tests
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
rust_version: ['1.64.0', stable, nightly]
|
|
platform:
|
|
# Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml!
|
|
- { target: x86_64-pc-windows-msvc, os: windows-latest, }
|
|
- { target: i686-pc-windows-msvc, os: windows-latest, }
|
|
- { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu }
|
|
- { target: i686-pc-windows-gnu, os: windows-latest, host: -i686-pc-windows-gnu }
|
|
- { target: i686-unknown-linux-gnu, os: ubuntu-latest, }
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, }
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: x11 }
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: "wayland,wayland-dlopen" }
|
|
- { target: aarch64-linux-android, os: ubuntu-latest, options: -p winit, cmd: 'apk --', features: "android-native-activity" }
|
|
- { target: x86_64-unknown-redox, os: ubuntu-latest, }
|
|
- { target: x86_64-apple-darwin, os: macos-latest, }
|
|
- { target: x86_64-apple-ios, os: macos-latest, }
|
|
- { target: aarch64-apple-ios, os: macos-latest, }
|
|
# We're using Windows rather than Ubuntu to run the wasm tests because caching cargo-web
|
|
# doesn't currently work on Linux.
|
|
- { target: wasm32-unknown-unknown, os: windows-latest, }
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
CARGO_INCREMENTAL: 0
|
|
RUSTFLAGS: "-C debuginfo=0 --deny warnings"
|
|
OPTIONS: ${{ matrix.platform.options }}
|
|
FEATURES: ${{ format(',{0}', matrix.platform.features ) }}
|
|
CMD: ${{ matrix.platform.cmd }}
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
|
|
runs-on: ${{ matrix.platform.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
# Used to cache cargo-web
|
|
- name: Cache cargo folder
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/.cargo
|
|
key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }}
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }}
|
|
targets: ${{ matrix.platform.target }}
|
|
components: clippy
|
|
|
|
- name: Install GCC Multilib
|
|
if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')
|
|
run: sudo apt-get update && sudo apt-get install gcc-multilib
|
|
- name: Install cargo-apk
|
|
if: contains(matrix.platform.target, 'android')
|
|
run: cargo install cargo-apk
|
|
|
|
- name: Check documentation
|
|
shell: bash
|
|
run: cargo doc --no-deps --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES --document-private-items
|
|
|
|
- name: Build crate
|
|
shell: bash
|
|
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
|
|
|
- name: Build tests
|
|
shell: bash
|
|
if: >
|
|
!contains(matrix.platform.target, 'redox') &&
|
|
matrix.rust_version != '1.64.0'
|
|
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
|
|
|
- name: Run tests
|
|
shell: bash
|
|
if: >
|
|
!contains(matrix.platform.target, 'android') &&
|
|
!contains(matrix.platform.target, 'ios') &&
|
|
!contains(matrix.platform.target, 'wasm32') &&
|
|
!contains(matrix.platform.target, 'redox') &&
|
|
matrix.rust_version != '1.64.0'
|
|
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
|
|
|
- name: Lint with clippy
|
|
shell: bash
|
|
if: (matrix.rust_version == 'stable') && !contains(matrix.platform.options, '--no-default-features')
|
|
run: cargo clippy --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings
|
|
|
|
- name: Build tests with serde enabled
|
|
shell: bash
|
|
if: >
|
|
!contains(matrix.platform.target, 'redox') &&
|
|
matrix.rust_version != '1.64.0'
|
|
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
|
|
- name: Run tests with serde enabled
|
|
shell: bash
|
|
if: >
|
|
!contains(matrix.platform.target, 'android') &&
|
|
!contains(matrix.platform.target, 'ios') &&
|
|
!contains(matrix.platform.target, 'wasm32') &&
|
|
!contains(matrix.platform.target, 'redox') &&
|
|
matrix.rust_version != '1.64.0'
|
|
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
|