Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly, '1.70.0']
toolchain: [stable, nightly, '1.86']
platform:
# Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml!
- { name: 'Windows 64bit MSVC', target: x86_64-pc-windows-msvc, os: windows-latest, }
Expand All @@ -61,10 +61,10 @@ jobs:
- { name: 'web', target: wasm32-unknown-unknown, os: ubuntu-latest, }
exclude:
# Android is tested on stable-3
- toolchain: '1.70.0'
- toolchain: '1.86'
platform: { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' }
include:
- toolchain: '1.70.0'
- toolchain: '1.86'
platform: { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' }
- toolchain: 'nightly'
platform: {
Expand Down Expand Up @@ -107,17 +107,7 @@ jobs:

- name: Generate lockfile
# Also updates the crates.io index
run: |
cargo generate-lockfile
cargo update -p ahash --precise 0.8.7
cargo update -p bumpalo --precise 3.14.0
cargo update -p softbuffer --precise 0.4.0
cargo update -p objc2-encode --precise 4.0.3
cargo update -p orbclient --precise 0.3.47
cargo update -p image --precise 0.25.0
cargo update -p gethostname@1.1.0 --precise 1.0.2
cargo update -p unicode-ident --precise 1.0.10
cargo update -p syn --precise 2.0.114
run: cargo generate-lockfile

- name: Install GCC Multilib
if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')
Expand Down Expand Up @@ -159,13 +149,13 @@ jobs:
- name: Test dpi crate
if: >
contains(matrix.platform.name, 'Linux 64bit') &&
matrix.toolchain != '1.70.0'
matrix.toolchain != '1.86'
run: cargo test -p dpi

- name: Build tests
if: >
!contains(matrix.platform.target, 'redox') &&
matrix.toolchain != '1.70.0'
matrix.toolchain != '1.86'
run: cargo $CMD test --no-run $OPTIONS

- name: Run tests
Expand All @@ -174,7 +164,7 @@ jobs:
!contains(matrix.platform.target, 'ios') &&
!contains(matrix.platform.target, 'wasm32') &&
!contains(matrix.platform.target, 'redox') &&
matrix.toolchain != '1.70.0'
matrix.toolchain != '1.86'
run: cargo $CMD test $OPTIONS

- name: Lint with clippy
Expand All @@ -184,7 +174,7 @@ jobs:
- name: Build tests with serde enabled
if: >
!contains(matrix.platform.target, 'redox') &&
matrix.toolchain != '1.70.0'
matrix.toolchain != '1.86'
run: cargo $CMD test --no-run $OPTIONS --features serde

- name: Run tests with serde enabled
Expand All @@ -193,7 +183,7 @@ jobs:
!contains(matrix.platform.target, 'ios') &&
!contains(matrix.platform.target, 'wasm32') &&
!contains(matrix.platform.target, 'redox') &&
matrix.toolchain != '1.70.0'
matrix.toolchain != '1.86'
run: cargo $CMD test $OPTIONS --features serde

- name: Check docs.rs documentation
Expand Down
15 changes: 15 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ targets = [
{ triple = "x86_64-unknown-redox" },
]

[advisories]
ignore = [
{ id = "RUSTSEC-2026-0192", reason = "ttf-parser is pulled in via sctk-adwaita; no safe upgrade is available" },
]

[licenses]
allow = [
"Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
Expand All @@ -42,6 +47,11 @@ skip = [
{ crate = "bitflags@1", reason = "the ecosystem is in the process of migrating" },
{ crate = "rustix@0.38", reason = "the ecosystem is in the process of migrating" },
{ crate = "linux-raw-sys@0.4", reason = "the ecosystem is in the process of migrating" },
{ crate = "syn@2", reason = "the ecosystem is in the process of migrating" },
{ crate = "jni-sys@0.3", reason = "the ecosystem is in the process of migrating" },
{ crate = "redox_syscall@0.4", reason = "the ecosystem is in the process of migrating" },
{ crate = "thiserror@1", reason = "the ecosystem is in the process of migrating" },
{ crate = "thiserror-impl@1", reason = "the ecosystem is in the process of migrating" },
]
wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed

Expand All @@ -50,11 +60,16 @@ include-archives = true
interpreted = "deny"

[[bans.build.bypass]]
allow-globs = ["android-games-sdk/*.sh"]
allow = [
{ path = "generate-bindings.sh", checksum = "268ec23248218d779e33853cdc60e2985e70214ff004716cd734270de1f6b561" },
]
crate = "android-activity"

[[bans.build.bypass]]
allow-globs = ["etc/*.py"]
crate = "libc"

[[bans.build.bypass]]
allow-globs = ["ci/*", "githooks/*", "cargo.sh"]
crate = "zerocopy"
Expand Down
10 changes: 5 additions & 5 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,21 +548,21 @@ pub enum KeyCode {
NumpadMemoryStore,
/// <kbd>M</kbd> Subtract current entry from the value stored in memory.
NumpadMemorySubtract,
/// <kbd>*</kbd> on a keyboard. For use with numpads that provide mathematical
/// operations (<kbd>+</kbd>, <kbd>-</kbd> <kbd>*</kbd> and <kbd>/</kbd>).
/// <kbd>\*</kbd> on a keyboard. For use with numpads that provide mathematical
/// operations (<kbd>+</kbd>, <kbd>-</kbd> <kbd>\*</kbd> and <kbd>/</kbd>).
///
/// Use `NumpadStar` for the <kbd>*</kbd> key on phones and remote controls.
/// Use `NumpadStar` for the <kbd>\*</kbd> key on phones and remote controls.
NumpadMultiply,
/// <kbd>(</kbd> Found on the Microsoft Natural Keyboard.
NumpadParenLeft,
/// <kbd>)</kbd> Found on the Microsoft Natural Keyboard.
NumpadParenRight,
/// <kbd>*</kbd> on a phone or remote control device.
/// <kbd>\*</kbd> on a phone or remote control device.
///
/// This key is typically found below the <kbd>7</kbd> key and to the left of
/// the <kbd>0</kbd> key.
///
/// Use <kbd>"NumpadMultiply"</kbd> for the <kbd>*</kbd> key on
/// Use <kbd>"NumpadMultiply"</kbd> for the <kbd>\*</kbd> key on
/// numeric keypads.
NumpadStar,
/// <kbd>-</kbd>
Expand Down
6 changes: 3 additions & 3 deletions src/platform_impl/linux/common/xkb/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ pub struct XkbComposeTable {
impl XkbComposeTable {
pub fn new(context: &XkbContext) -> Option<Self> {
let locale = env::var_os("LC_ALL")
.and_then(|v| if v.is_empty() { None } else { Some(v) })
.filter(|v| !v.is_empty())
.or_else(|| env::var_os("LC_CTYPE"))
.and_then(|v| if v.is_empty() { None } else { Some(v) })
.filter(|v| !v.is_empty())
.or_else(|| env::var_os("LANG"))
.and_then(|v| if v.is_empty() { None } else { Some(v) })
.filter(|v| !v.is_empty())
.unwrap_or_else(|| "C".into());
let locale = CString::new(locale.into_vec()).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/linux/x11/event_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ impl EventProcessor {
.find(|prev_monitor| prev_monitor.name == new_monitor.name)
.map(|prev_monitor| prev_monitor.scale_factor);
if Some(new_monitor.scale_factor) != maybe_prev_scale_factor {
for window in wt.windows.borrow().iter().filter_map(|(_, w)| w.upgrade()) {
for window in wt.windows.borrow().values().filter_map(|w| w.upgrade()) {
window.refresh_dpi_for_monitor(&new_monitor, maybe_prev_scale_factor, |event| {
callback(&self.target, event);
})
Expand Down
6 changes: 6 additions & 0 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,9 @@ unsafe fn gain_active_focus(window: HWND, userdata: &WindowData) {

update_modifiers(window, userdata);

// Reapply the cursor clip released on focus loss.
userdata.window_state_lock().mouse.set_cursor_flags(window, |_| ()).ok();

userdata.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(window)),
event: Focused(true),
Expand All @@ -1042,6 +1045,9 @@ unsafe fn lose_active_focus(window: HWND, userdata: &WindowData) {
event: ModifiersChanged(ModifiersState::empty().into()),
});

// Release the cursor clip, which Windows keeps active even after focus loss.
userdata.window_state_lock().mouse.set_cursor_flags(window, |_| ()).ok();

userdata.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(window)),
event: Focused(false),
Expand Down
13 changes: 13 additions & 0 deletions src/platform_impl/windows/window_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,19 @@ impl CursorFlags {
if active_cursor_clip != cursor_clip.map(rect_to_tuple) {
util::set_cursor_clip(cursor_clip)?;
}
} else {
// Windows doesn't reset the global `ClipCursor` state on focus loss, so release the
// clip if it's the one this window applied (it lies within the client area).
let rect_to_tuple = |rect: RECT| (rect.left, rect.top, rect.right, rect.bottom);
let active_cursor_clip = util::get_cursor_clip()?;
if rect_to_tuple(active_cursor_clip) != rect_to_tuple(util::get_desktop_rect())
&& active_cursor_clip.left >= client_rect.left
&& active_cursor_clip.top >= client_rect.top
&& active_cursor_clip.right <= client_rect.right
&& active_cursor_clip.bottom <= client_rect.bottom
{
util::set_cursor_clip(None)?;
}
}

let cursor_in_client = self.contains(CursorFlags::IN_WINDOW);
Expand Down
Loading