From 53c96097c9b89f7ecfe39b19c78e9d838091f70c Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 15 Nov 2020 14:40:34 +0100 Subject: [PATCH] Use the main window as the parent to all user cards on macOS (#2185) --- CHANGELOG.md | 2 +- src/widgets/helper/ChannelView.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c420b7ab4..eb30a6034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ - Minor: Improve UX of the "Login expired!" message (#2029) - Minor: PageUp and PageDown now scroll in the selected split (#2070, #2081) - Minor: Allow highlights to be excluded from `/mentions`. Excluded highlights will not trigger tab highlights either. (#1793, #2036) -- Minor: Flag all popup dialogs as actual dialogs so they get the relevant window manager hints (#1843, #2182) +- Minor: Flag all popup dialogs as actual dialogs so they get the relevant window manager hints (#1843, #2182, #2185) - Minor: Don't show update button for nightly builds on macOS and Linux, this was already the case for Windows (#2163, #2164) - Bugfix: Fix crash occurring when pressing Escape in the Color Picker Dialog (#1843) - Bugfix: Fix bug preventing users from setting the highlight color of the second entry in the "User" highlights tab (#1898) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 686175cef..151588ab2 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -39,6 +39,7 @@ #include "util/Twitch.hpp" #include "widgets/Scrollbar.hpp" #include "widgets/TooltipWidget.hpp" +#include "widgets/Window.hpp" #include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/UserInfoPopup.hpp" #include "widgets/helper/EffectLabel.hpp" @@ -1965,8 +1966,14 @@ void ChannelView::hideEvent(QHideEvent *) void ChannelView::showUserInfoPopup(const QString &userName) { + QWidget *userCardParent = this; +#ifdef Q_OS_MACOS + // Order of closing/opening/killing widgets when the "Automatically close user info popups" setting is enabled is special on macOS, so user info popups should always use the main window as its parent + userCardParent = + static_cast(&(getApp()->windows->getMainWindow())); +#endif auto *userPopup = - new UserInfoPopup(getSettings()->autoCloseUserPopup, this); + new UserInfoPopup(getSettings()->autoCloseUserPopup, userCardParent); userPopup->setData(userName, this->hasSourceChannel() ? this->sourceChannel_ : this->underlyingChannel_);