If my program calls redraw_window() inside the MainEventsCleared event and I hold my mouse still and don't use my keyboard, the window's decorations will briefly light up as if hovered over and then go back to normal. This happens intermittently. The window's task bar icon will also disappear and reappear at the same time the window decorations blink.
Here is a video demonstrating the bug.
The following is the code used in the video:
use winit::{
event::{DeviceEvent, ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::WindowBuilder,
};
fn main() {
let event_loop = EventLoop::new();
let window = WindowBuilder::new()
.with_title("A Buggy Window")
.build(&event_loop)
.unwrap();
let mut bug = false;
event_loop.run(move |event, _, control_flow| match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => *control_flow = ControlFlow::Exit,
Event::DeviceEvent {
event:
DeviceEvent::Key(KeyboardInput {
virtual_keycode: Some(VirtualKeyCode::B),
state: ElementState::Pressed,
..
}),
..
} => {
bug = !bug;
if bug {
println!("bug enabled");
} else {
println!("bug disabled");
}
}
Event::MainEventsCleared => {
if bug {
window.request_redraw();
}
}
_ => {}
})
}
I've managed to get the bug to appear on both winit = 0.21.0 and on the master branch (9999f53).
If my program calls
redraw_window()inside theMainEventsClearedevent and I hold my mouse still and don't use my keyboard, the window's decorations will briefly light up as if hovered over and then go back to normal. This happens intermittently. The window's task bar icon will also disappear and reappear at the same time the window decorations blink.Here is a video demonstrating the bug.
The following is the code used in the video:
I've managed to get the bug to appear on both
winit = 0.21.0and on themasterbranch (9999f53).