Skip to content

ControlFlow::WaitUntil does not wake window on Linux Mint #4461

@Boneyan

Description

@Boneyan

Description

I'm currently migrating my program from older version of winit to the latest. Previously I used glium 0.32.1, which uses winit 0.27.1 as I understand. ControlFlow::WaitUntil worked fine. Now I'm trying to use winit 0.30.12 with wgpu 27.0.1, and ControlFlow::WaitUntil does not seem to wake my window up. My window_event goes like this:

fn window_event(
    &mut self,
    event_loop: &ActiveEventLoop,
    _window_id: winit::window::WindowId,
    event: WindowEvent,
) {
    let engine = match &mut self.state {
        Some(canvas) => canvas,
        None => return,
    };

    match event {
        // event matching without returns
        _ => {}
    }
    // close window if app manager tells to
    if engine.manager.exiting() {
        event_loop.exit();
        return;
    }

    // poll my custom event queue for the timestamp of next app event
    match self.event_queue.poll(&mut engine.manager) {
        Some(next) => {
            event_loop.set_control_flow(ControlFlow::WaitUntil(next));
            println!("wait until {:?} now {:?}", next, Instant::now());
        },
        None => {
            event_loop.set_control_flow(ControlFlow::Wait);
            println!("wait now {:?}", Instant::now());
        },
    };
}

And so, after starting program I get output like this:

wait until Instant { tv_sec: 38396, tv_nsec: 609541925 } now Instant { tv_sec: 38396, tv_nsec: 580824654 }
wait until Instant { tv_sec: 38396, tv_nsec: 609541925 } now Instant { tv_sec: 38396, tv_nsec: 581410978 }
wait until Instant { tv_sec: 38396, tv_nsec: 609541925 } now Instant { tv_sec: 38396, tv_nsec: 581449964 }
wait until Instant { tv_sec: 38396, tv_nsec: 609541925 } now Instant { tv_sec: 38396, tv_nsec: 581504206 }
wait until Instant { tv_sec: 38396, tv_nsec: 609541925 } now Instant { tv_sec: 38396, tv_nsec: 581541213 }

After I get these events, window just stops receiving events. It receives them only if I move my mouse or do other user actions. But WaitUntil should generate events with or without user events, and it doesn't seem to happen.

OS and window mananger

Linux Mint 22.2

> wmctrl -m
Name: Mutter (Muffin)

Winit version

0.30.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - x11Affects the X11 backend, or generally free Unix platforms

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions