* Close windows synchronously on main thread
* Set style mask synchronously on main thread
* Set title synchronously on main thread
* Set visibility and focus synchronously on main thread
* Set window level synchronously on main thread
* Set position and size synchronously on main thread
* Set cursor hittest synchronously on main thread
* Add changelog entry
This fixes a crash on macOS when trying to get the monitor
refresh rate from the disabled monitor.
Co-authored-by: Jet Spark <lixiaopeng.jetspark@bytedance.com>
Co-authored-by: Mads Marquart <mads@marquart.dk>
* On Windows and macOS, add API to enable/disable window controls
* fix build
* missing import
* use `WindowButtons` flags
* rename to `[set_]enabled_buttons`
* add example, fix windows impl for minimize
* macOS: Fix button enabling close/minimize while disabling maximized
* Update src/platform_impl/windows/window.rs
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
* compose the flags on a sep line, use `bool::then`
Co-authored-by: Mads Marquart <mads@marquart.dk>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This adds `Window::set_window_level` to control the preferred
z level of the window.
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: Mads Marquart <mads@marquart.dk>
* 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.
* 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.
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: #2293Resolves: #2299
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com>
Even when the protocol explicitly tells to send proper UTF-8
boundaries for cursor, some IMEs don't do that, so sanity check
them before sending downstream.
* MacOS: set value for `accepts_first_mouse`
* Update CHANGELOG and FEATURES
* Field doesn't need to be public
* Convert `bool` to `BOOL`
* Fix formatting
* Move flag from window state to view instance
* Feedback from PR
* Fix changelog location
Introduced in https://github.com/rust-windowing/winit/pull/2479; turns out the definitions were not entirely equal, the `kCFRunLoopEntry` that we were using previously was defined as `0` while the correct value is `1` (which meant the `unimplemented!()` branch suddenly started triggering)
Use the definitions that `core_foundation` exposes (almost the same, except `CFRunLoopSourceContext::perform` is not nullable, so we account for that as well).
* Remove UnownedWindow::inner_rect
* Refactor custom view to use much less `unsafe`
The compiler fence is safe to get rid of now since `interpretKeyEvents` takes `&mut self`
* Refactor Window to use much less unsafe
* Refactor NSApplication usage to have much less unsafe
* Remove cocoa dependency
* Enable `deny(unsafe_op_in_unsafe_fn)` on macOS
Also re-enable clippy `let_unit_value` lint
* Remove #[macro_use] on macOS
* Refactor window delegate to use much less unsafe