summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llluafloater.cpp16
-rw-r--r--indra/llui/llluafloater.h2
2 files changed, 16 insertions, 2 deletions
diff --git a/indra/llui/llluafloater.cpp b/indra/llui/llluafloater.cpp
index e584a67a00..62e77fd556 100644
--- a/indra/llui/llluafloater.cpp
+++ b/indra/llui/llluafloater.cpp
@@ -35,6 +35,7 @@
#include "lltexteditor.h"
const std::string LISTENER_NAME("LLLuaFloater");
+const F32 IDLE_INTERVAL = 0.5;
std::set<std::string> EVENT_LIST = {
"commit",
@@ -47,14 +48,16 @@ std::set<std::string> EVENT_LIST = {
"right_mouse_up",
"post_build",
"floater_close",
- "keystroke"
+ "keystroke",
+ "idle"
};
LLLuaFloater::LLLuaFloater(const LLSD &key) :
LLFloater(key),
mDispatchListener(LLUUID::generateNewID().asString(), "action"),
mReplyPumpName(key["reply"].asString()),
- mReqID(key)
+ mReqID(key),
+ mIdleTimer(new LLTimer())
{
auto ctrl_lookup = [this](const LLSD &event, std::function<LLSD(LLUICtrl*,const LLSD&)> cb)
{
@@ -166,6 +169,15 @@ BOOL LLLuaFloater::postBuild()
return true;
}
+void LLLuaFloater::draw()
+{
+ if (mIdleTimer->checkExpirationAndReset(IDLE_INTERVAL))
+ {
+ postEvent(LLSD(), "idle");
+ }
+ LLFloater::draw();
+}
+
void LLLuaFloater::onClose(bool app_quitting)
{
postEvent(llsd::map("app_quitting", app_quitting), "floater_close");
diff --git a/indra/llui/llluafloater.h b/indra/llui/llluafloater.h
index ccc3ccb39b..36e65ac7fc 100644
--- a/indra/llui/llluafloater.h
+++ b/indra/llui/llluafloater.h
@@ -36,6 +36,7 @@ public:
LLLuaFloater(const LLSD &key);
BOOL postBuild();
virtual ~LLLuaFloater();
+ void draw();
void registerCallback(const std::string &ctrl_name, const std::string &event);
void onClose(bool app_quitting);
@@ -48,6 +49,7 @@ public:
private:
LLReqID mReqID;
LLDispatchListener mDispatchListener;
+ std::unique_ptr<LLTimer> mIdleTimer;
std::string mReplyPumpName;
};