Skip to content

Commit

Permalink
fix: animate emotes when overlay is open (#5659)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz authored Oct 19, 2024
1 parent 85d34c8 commit d0b9fd0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Major: Add option to show pronouns in user card. (#5442, #5583)
- Major: Release plugins alpha. (#5288)
- Major: Improve high-DPI support on Windows. (#4868, #5391)
- Major: Added transparent overlay window (default keybind: <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>N</kbd>). (#4746, #5643)
- Major: Added transparent overlay window (default keybind: <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>N</kbd>). (#4746, #5643, #5659)
- Minor: Removed the Ctrl+Shift+L hotkey for toggling the "live only" tab visibility state. (#5530)
- Minor: Add support for Shared Chat messages. Shared chat messages can be filtered with the `flags.shared` filter variable, or with search using `is:shared`. Some messages like subscriptions are filtered on purpose to avoid confusion for the broadcaster. If you have both channels participating in Shared Chat open, only one of the message triggering your highlight will trigger. (#5606, #5625)
- Minor: Moved tab visibility control to a submenu, without any toggle actions. (#5530)
Expand Down
1 change: 1 addition & 0 deletions src/singletons/helper/GifTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ void GIFTimer::initialize()

QObject::connect(&this->timer, &QTimer::timeout, [this] {
if (getSettings()->animationsWhenFocused &&
this->openOverlayWindows_ == 0 &&
QApplication::activeWindow() == nullptr)
{
return;
Expand Down
12 changes: 12 additions & 0 deletions src/singletons/helper/GifTimer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ class GIFTimer
return this->position_;
}

void registerOpenOverlayWindow()
{
this->openOverlayWindows_++;
}

void unregisterOpenOverlayWindow()
{
assert(this->openOverlayWindows_ >= 1);
this->openOverlayWindows_--;
}

private:
QTimer timer;
long unsigned position_{};
size_t openOverlayWindows_ = 0;
};

} // namespace chatterino
3 changes: 3 additions & 0 deletions src/widgets/OverlayWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "common/FlagsEnum.hpp"
#include "common/Literals.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "widgets/BaseWidget.hpp"
Expand Down Expand Up @@ -166,13 +167,15 @@ OverlayWindow::OverlayWindow(IndirectChannel channel,

this->addShortcuts();
this->triggerFirstActivation();
getApp()->getEmotes()->getGIFTimer().registerOpenOverlayWindow();
}

OverlayWindow::~OverlayWindow()
{
#ifdef Q_OS_WIN
::DestroyCursor(this->sizeAllCursor_);
#endif
getApp()->getEmotes()->getGIFTimer().unregisterOpenOverlayWindow();
}

void OverlayWindow::applyTheme()
Expand Down

0 comments on commit d0b9fd0

Please sign in to comment.