From 737fdcd8dc591bb05ec4d2309ac007fa4dd9d3f3 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 15:34:44 +0200 Subject: [PATCH 1/6] fix: tooltip window handle parent restoration When the split's parent changes, that change propagates down to the created tooltip widget. This breaks tooltips on X11 & Sway (maybe more). This change ensures that the tooltip window handle's parent is always nullptr. --- src/widgets/BaseWindow.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 12e87ff73e1..4699ce97766 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -503,6 +504,24 @@ bool BaseWindow::event(QEvent *event) this->onFocusLost(); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + if (this->windowFlags().testFlag(Qt::ToolTip)) + { + // This ensures tooltip windows (namely the TooltipWidget) 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); } From 288537c04f233e731dedd0c4ab2f8349a7b985ef Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 15:36:13 +0200 Subject: [PATCH 2/6] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89886d12615..6d7c2009486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 on X11 & Sway 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) From b01bd3ee6d187e06130cd2f12930181776cda72f Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 15:37:46 +0200 Subject: [PATCH 3/6] Update changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7c2009486..bd9cbdace16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +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 on X11 & Sway not working after moving a split. (#5541) +- Bugfix: Fixed tooltips on X11 & hyprland 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) From 4b3aef9de9efdfcfb74aa4e325539b514045f35d Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 16:05:41 +0200 Subject: [PATCH 4/6] Run on all DontFocus-widgets --- src/widgets/BaseWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 4699ce97766..7ab8724183d 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -505,9 +505,9 @@ bool BaseWindow::event(QEvent *event) } #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - if (this->windowFlags().testFlag(Qt::ToolTip)) + if (this->flags_.has(DontFocus)) { - // This ensures tooltip windows (namely the TooltipWidget) retains their nullptr parent + // This ensures tooltip-like windows (namely the TooltipWidget & completion widget) 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. From 1265630e0ff040be639898acc9093bab4c03ff7a Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 16:09:52 +0200 Subject: [PATCH 5/6] update changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9cbdace16..417b050761e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +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 on X11 & hyprland not working after moving a split. (#5541) +- 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) From 69c8be9c99ec98efec2469e660652138d2ad84d5 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 11 Aug 2024 16:15:43 +0200 Subject: [PATCH 6/6] Also perform the same logic for the search popup --- src/widgets/BaseWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 7ab8724183d..7d24a85d4dd 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -505,9 +505,9 @@ bool BaseWindow::event(QEvent *event) } #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) - if (this->flags_.has(DontFocus)) + if (this->flags_.has(DontFocus) || this->flags_.has(Dialog)) { - // This ensures tooltip-like windows (namely the TooltipWidget & completion widget) retains their nullptr parent + // 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.