Commit graph

30 commits

Author SHA1 Message Date
Kirill Chibisov cf77f82ae3
Update remaining actions to v3
This somehow was left unnoticed.
2023-06-03 17:00:55 +03:00
Markus Røyset 918430979f
Overhaul the Keyboard API
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.
2023-05-28 21:02:59 +03:00
Kirill Chibisov 8a0edde5c8
Bump github actions to v3 2023-05-14 20:35:58 +03:00
Kirill Chibisov 2496098890
Update wayland-rs to 0.30.0
This update rewrites the winit's Wayland backend using new wayland-rs
0.30 API. This fixes long standing issue with the forward compatibility
of the wayland backend, meaning that future updates to the wayland
protocol won't break rust code anymore. like it was before when adding
new shm/enum variants into the protocol.

Fixes #2560.
Fixes #2164.
Fixes #2128.
Fixes #1760.
Fixes #725.
2023-04-19 00:56:29 +03:00
Emil Ernerfeldt fbea75d31f
Add cargo-deny check to CI 2023-03-16 23:05:41 +03:00
Kirill Chibisov b18295a1ce
Bump MSRV to 1.64 2023-03-08 19:34:10 +03:00
Jeremy Soller 66ca445caa
Redox OS support (#2588)
* Add Redox OS support

* Simplify control flow usage

* Apply more recommendations

* Update naming to indicate that Orbital is a platform

* Adjust import order
2023-01-05 06:58:08 -07:00
Marijn Suijten ba4bf03675
ci: Specify to build winit package when invoking cargo-apk (#2561)
* ci: Don't use `$CMD` for Android doc building

Since migrating `cargo-apk` to `clap` [it is now annoying] to pass
unknown arguments to an underlying `cargo` command (like `cargo doc`):
fortunately generating docs doesn't need to go through `cargo apk` to
set up cross-compiler/linker environment variables at all.

[it is now annoying]: https://github.com/rust-windowing/android-ndk-rs/pull/363

* ci: Simplify

* ci: Explicitly build just the `winit` package on Android

Since https://github.com/dvc94ch/cargo-subcommand/pull/23 `cargo-apk`
now strictly searches for workspaces first before committing to finding
the right package _within said workspace_, and bails when no package was
selected since we don't support selecting (building, packaging, running)
>1 target currently.

Perhaps it's a bit hash to enforce this on free-form `cargo apk --`
invocations, but it is what it is.
2022-11-24 21:49:47 +01:00
Mads Marquart ce6c6e8c95
Only build, but don't run tests in MSRV CI (#2558)
* Only build, but don't run tests in MSRV CI

Since the MSRV of development dependencies can easily be bumped without it affecting the MSRV of the published version of `winit`

* Run clippy on stable Rust instead of MSRV Rust

clippy inspects the `rust-version` field, and only suggests changes that conform to that.
2022-11-23 13:07:58 +01:00
Robert Bragg 05484c5888
Android: rework backend to use android-activity crate (#2444)
This updates the Android backend to use the android-activity crate instead
of ndk-glue. This solves a few issues:
1. The backend is agnostic of the application's choice of Activity base
   class
2. Winit is no longer responsible for handling any Java synchronization
   details, since these are encapsulated by the design of
   android_activity
3. The backend no longer depends on global / static getters for state
   such as the native_window() which puts it in a better position to
   support running multiple activities within a single Android process.
4. Redraw requests are flagged, not queued, in a way that avoids taking
   priority over user events (resolves #2299)

To make it possible for application crates to avoid explicitly
depending on the `android-activity` crate (and avoid version conflicts)
this re-exports the android-activity crate under:

  `winit::platform::android::activity::*`

This also adds `android-native-activity` and `android-game-activity`
features that set the corresponding android-activity features.

Addresses: PR https://github.com/rust-windowing/winit/pull/1892
Addresses: PR https://github.com/rust-windowing/winit/pull/2307
Addresses: PR https://github.com/rust-windowing/winit/pull/2343

Addresses: #2293
Resolves: #2299

Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>

Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
2022-11-10 17:55:19 +01:00
Marijn Suijten 05dd31b8ea
Revert "ci: manually point ANDROID_NDK_ROOT to latest supplied version"
This reverts commit 4895a29e92.

GitHub Actions' runner-images readded this environment variable on my
request [1] as it wasn't strictly related to the deprecated and removed
`ndk-bundle` NDK release.  Back out of the workaround to keep CI scripts
tidy.

[1]: https://github.com/actions/runner-images/issues/5879#issuecomment-1197811704
2022-09-06 16:48:28 +03:00
Mads Marquart e0018d0710
Bump MSRV to 1.60 (#2453) 2022-09-02 10:59:05 +02:00
daxpedda f9b41fd819
Update sctk-adwaita to use ab_glyph
The crossfont will still be available under the option.
2022-08-24 15:24:29 +03:00
Kirill Chibisov fa83bace12
Remove redundant steps from CI
Tests are already building the entire crate, so no need for a
separate builds slowing down the CI.
2022-08-11 19:31:11 +04:00
Kirill Chibisov bf537009d9
Explicitly specify minimum supported rust version
This should help with distributing apps using winit.

Fixes #1075.
2022-07-29 14:39:41 +03:00
Marijn Suijten 4895a29e92
ci: manually point ANDROID_NDK_ROOT to latest supplied version
It seems the symlink to `ndk-bundle` and this environment variable
pointing to it have been removed to prevent the sdkmanager from failing,
when finding the SDK setup to be in an "indeterminate" state.  It is now
up to the users themselves to install an NDK through that tool or point
the right variables to a preinstalled "latest" NDK.

https://github.com/actions/virtual-environments/issues/2689
https://github.com/actions/virtual-environments/pull/5926
2022-07-26 19:55:06 +03:00
Marijn Suijten 2b414cd825
ci: Disallow warnings in rustdoc and test private items (#2341)
Make sure `cargo doc` runs cleanly without any warnings in the CI - some
recently introduced but still allowing a PR to get merged.

In case someone wishes to add docs on private items, make sure those
adhere to the same standards.
2022-06-17 14:19:09 +02:00
Mads Marquart c532d910c0
Build docs on docs.rs for iOS and Android as well (#2324) 2022-06-11 00:45:24 +02:00
Kirill Chibisov 10419ff441
Run clippy on CI
Fixes #1402.
2022-06-10 13:43:33 +03:00
Bartłomiej Maryńczak 829a140d9b
On Wayland, provide option for better CSD
While most compositors provide server side decorations, the GNOME
does not, and won't provide them. Also Wayland clients must render
client side decorations.

Winit was already drawing some decorations, however they were bad
looking and provided no text rendering, so the title was missing.
However this commit makes use of the SCTK external frame similar to
GTK's Adwaita theme supporting text rendering and looking similar to
other GTK applications.

Fixes #1967.
2022-05-20 03:09:23 +03:00
Mads Marquart a033b25ecb
Make CI run on changes to non-code files as well (#2130)
The repository is configured such that specific checks are required to pass before merging; since CI doesn't run on PRs that don't change code, they can't be merged without administrator intervention.

Also, while this definition is currently correct, we might in the future change something so that changes to other files (like markdown files) really should be run through CI.

And example of that could be:
```rust
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
extern "C" {}
```
2022-01-05 15:01:17 +01:00
Philippe Renon 18a61f1058
Fix warnings (#2076)
* examples: Fix unused `Result` that must be used when initializing console_log

* examples: Fix unused imports

* Fix unread name field warning in linux x11 ime InputMethod struct

* Fix unread name field warning in linux x11 Device struct

* Ignore unread field warning in macos/ios MonitorHandle struct

* ci: Add `--deny warnings` to `RUSTFLAGS`
2021-12-11 03:02:48 +01:00
Kirill Chibisov ed698f2462
On Wayland, add wayland-dlopen feature to use dlopen
While winit was always using dlopen for opening system libs, it
provides a way now to disable dlopen feature helping with linking
on some targets.

Fixes #2037.
2021-10-31 17:06:00 +03:00
Markus Siglreithmaier 5f24c40d05
Fix wasm CI failure (#2024)
* Fix wasm ci

* remove cargo-web step
2021-10-26 11:05:01 -07:00
Markus Røyset 657b4fd59e
Remove support for stdweb (#1941)
* Remove support for `stdweb`

* Expunge `stdweb`; make `web-sys` the default

* Mark this change as a breaking change

* Re-insert accidental removal of space

* Use the correct cargo feature syntax

* Re-add some `cfg` attributes

* Remove `web-sys` feature from CI
2021-05-24 10:06:21 -07:00
Murarth 4b1b314ce2
Test x11 and wayland features on CI 2020-06-15 22:49:09 +03:00
Jasper De Sutter b8828105cf
add android NDK event loop (#1556)
* add android NDK event loop

* add Android build documentation & cargo-apk to CI

Co-authored-by: David Craven <david@craven.ch>
2020-05-06 15:27:49 +02:00
Murarth 2b14ec23d5
Fix GitHub Actions (#1479)
* Replaces `actions/checkout@v1` with `actions/checkout@v2` to get a bug fix
2020-02-25 09:10:31 -07:00
Murarth 2f8aa5c52a
Remove armv7-apple-ios target from CI (#1433) 2020-02-03 17:42:52 -07:00
Osspial 2da24089de
Replace Appveyor and Travis with Github Actions (#1309)
* Experiment with github actions

* Only use stable for testing simplicity

* Disable fail-fast

* Never fail when rustup target add fails

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Split formatting check into separate job

* Update and rename rust.yml to ci.yml

* Attempt to add web support

* Fix things

* Fixings

* The "I'm not familiar with YAML" update

* The empty string update

* Fix target interpolation

* Add gcc-multilib on linux x86

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Use correct host on Windows GNU

* Update ci.yml

* Update ci.yml

* in my defense it was like 2 AM when I wrote this

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* try caching

* Update ci.yml

* Update ci.yml

* Update on

* Update ci.yml

* Update ci.yml

* Remove travis and appveyor testing

* Cache entire cargo folder

* Make cargo cache key more appropriately named

* Reduce key collisions

* Make key work

* Add publish workflow and path qualifiers

* Remove -f in cargo install cargo-web

* continue-on-error for cargo web

* ping

* Try to shorten matrix

* attempt two

* attempt three

* attempt four

* Use bash

* web feature formatting

* ping
2020-01-05 14:13:05 -05:00