Skip to content

On Wayland, disable Occluded handling - #3441

Merged
kchibisov merged 1 commit into
rust-windowing:masterfrom
kchibisov:stupid-commit-all-over-the-place
Jan 30, 2024
Merged

kchibisov merged 1 commit into
rust-windowing:masterfrom
kchibisov:stupid-commit-all-over-the-place

Conversation

@kchibisov

Copy link
Copy Markdown
Member

Change in state requires a redraw, however drawing when getting Occluded with vsync will block indefinitely, thus the event in it's current state is rather useless.

To solve this issue winit needs a way to determine whether the user paused/continued their render loop, so it can commit on their behalf.

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@kchibisov
kchibisov force-pushed the stupid-commit-all-over-the-place branch from bfe4a71 to 9d737a8 Compare January 29, 2024 17:20
@kchibisov kchibisov added this to the Version 0.29.11 milestone Jan 29, 2024
Change in state requires a redraw, however drawing when getting
`Occluded` with vsync will block indefinitely, thus the event in
it's current state is rather useless.

To solve this issue winit needs a way to determine whether the user
paused/continued their render loop, so it can commit on their behalf.

This commit also forces redraw when getting configure.
@kchibisov
kchibisov force-pushed the stupid-commit-all-over-the-place branch from 9d737a8 to 626477a Compare January 29, 2024 18:10
@kchibisov
kchibisov merged commit ff73119 into rust-windowing:master Jan 30, 2024
@kchibisov
kchibisov deleted the stupid-commit-all-over-the-place branch January 30, 2024 09:03
crmne added a commit to crmne/winit that referenced this pull request Sep 23, 2026
A compositor sends no frame callbacks to a surface it has suspended, so a
client presenting with vsync blocks in eglSwapBuffers until the window is
shown again. Toolkits built on winit already stop rendering on
`WindowEvent::Occluded(true)`, but winit stopped emitting it on Wayland
in rust-windowing#3441, because every configure also requested a redraw to commit the
acknowledgement, and that redraw blocked.

Emit `Occluded` again when the `suspended` state is added or removed, and
don't request a redraw for a configure that leaves the window suspended.
xdg-shell lets the client acknowledge several configures and commit only
the last, so the first frame after the suspension ends commits it; that
configure requests a redraw as before.

Refs rust-windowing#3442
crmne added a commit to crmne/winit that referenced this pull request Sep 25, 2026
A compositor sends no frame callbacks to a surface it has suspended, so a
client presenting with vsync blocks until the window is shown again. Winit
stopped reporting this state as `WindowEvent::Occluded` in rust-windowing#3441: every
configure also requested a redraw so the acknowledgement would be
committed, and drawing on the configure that suspends the window blocked.

Emit `Occluded` again when the `suspended` state is added or removed, and
add `WindowExtWayland::notify_presentation_paused`, as proposed in rust-windowing#3442.
An application calls it after it has stopped presenting on
`Occluded(true)`. Winit then commits the surface itself for the pending
configure (sctk has already acknowledged it) and for every later configure
while the window stays suspended, instead of asking for a redraw. The
configure that ends the suspension asks for a redraw as before, and the
next `Occluded(true)` needs a new call.

Winit leaves the commit to the application when the integer buffer scale
changed since the call, because the new scale would apply to the old
buffer, whose size need not be a multiple of it.

An application that never calls the method behaves as before: every
configure, including the suspending one, asks for a redraw.

Refs rust-windowing#3442
crmne added a commit to crmne/winit that referenced this pull request Oct 14, 2026
A compositor sends no frame callbacks to a surface it has suspended, for
example on a hidden workspace or while the outputs are off. Winit stopped
reporting this state as `WindowEvent::Occluded` in rust-windowing#3441, together with
the change that made the suspending configure ask for a redraw.

Emit `Occluded(true)` and `Occluded(false)` again when the `suspended`
state is added or removed. Winit still asks for a redraw after every
configure, including the suspending one, and never commits on the
application's behalf, so applications that ignore the event behave as
before.

Refs rust-windowing#3442
crmne added a commit to crmne/winit that referenced this pull request Oct 14, 2026
A compositor sends no frame callbacks to a surface it has suspended, for
example on a hidden workspace or while the outputs are off. Winit stopped
reporting this state as `WindowEvent::Occluded` in rust-windowing#3441, together with
the change that made the suspending configure ask for a redraw.

Emit `Occluded(true)` and `Occluded(false)` again when the `suspended`
state is added or removed. Winit still asks for a redraw after every
configure, including the suspending one, and never commits on the
application's behalf, so applications that ignore the event behave as
before.

Refs rust-windowing#3442
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