From 75ff8a6a05afd02aaadf7e3049b0a0e305241182 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 24 Apr 2020 00:03:16 +0800 Subject: ... --- include/cru/platform/native/ui_application.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'include/cru/platform/native') diff --git a/include/cru/platform/native/ui_application.hpp b/include/cru/platform/native/ui_application.hpp index 006255db..afcc7117 100644 --- a/include/cru/platform/native/ui_application.hpp +++ b/include/cru/platform/native/ui_application.hpp @@ -32,11 +32,16 @@ struct IUiApplication : public virtual INativeResource { virtual void AddOnQuitHandler(std::function handler) = 0; virtual void InvokeLater(std::function action) = 0; - virtual unsigned long SetTimeout(std::chrono::milliseconds milliseconds, - std::function action) = 0; - virtual unsigned long SetInterval(std::chrono::milliseconds milliseconds, - std::function action) = 0; - virtual void CancelTimer(unsigned long id) = 0; + // Timer id should always be positive and never the same. So it's ok to use + // negative value to represent no timer. + virtual long long SetTimeout(std::chrono::milliseconds milliseconds, + std::function action) = 0; + virtual long long SetInterval(std::chrono::milliseconds milliseconds, + std::function action) = 0; + // Implementation should guarantee calls on timer id already canceled have no + // effects and do not crash. Also canceling negative id should always result + // in no-op. + virtual void CancelTimer(long long id) = 0; virtual std::vector GetAllWindow() = 0; virtual std::shared_ptr CreateWindow( -- cgit v1.2.3