1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 02:28:12 +00:00

Userland: Silence warnings from ElapsedTimer::elapsed() type change

We changed elapsed() to return i64 instead of int as that's what
AK::Time::to_milliseconds() returns, causing a bunch of implicit lossy
conversions in callers. Clean those up with a mix of type changes and
casts.
This commit is contained in:
Andrew Kaster 2023-01-01 22:50:49 -07:00 committed by Linus Groh
parent 48bf0b1408
commit a492e2018d
7 changed files with 9 additions and 10 deletions

View file

@ -1086,8 +1086,8 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) ->
bool WindowManager::is_considered_doubleclick(MouseEvent const& event, DoubleClickInfo::ClickMetadata const& metadata) const
{
int elapsed_since_last_click = metadata.clock.elapsed();
if (elapsed_since_last_click < m_double_click_speed) {
i64 elapsed_ms_since_last_click = metadata.clock.elapsed();
if (elapsed_ms_since_last_click < m_double_click_speed) {
auto diff = event.position() - metadata.last_position;
auto distance_travelled_squared = diff.x() * diff.x() + diff.y() * diff.y();
if (distance_travelled_squared <= (m_max_distance_for_double_click * m_max_distance_for_double_click))