diff --git a/CHANGELOG.md b/CHANGELOG.md index 37402711..89c86113 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Bugfix: Fixed unnecessary saving of windows layout. (#4201) - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) ## 2.4.0 diff --git a/src/widgets/AccountSwitchPopup.cpp b/src/widgets/AccountSwitchPopup.cpp index 90046b40..6b0e32b1 100644 --- a/src/widgets/AccountSwitchPopup.cpp +++ b/src/widgets/AccountSwitchPopup.cpp @@ -11,7 +11,9 @@ namespace chatterino { AccountSwitchPopup::AccountSwitchPopup(QWidget *parent) - : BaseWindow({BaseWindow::TopMost, BaseWindow::Frameless}, parent) + : BaseWindow({BaseWindow::TopMost, BaseWindow::Frameless, + BaseWindow::DisableLayoutSave}, + parent) { #ifdef Q_OS_LINUX this->setWindowFlag(Qt::Popup); diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index a434849d..8fec3fb0 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -540,7 +540,11 @@ void BaseWindow::resizeEvent(QResizeEvent *) { // Queue up save because: Window resized #ifdef CHATTERINO - getApp()->windows->queueSave(); + if (!flags_.has(DisableLayoutSave)) + { + getApp()->windows->queueSave(); + } + #endif //this->moveIntoDesktopRect(this); @@ -572,7 +576,10 @@ void BaseWindow::moveEvent(QMoveEvent *event) { // Queue up save because: Window position changed #ifdef CHATTERINO - getApp()->windows->queueSave(); + if (!flags_.has(DisableLayoutSave)) + { + getApp()->windows->queueSave(); + } #endif BaseWidget::moveEvent(event); diff --git a/src/widgets/BaseWindow.hpp b/src/widgets/BaseWindow.hpp index be95d360..6accc87c 100644 --- a/src/widgets/BaseWindow.hpp +++ b/src/widgets/BaseWindow.hpp @@ -32,6 +32,7 @@ public: FramelessDraggable = 16, DontFocus = 32, Dialog = 64, + DisableLayoutSave = 128, }; enum ActionOnFocusLoss { Nothing, Delete, Close, Hide }; diff --git a/src/widgets/DraggablePopup.cpp b/src/widgets/DraggablePopup.cpp index e103ac97..ca015282 100644 --- a/src/widgets/DraggablePopup.cpp +++ b/src/widgets/DraggablePopup.cpp @@ -23,8 +23,11 @@ namespace { } // namespace DraggablePopup::DraggablePopup(bool closeAutomatically, QWidget *parent) - : BaseWindow(closeAutomatically ? popupFlagsCloseAutomatically : popupFlags, - parent) + : BaseWindow( + closeAutomatically + ? popupFlagsCloseAutomatically | BaseWindow::DisableLayoutSave + : popupFlags | BaseWindow::DisableLayoutSave, + parent) , lifetimeHack_(std::make_shared(false)) , dragTimer_(this) diff --git a/src/widgets/FramelessEmbedWindow.cpp b/src/widgets/FramelessEmbedWindow.cpp index 846a0d68..e17e95ac 100644 --- a/src/widgets/FramelessEmbedWindow.cpp +++ b/src/widgets/FramelessEmbedWindow.cpp @@ -17,7 +17,7 @@ namespace chatterino { FramelessEmbedWindow::FramelessEmbedWindow() - : BaseWindow(BaseWindow::Frameless) + : BaseWindow({BaseWindow::Frameless, BaseWindow::DisableLayoutSave}) { this->split_ = new Split((QWidget *)nullptr); auto layout = new QHBoxLayout; diff --git a/src/widgets/TooltipWidget.cpp b/src/widgets/TooltipWidget.cpp index ed82383e..2893d845 100644 --- a/src/widgets/TooltipWidget.cpp +++ b/src/widgets/TooltipWidget.cpp @@ -22,7 +22,9 @@ TooltipWidget *TooltipWidget::instance() } TooltipWidget::TooltipWidget(BaseWidget *parent) - : BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus}, parent) + : BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus, + BaseWindow::DisableLayoutSave}, + parent) , displayImage_(new QLabel()) , displayText_(new QLabel()) { diff --git a/src/widgets/dialogs/ColorPickerDialog.cpp b/src/widgets/dialogs/ColorPickerDialog.cpp index eb591125..9237f2c3 100644 --- a/src/widgets/dialogs/ColorPickerDialog.cpp +++ b/src/widgets/dialogs/ColorPickerDialog.cpp @@ -9,7 +9,8 @@ namespace chatterino { ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent) - : BasePopup(BaseWindow::EnableCustomFrame, parent) + : BasePopup({BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave}, + parent) , color_() , dialogConfirmed_(false) { diff --git a/src/widgets/dialogs/NotificationPopup.cpp b/src/widgets/dialogs/NotificationPopup.cpp index 4df95c44..9dfb46d1 100644 --- a/src/widgets/dialogs/NotificationPopup.cpp +++ b/src/widgets/dialogs/NotificationPopup.cpp @@ -12,7 +12,7 @@ namespace chatterino { NotificationPopup::NotificationPopup() - : BaseWindow(BaseWindow::Frameless) + : BaseWindow({BaseWindow::Frameless, BaseWindow::DisableLayoutSave}) , channel_(std::make_shared("notifications", Channel::Type::None)) { diff --git a/src/widgets/dialogs/QualityPopup.cpp b/src/widgets/dialogs/QualityPopup.cpp index 09229241..9c7d519d 100644 --- a/src/widgets/dialogs/QualityPopup.cpp +++ b/src/widgets/dialogs/QualityPopup.cpp @@ -9,7 +9,7 @@ namespace chatterino { QualityPopup::QualityPopup(const QString &channelURL, QStringList options) - : BasePopup({}, + : BasePopup({BaseWindow::DisableLayoutSave}, static_cast(&(getApp()->windows->getMainWindow()))) , channelURL_(channelURL) { diff --git a/src/widgets/dialogs/SelectChannelDialog.cpp b/src/widgets/dialogs/SelectChannelDialog.cpp index 8b2d5605..0d6cbc40 100644 --- a/src/widgets/dialogs/SelectChannelDialog.cpp +++ b/src/widgets/dialogs/SelectChannelDialog.cpp @@ -28,9 +28,9 @@ namespace chatterino { SelectChannelDialog::SelectChannelDialog(QWidget *parent) - : BaseWindow( - {BaseWindow::Flags::EnableCustomFrame, BaseWindow::Flags::Dialog}, - parent) + : BaseWindow({BaseWindow::Flags::EnableCustomFrame, + BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave}, + parent) , selectedChannel_(Channel::getEmpty()) { this->setWindowTitle("Select a channel to join"); diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index f0f0ece9..d07a5480 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -26,9 +26,9 @@ namespace chatterino { SettingsDialog::SettingsDialog(QWidget *parent) - : BaseWindow( - {BaseWindow::Flags::DisableCustomScaling, BaseWindow::Flags::Dialog}, - parent) + : BaseWindow({BaseWindow::Flags::DisableCustomScaling, + BaseWindow::Flags::Dialog, BaseWindow::DisableLayoutSave}, + parent) { this->setObjectName("SettingsDialog"); this->setWindowTitle("Chatterino Settings"); diff --git a/src/widgets/dialogs/UpdateDialog.cpp b/src/widgets/dialogs/UpdateDialog.cpp index 872d4b5b..dcce88d1 100644 --- a/src/widgets/dialogs/UpdateDialog.cpp +++ b/src/widgets/dialogs/UpdateDialog.cpp @@ -12,7 +12,7 @@ namespace chatterino { UpdateDialog::UpdateDialog() : BaseWindow({BaseWindow::Frameless, BaseWindow::TopMost, - BaseWindow::EnableCustomFrame}) + BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave}) { auto layout = LayoutCreator(this).setLayoutType(); diff --git a/src/widgets/dialogs/WelcomeDialog.cpp b/src/widgets/dialogs/WelcomeDialog.cpp index 2c0a7a68..3429eb6a 100644 --- a/src/widgets/dialogs/WelcomeDialog.cpp +++ b/src/widgets/dialogs/WelcomeDialog.cpp @@ -3,7 +3,7 @@ namespace chatterino { WelcomeDialog::WelcomeDialog() - : BaseWindow(BaseWindow::EnableCustomFrame) + : BaseWindow({BaseWindow::EnableCustomFrame, BaseWindow::DisableLayoutSave}) { this->setWindowTitle("Chatterino quick setup"); } diff --git a/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp b/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp index 06fce006..63ba9675 100644 --- a/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp +++ b/src/widgets/dialogs/switcher/QuickSwitcherPopup.cpp @@ -32,8 +32,8 @@ namespace { const QSize QuickSwitcherPopup::MINIMUM_SIZE(500, 300); QuickSwitcherPopup::QuickSwitcherPopup(QWidget *parent) - : BasePopup(FlagsEnum{BaseWindow::Flags::Frameless, - BaseWindow::Flags::TopMost}, + : BasePopup({BaseWindow::Flags::Frameless, BaseWindow::Flags::TopMost, + BaseWindow::DisableLayoutSave}, parent) , switcherModel_(this) { diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index c8aecb15..8afd8bb8 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -58,7 +58,7 @@ ChannelPtr SearchPopup::filter(const QString &text, const QString &channelName, } SearchPopup::SearchPopup(QWidget *parent, Split *split) - : BasePopup({}, parent) + : BasePopup({BaseWindow::DisableLayoutSave}, parent) , split_(split) { this->initLayout(); diff --git a/src/widgets/settingspages/AboutPage.cpp b/src/widgets/settingspages/AboutPage.cpp index da3ca2ee..f6f93e08 100644 --- a/src/widgets/settingspages/AboutPage.cpp +++ b/src/widgets/settingspages/AboutPage.cpp @@ -204,8 +204,9 @@ void AboutPage::addLicense(QFormLayout *form, const QString &name, auto *b = new QLabel("show license"); QObject::connect( b, &QLabel::linkActivated, [parent = this, name, licenseLink] { - auto window = - new BasePopup(BaseWindow::Flags::EnableCustomFrame, parent); + auto window = new BasePopup({BaseWindow::Flags::EnableCustomFrame, + BaseWindow::DisableLayoutSave}, + parent); window->setWindowTitle("Chatterino - License for " + name); window->setAttribute(Qt::WA_DeleteOnClose); auto layout = new QVBoxLayout(); diff --git a/src/widgets/splits/InputCompletionPopup.cpp b/src/widgets/splits/InputCompletionPopup.cpp index b53b7578..c907bc58 100644 --- a/src/widgets/splits/InputCompletionPopup.cpp +++ b/src/widgets/splits/InputCompletionPopup.cpp @@ -44,7 +44,7 @@ namespace { InputCompletionPopup::InputCompletionPopup(QWidget *parent) : BasePopup({BasePopup::EnableCustomFrame, BasePopup::Frameless, - BasePopup::DontFocus}, + BasePopup::DontFocus, BaseWindow::DisableLayoutSave}, parent) , model_(this) {