init
This commit is contained in:
parent
1b3d6139b8
commit
e0751c467b
2 changed files with 11 additions and 2 deletions
|
@ -380,6 +380,7 @@ fn handle_keydown_msg(
|
||||||
state_ptr: Rc<WindowsWindowStatePtr>,
|
state_ptr: Rc<WindowsWindowStatePtr>,
|
||||||
) -> Option<isize> {
|
) -> Option<isize> {
|
||||||
let mut lock = state_ptr.state.borrow_mut();
|
let mut lock = state_ptr.state.borrow_mut();
|
||||||
|
lock.keydown_time = Some(std::time::Instant::now());
|
||||||
let Some(input) = handle_key_event(handle, wparam, lparam, &mut lock, |keystroke| {
|
let Some(input) = handle_key_event(handle, wparam, lparam, &mut lock, |keystroke| {
|
||||||
PlatformInput::KeyDown(KeyDownEvent {
|
PlatformInput::KeyDown(KeyDownEvent {
|
||||||
keystroke,
|
keystroke,
|
||||||
|
@ -1237,10 +1238,15 @@ fn draw_window(
|
||||||
.request_frame
|
.request_frame
|
||||||
.take()?;
|
.take()?;
|
||||||
request_frame(RequestFrameOptions {
|
request_frame(RequestFrameOptions {
|
||||||
require_presentation: false,
|
require_presentation: true,
|
||||||
force_render,
|
force_render,
|
||||||
});
|
});
|
||||||
state_ptr.state.borrow_mut().callbacks.request_frame = Some(request_frame);
|
let mut lock = state_ptr.state.borrow_mut();
|
||||||
|
if let Some(keydown_time) = lock.keydown_time.take() {
|
||||||
|
let elapsed = keydown_time.elapsed();
|
||||||
|
println!("Elapsed keydown time: {:.02} ms", elapsed.as_secs_f64() * 1000.0);
|
||||||
|
}
|
||||||
|
lock.callbacks.request_frame = Some(request_frame);
|
||||||
unsafe { ValidateRect(Some(handle), None).ok().log_err() };
|
unsafe { ValidateRect(Some(handle), None).ok().log_err() };
|
||||||
Some(0)
|
Some(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub struct WindowsWindowState {
|
||||||
pub hovered: bool,
|
pub hovered: bool,
|
||||||
|
|
||||||
pub renderer: DirectXRenderer,
|
pub renderer: DirectXRenderer,
|
||||||
|
pub keydown_time: Option<std::time::Instant>,
|
||||||
|
|
||||||
pub click_state: ClickState,
|
pub click_state: ClickState,
|
||||||
pub system_settings: WindowsSystemSettings,
|
pub system_settings: WindowsSystemSettings,
|
||||||
|
@ -115,6 +116,7 @@ impl WindowsWindowState {
|
||||||
let nc_button_pressed = None;
|
let nc_button_pressed = None;
|
||||||
let fullscreen = None;
|
let fullscreen = None;
|
||||||
let initial_placement = None;
|
let initial_placement = None;
|
||||||
|
let keydown_time = None;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
origin,
|
origin,
|
||||||
|
@ -133,6 +135,7 @@ impl WindowsWindowState {
|
||||||
system_key_handled,
|
system_key_handled,
|
||||||
hovered,
|
hovered,
|
||||||
renderer,
|
renderer,
|
||||||
|
keydown_time,
|
||||||
click_state,
|
click_state,
|
||||||
system_settings,
|
system_settings,
|
||||||
current_cursor,
|
current_cursor,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue