feat: Live Emote Updates for 7TV (#4090)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
+13
-13
@@ -30,19 +30,6 @@ private:
|
||||
std::function<void()> action_;
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
static void runInGuiThread(F &&fun)
|
||||
{
|
||||
if (isGuiThread())
|
||||
{
|
||||
fun();
|
||||
}
|
||||
else
|
||||
{
|
||||
postToThread(fun);
|
||||
}
|
||||
}
|
||||
|
||||
// Taken from
|
||||
// https://stackoverflow.com/questions/21646467/how-to-execute-a-functor-or-a-lambda-in-a-given-thread-in-qt-gcd-style
|
||||
// Qt 5/4 - preferred, has least allocations
|
||||
@@ -70,4 +57,17 @@ static void postToThread(F &&fun, QObject *obj = qApp)
|
||||
QCoreApplication::postEvent(obj, new Event(std::forward<F>(fun)));
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
static void runInGuiThread(F &&fun)
|
||||
{
|
||||
if (isGuiThread())
|
||||
{
|
||||
fun();
|
||||
}
|
||||
else
|
||||
{
|
||||
postToThread(fun);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user