all: fetch current time only once per iteration
This commit is contained in:
parent
d8d6be1ef3
commit
bb9e6ba3b5
21 changed files with 99 additions and 97 deletions
|
|
@ -29,7 +29,6 @@ use {
|
|||
},
|
||||
logind::{LogindError, Session},
|
||||
state::State,
|
||||
time::now_usec,
|
||||
udev::{Udev, UdevError, UdevMonitor},
|
||||
utils::{
|
||||
clonecell::{CloneCell, UnsafeCellCloneSafe},
|
||||
|
|
@ -469,7 +468,7 @@ impl MetalInputDevice {
|
|||
}
|
||||
|
||||
fn pre_pause(&self) {
|
||||
let time_usec = now_usec();
|
||||
let time_usec = self.state.now_usec();
|
||||
for (key, _) in self.pressed_keys.take() {
|
||||
self.event(InputEvent::Key {
|
||||
time_usec,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ use {
|
|||
renderer::RenderResult,
|
||||
state::State,
|
||||
theme::Color,
|
||||
time::now_nsec,
|
||||
tree::OutputNode,
|
||||
udev::UdevDevice,
|
||||
utils::{
|
||||
|
|
@ -591,7 +590,7 @@ impl MetalConnector {
|
|||
});
|
||||
if let Some(delta) = *DELTA {
|
||||
let next_present = self.next_flip_nsec.get().saturating_sub(delta);
|
||||
if now_nsec() < next_present {
|
||||
if self.state.now_nsec() < next_present {
|
||||
self.state.ring.timeout(next_present).await.unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ use {
|
|||
gfx_api::{GfxContext, GfxError, GfxFramebuffer, GfxTexture},
|
||||
renderer::RenderResult,
|
||||
state::State,
|
||||
time::now_usec,
|
||||
utils::{
|
||||
clonecell::CloneCell, copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell,
|
||||
queue::AsyncQueue, syncqueue::SyncQueue,
|
||||
|
|
@ -818,7 +817,7 @@ impl XBackend {
|
|||
inverted: false,
|
||||
});
|
||||
seat.mouse_event(InputEvent::AxisFrame {
|
||||
time_usec: now_usec(),
|
||||
time_usec: self.state.now_usec(),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
@ -834,7 +833,7 @@ impl XBackend {
|
|||
n => BTN_SIDE + n - 8,
|
||||
};
|
||||
seat.mouse_event(InputEvent::Button {
|
||||
time_usec: now_usec(),
|
||||
time_usec: self.state.now_usec(),
|
||||
button,
|
||||
state,
|
||||
});
|
||||
|
|
@ -851,7 +850,7 @@ impl XBackend {
|
|||
let event: XiKeyPress = event.parse()?;
|
||||
if let Some(seat) = self.seats.get(&event.deviceid) {
|
||||
seat.kb_event(InputEvent::Key {
|
||||
time_usec: now_usec(),
|
||||
time_usec: self.state.now_usec(),
|
||||
key: event.detail - 8,
|
||||
state,
|
||||
});
|
||||
|
|
@ -885,7 +884,7 @@ impl XBackend {
|
|||
self.mouse_seats.get(&event.deviceid),
|
||||
) {
|
||||
seat.mouse_event(InputEvent::ConnectorPosition {
|
||||
time_usec: now_usec(),
|
||||
time_usec: self.state.now_usec(),
|
||||
connector: win.id,
|
||||
x: Fixed::from_1616(event.event_x),
|
||||
y: Fixed::from_1616(event.event_y),
|
||||
|
|
@ -904,7 +903,7 @@ impl XBackend {
|
|||
_ => return Ok(()),
|
||||
};
|
||||
seat.mouse_event(InputEvent::ConnectorPosition {
|
||||
time_usec: now_usec(),
|
||||
time_usec: self.state.now_nsec(),
|
||||
connector: win.id,
|
||||
x: Fixed::from_1616(event.event_x),
|
||||
y: Fixed::from_1616(event.event_y),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue