diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index ad8062753..19b0c68d9 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -593,10 +593,6 @@ bool SkipTaskbarSupported() { return false; } -bool RunInBackground() { - return true; -} - QString ExecutablePathForShortcuts() { if (Core::UpdaterDisabled()) { const auto &arguments = Core::Launcher::Instance().arguments(); diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.h b/Telegram/SourceFiles/platform/mac/specific_mac.h index 013a59370..55d29ca4a 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac.h +++ b/Telegram/SourceFiles/platform/mac/specific_mac.h @@ -31,10 +31,6 @@ inline bool SkipTaskbarSupported() { return false; } -inline bool RunInBackground() { - return true; -} - void ActivateThisProcess(); inline uint64 ActivationWindowId(not_null<QWidget*> window) { diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h index ce839beb1..0e423c229 100644 --- a/Telegram/SourceFiles/platform/platform_specific.h +++ b/Telegram/SourceFiles/platform/platform_specific.h @@ -44,7 +44,6 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done = nullptr); [[nodiscard]] bool AutostartSkip(); [[nodiscard]] bool TrayIconSupported(); [[nodiscard]] bool SkipTaskbarSupported(); -[[nodiscard]] bool RunInBackground(); void WriteCrashDumpDetails(); void NewVersionLaunched(int oldVersion); [[nodiscard]] QImage DefaultApplicationIcon(); diff --git a/Telegram/SourceFiles/platform/win/specific_win.h b/Telegram/SourceFiles/platform/win/specific_win.h index cea6ec176..99ebc36ad 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.h +++ b/Telegram/SourceFiles/platform/win/specific_win.h @@ -28,10 +28,6 @@ inline bool SkipTaskbarSupported() { return true; } -inline bool RunInBackground() { - return false; -} - inline bool PreventsQuit(Core::QuitReason reason) { return false; } diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp index 1c134f0a5..c541f7123 100644 --- a/Telegram/SourceFiles/settings/settings_advanced.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced.cpp @@ -575,35 +575,31 @@ void SetupSystemIntegrationContent( Core::App().saveSettings(); }, roundIcon->lifetime()); #endif // OS_MAC_STORE -#endif // Q_OS_MAC +#elif defined Q_OS_WIN // Q_OS_MAC + using Behavior = Core::Settings::CloseBehavior; + const auto closeToTaskbar = addSlidingCheckbox( + tr::lng_settings_close_to_taskbar(), + settings->closeBehavior() == Behavior::CloseToTaskbar); - if (!Platform::RunInBackground()) { - using Behavior = Core::Settings::CloseBehavior; - const auto closeToTaskbar = addSlidingCheckbox( - tr::lng_settings_close_to_taskbar(), - settings->closeBehavior() == Behavior::CloseToTaskbar); + const auto closeToTaskbarShown = std::make_shared< + rpl::variable<bool> + >(false); + settings->workModeValue( + ) | rpl::start_with_next([=](WorkMode workMode) { + *closeToTaskbarShown = !Core::App().tray().has(); + }, closeToTaskbar->lifetime()); - const auto closeToTaskbarShown = std::make_shared< - rpl::variable<bool> - >(false); - settings->workModeValue( - ) | rpl::start_with_next([=](WorkMode workMode) { - *closeToTaskbarShown = !Core::App().tray().has(); - }, closeToTaskbar->lifetime()); - - closeToTaskbar->toggleOn(closeToTaskbarShown->value()); - closeToTaskbar->entity()->checkedChanges( - ) | rpl::map([=](bool checked) { - return checked ? Behavior::CloseToTaskbar : Behavior::Quit; - }) | rpl::filter([=](Behavior value) { - return (settings->closeBehavior() != value); - }) | rpl::start_with_next([=](Behavior value) { - settings->setCloseBehavior(value); - Local::writeSettings(); - }, closeToTaskbar->lifetime()); - } else if (!Platform::IsMac()) { - - } + closeToTaskbar->toggleOn(closeToTaskbarShown->value()); + closeToTaskbar->entity()->checkedChanges( + ) | rpl::map([=](bool checked) { + return checked ? Behavior::CloseToTaskbar : Behavior::Quit; + }) | rpl::filter([=](Behavior value) { + return (settings->closeBehavior() != value); + }) | rpl::start_with_next([=](Behavior value) { + settings->setCloseBehavior(value); + Local::writeSettings(); + }, closeToTaskbar->lifetime()); +#endif // Q_OS_MAC || Q_OS_WIN if (Platform::AutostartSupported() && controller) { const auto minimizedToggled = [=] { @@ -968,9 +964,7 @@ void SetupWindowTitle( void SetupWindowCloseBehavior( not_null<Window::SessionController*> controller, not_null<Ui::VerticalLayout*> container) { - if (Platform::IsMac() || !Platform::RunInBackground()) { - return; - } +#if !defined Q_OS_WIN && !defined Q_OS_MAC const auto wrap = container->add( object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>( container, @@ -1023,6 +1017,7 @@ void SetupWindowCloseBehavior( }) | rpl::distinct_until_changed(), anim::type::normal); wrap->finishAnimating(); } +#endif } void SetupSystemIntegration(