Skip to content

Android: request redraw after surface-affecting events - #4619

Open
brianconnoly wants to merge 2 commits into
rust-windowing:masterfrom
brianconnoly:vss/android-surface-redraw-master
Open

Android: request redraw after surface-affecting events#4619
brianconnoly wants to merge 2 commits into
rust-windowing:masterfrom
brianconnoly:vss/android-surface-redraw-master

Conversation

@brianconnoly

@brianconnoly brianconnoly commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • bind Android resize/redraw delivery to the native surface lifecycle (InitWindow / TerminateWindow) instead of Activity Resume / Pause
  • reset the cached surface size for each new native-surface generation, so the first size is emitted even when it matches the previous surface
  • suppress surface events while no native window exists and discard stale pending redraw work on termination
  • preserve redraw/resize delivery while an existing surface is paused but still present
  • retain the scale-factor comparison fix for ConfigChanged

This keeps lifecycle authority aligned with Android's actual native window. A focused SurfaceLifecycle unit test covers suppression, deduplication, paused-but-visible delivery, termination, and same-size recreation.

Validation

  • git diff --check
  • rustfmt --edition 2024 --check winit-android/src/event_loop.rs
  • cargo check -p winit --target aarch64-linux-android --features android-native-activity
  • cargo check -p winit-android --tests --target aarch64-linux-android --features native-activity
  • full upstream CI matrix passes for commit 04cc1f00

All local Cargo artifacts were written to an external target directory.

@brianconnoly
brianconnoly requested a review from MarijnS95 as a code owner July 8, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant