You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After the application launches, a Focussed event should be triggered, but no such event occurs. At this point, calling the window's is_focused method should return true, but the actual result is false. Subsequently, when the window loses focus for the first time, a Focussed event should be emitted, and the focus state should be false, yet nothing happens.
Steps To Reproduce
use tao::{
event::{self, DeviceEvent, Event, RawKeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
keyboard::KeyCode,
window::WindowBuilder,
};
fn main() {
let event_loop = EventLoop::new();
let mut window = Some(WindowBuilder::new().build(&event_loop).unwrap());
println!("Press '1' to display is window focused status.");
event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Wait;
match event {
Event::DeviceEvent {
event:
DeviceEvent::Key(RawKeyEvent {
physical_key,
state: event::ElementState::Pressed,
}),
..
} => {
if KeyCode::Digit1 == physical_key {
if let Some(ref win) = window {
// status should always be true here, but get false after app launched
println!("window focues status={} when press '1'", win.is_focused())
}
}
}
Event::WindowEvent {
event,
window_id: _,
..
} => match event {
WindowEvent::CloseRequested => {
window = None;
*control_flow = ControlFlow::Exit;
}
WindowEvent::Focused(focues_flag) => {
if let Some(_) = window {
// should print `window gain focus` after app launched, but nothing happened
if focues_flag {
println!("window gain focus")
} else {
println!("window lose focus")
}
} else {
println!("window is destoryed")
}
}
_ => (),
},
_ => (),
}
});
}
Expected behavior
console print window gain focus after app launched, actually nothing happened
console print window focues status=true when press '1' after app launched, actually status=false
console print window lose focus when windown lose focus first time, actually nothing happened
Platform and Versions (please complete the following information):
OS: Windows 11
Rustc: 1.83.0
dao: 0.31.1
The text was updated successfully, but these errors were encountered:
Describe the bug
After the application launches, a Focussed event should be triggered, but no such event occurs. At this point, calling the window's is_focused method should return true, but the actual result is false. Subsequently, when the window loses focus for the first time, a Focussed event should be emitted, and the focus state should be false, yet nothing happens.
Steps To Reproduce
Expected behavior
window gain focus
after app launched, actually nothing happenedwindow focues status=true when press '1'
after app launched, actuallystatus=false
window lose focus
when windown lose focus first time, actually nothing happenedPlatform and Versions (please complete the following information):
OS: Windows 11
Rustc: 1.83.0
dao: 0.31.1
The text was updated successfully, but these errors were encountered: