Skip to content

Commit

Permalink
fix: parenting logic, fixing some windows & tooltips misbehaving (#5541)
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada authored Aug 17, 2024
1 parent e840328 commit f3cae76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- Bugfix: Fixed a crash when tab completing while having an invalid plugin loaded. (#5401)
- Bugfix: Fixed windows on Windows not saving correctly when snapping them to the edges. (#5478)
- Bugfix: Fixed user info card popups adding duplicate line to log files. (#5499)
- Bugfix: Fixed tooltips and input completion popups not working after moving a split. (#5541)
- Bugfix: Fixed `/clearmessages` not working with more than one window. (#5489)
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504)
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
Expand Down
19 changes: 19 additions & 0 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QFont>
#include <QIcon>
#include <QScreen>
#include <QWindow>

#include <functional>

Expand Down Expand Up @@ -503,6 +504,24 @@ bool BaseWindow::event(QEvent *event)
this->onFocusLost();
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
if (this->flags_.has(DontFocus) || this->flags_.has(Dialog))
{
// This certain windows (e.g. TooltipWidget, input completion widget, and the search popup) retains their nullptr parent
// NOTE that this currently does not retain their original transient parent (which is the window it was created under)
// For now, we haven't noticed that this creates any issues, and I don't know of a good place to store the previous transient
// parent to restore it.
if (event->type() == QEvent::ParentWindowChange)
{
assert(this->windowHandle() != nullptr);
if (this->windowHandle()->parent() != nullptr)
{
this->windowHandle()->setParent(nullptr);
}
}
}
#endif

return QWidget::event(event);
}

Expand Down

0 comments on commit f3cae76

Please sign in to comment.