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
3 changes: 1 addition & 2 deletions src/wayland/runtime/drm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::HashMap;
use std::process::exit;
use std::sync::{Arc, Mutex};
use std::time::Duration;

use smithay::backend::drm::{DrmDevice, DrmEvent};
use smithay::backend::libinput::LibinputInputBackend;
Expand Down Expand Up @@ -292,7 +291,7 @@ fn run_event_loop(
let pointer_handle = state.pointer.clone();

event_loop
.run(Duration::from_millis(16), state, move |state| {
.run(None, state, move |state| {
process_completed_crtcs(state, shared, output_surfaces);

process_pending_libinput_events(state, shared);
Expand Down
3 changes: 1 addition & 2 deletions src/wayland/runtime/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! Wayland or X11 session.

use std::process::exit;
use std::time::Duration;

use smithay::backend::input::InputEvent;
use smithay::backend::renderer::ImportDma;
Expand Down Expand Up @@ -87,7 +86,7 @@ pub fn run() -> ! {

let loop_signal: LoopSignal = event_loop.get_signal();
event_loop
.run(Duration::from_millis(16), &mut state, move |mut state| {
.run(None, &mut state, move |mut state| {
Comment on lines 88 to +89
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if winit backend has any timer or frame-request mechanism for continuous rendering
echo "=== Searching for animation/redraw wake mechanisms in winit backend ==="
rg -n -C3 'RedrawRequested|request_redraw|timer|Timer|animate' src/wayland/runtime/winit.rs src/wayland/render/winit.rs

echo ""
echo "=== Check if winit backend uses calloop timers ==="
rg -n 'calloop.*timer|Timer::' src/wayland/runtime/

echo ""
echo "=== Check animation state handling ==="
rg -n -C2 'has_active.*animation|tick.*animation' src/wayland/runtime/

Repository: instantOS/instantWM

Length of output: 1074


🏁 Script executed:

#!/bin/bash
# Examine the winit event_loop.run() callback implementation
echo "=== Winit event loop callback implementation ==="
sed -n '88,200p' src/wayland/runtime/winit.rs | cat -n

echo ""
echo "=== Check if render_frame is called in winit backend ==="
rg -n 'render_frame' src/wayland/runtime/winit.rs src/wayland/render/

echo ""
echo "=== Check animation handling in common.rs ==="
sed -n '1,50p' src/wayland/runtime/common.rs | cat -n

echo ""
echo "=== Check if winit backend needs to handle animations differently ==="
rg -n -C5 'has_active_window_animations' src/wayland/runtime/common.rs src/wayland/runtime/winit.rs

Repository: instantOS/instantWM

Length of output: 8207


🏁 Script executed:

#!/bin/bash
# Search for where tick_window_animations is called
echo "=== All calls to tick_window_animations ==="
rg -n 'tick_window_animations' --type rust

echo ""
echo "=== Check if winit render_frame handles animations ==="
sed -n '26,100p' src/wayland/render/winit.rs | cat -n

echo ""
echo "=== Check WaylandState for animation methods ==="
rg -n 'fn.*animation|tick_window_animations|has_active_window_animations' src/backend/wayland/

Repository: instantOS/instantWM

Length of output: 4319


🏁 Script executed:

#!/bin/bash
# Check if winit event loop integrates with wayland client sockets as event sources
echo "=== Search for calloop socket/source registration in winit backend ==="
rg -n 'insert|register|add_source|with_source' src/wayland/runtime/winit.rs

echo ""
echo "=== Check for any timer-like sources in winit ==="
rg -n 'Timer|timer|source|Source' src/wayland/runtime/winit.rs | head -20

echo ""
echo "=== Examine full winit event loop setup (first 100 lines) ==="
head -100 src/wayland/runtime/winit.rs | cat -n

Repository: instantOS/instantWM

Length of output: 5086


Restore the 16ms timeout or add a timer source to maintain animation frame timing.

The winit backend's render_frame() calls tick_window_animations(), but without the timeout, the loop blocks on epoll_wait until an external event arrives. Unlike the DRM backend (which has VBlank events), winit has no frame timing source. Animations will stall during idle periods—e.g., window fade-in animations with no user input will freeze mid-animation.

Either restore the 16ms timeout or register a calloop timer source to wake the loop periodically during active animations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/wayland/runtime/winit.rs` around lines 88 - 89, The event loop currently
calls event_loop.run(None, &mut state, move |mut state| { ... }) which blocks
indefinitely and prevents render_frame()/tick_window_animations() from
progressing during idle periods; either restore a 16ms timeout on the run call
(replace None with Some(Duration::from_millis(16))) or register a calloop timer
source that wakes the loop every ~16ms while animations are active so
render_frame() can drive tick_window_animations(); update the logic around
event_loop.run and the animation-active flag in state to start/stop the timer
appropriately.

winit_loop.dispatch_new_events(|event| match event {
WinitEvent::Resized { size, .. } => {
crate::wayland::input::handle_resize(&mut state.wm, &output, size.w, size.h);
Expand Down
Loading