From 003634e049d599b8ed5ae3ba6b3250e9eb7741ca Mon Sep 17 00:00:00 2001 From: sapier Date: Fri, 30 May 2014 03:07:48 +0200 Subject: Add support for exiting formspecs by doubleclicking outside --- src/porting.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/porting.h') diff --git a/src/porting.h b/src/porting.h index 937ca9464..383d4377a 100644 --- a/src/porting.h +++ b/src/porting.h @@ -275,6 +275,21 @@ inline u32 getTime(TimePrecision prec) return 0; } +/** + * Delta calculation function taking two 32bit arguments. + * @param old_time_ms old time for delta calculation (order is relevant!) + * @param new_time_ms new time for delta calculation (order is relevant!) + * @return positive 32bit delta value + */ +inline u32 getDeltaMs(u32 old_time_ms, u32 new_time_ms) +{ + if (new_time_ms >= old_time_ms) { + return (new_time_ms - old_time_ms); + } else { + return (old_time_ms - new_time_ms); + } +} + #if defined(linux) || defined(__linux) #include -- cgit v1.2.3