decreased lag when opening the emote/emoji menu

This commit is contained in:
fourtf 2018-04-18 17:03:37 +02:00
parent 653e4c6adf
commit 4c99f2b5fd
2 changed files with 13 additions and 3 deletions

View file

@ -19,6 +19,8 @@
namespace chatterino {
namespace messages {
bool Image::loadedEventQueued = false;
Image::Image(const QString &url, qreal scale, const QString &name, const QString &tooltip,
const QMargins &margin, bool isHat)
: url(url)
@ -131,8 +133,14 @@ void Image::loadImage()
singletons::EmoteManager::getInstance().incGeneration();
util::postToThread(
[] { singletons::WindowManager::getInstance().layoutVisibleChatWidgets(); });
if (!loadedEventQueued) {
loadedEventQueued = true;
QTimer::singleShot(750, [] {
singletons::WindowManager::getInstance().layoutVisibleChatWidgets();
loadedEventQueued = false;
});
}
return true;
});

View file

@ -40,6 +40,8 @@ private:
int duration;
};
static bool loadedEventQueued;
QPixmap *currentPixmap = nullptr;
QPixmap *loadedPixmap = nullptr;
std::vector<FrameData> allFrames;