Skip to content

Commit

Permalink
Make window unfocus unpause visible splits
Browse files Browse the repository at this point in the history
  • Loading branch information
Mm2PL committed Jul 11, 2024
1 parent e2c3823 commit 65dda47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/widgets/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <QDesktopServices>
#include <QHeaderView>
#include <QMenuBar>
#include <QObject>
#include <QPalette>
#include <QStandardItemModel>
#include <QVBoxLayout>
Expand Down Expand Up @@ -112,6 +113,12 @@ bool Window::event(QEvent *event)
}

case QEvent::WindowDeactivate: {
for (const auto &split :
this->notebook_->getSelectedPage()->getSplits())
{
split->unpause();
}

auto *page = this->notebook_->getSelectedPage();

if (page != nullptr)
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,13 @@ void Split::setInputReply(const MessagePtr &reply)
this->input_->setReply(reply);
}

void Split::unpause()
{
this->view_->unpause(PauseReason::KeyboardModifier);
this->view_->unpause(PauseReason::DoubleClick);
// Mouse intentionally left out, we may still have the mouse over the split
}

} // namespace chatterino

QDebug operator<<(QDebug dbg, const chatterino::Split &split)
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/splits/Split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class Split : public BaseWidget

void setInputReply(const MessagePtr &reply);

// This is called on window focus lost
void unpause();

static pajlada::Signals::Signal<Qt::KeyboardModifiers>
modifierStatusChanged;
static Qt::KeyboardModifiers modifierStatus;
Expand Down

0 comments on commit 65dda47

Please sign in to comment.