From e4b9900a069373e9f404986bdb3b3eba1d5fb38f Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 12 Nov 2020 11:28:31 +0400 Subject: [PATCH] Construct WindowControlsLayout without variable --- .../platform/linux/specific_linux.cpp | 33 +++++++++---------- .../SourceFiles/platform/mac/specific_mac.mm | 13 ++++---- .../SourceFiles/platform/win/specific_win.cpp | 13 ++++---- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 9ca496c03..ec80da17a 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -964,31 +964,30 @@ Window::ControlsLayout WindowControlsLayout() { ); } - Window::ControlsLayout controls; - controls.left = controlsLeft; - controls.right = controlsRight; - - return controls; + return Window::ControlsLayout{ + .left = controlsLeft, + .right = controlsRight + }; } #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION - Window::ControlsLayout controls; - if (DesktopEnvironment::IsUnity()) { - controls.left = { - Window::Control::Close, - Window::Control::Minimize, - Window::Control::Maximize, + return Window::ControlsLayout{ + .left = { + Window::Control::Close, + Window::Control::Minimize, + Window::Control::Maximize, + } }; } else { - controls.right = { - Window::Control::Minimize, - Window::Control::Maximize, - Window::Control::Close, + return Window::ControlsLayout{ + .right = { + Window::Control::Minimize, + Window::Control::Maximize, + Window::Control::Close, + } }; } - - return controls; } } // namespace Platform diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.mm b/Telegram/SourceFiles/platform/mac/specific_mac.mm index 712e42c93..162629e89 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac.mm @@ -204,14 +204,13 @@ void IgnoreApplicationActivationRightNow() { } Window::ControlsLayout WindowControlsLayout() { - Window::ControlsLayout controls; - controls.left = { - Window::Control::Close, - Window::Control::Minimize, - Window::Control::Maximize, + return Window::ControlsLayout{ + .left = { + Window::Control::Close, + Window::Control::Minimize, + Window::Control::Maximize, + } }; - - return controls; } } // namespace Platform diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index ad7ee8a2c..cec77bfa6 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -325,14 +325,13 @@ bool ShowWindowMenu(QWindow *window) { } Window::ControlsLayout WindowControlsLayout() { - Window::ControlsLayout controls; - controls.right = { - Window::Control::Minimize, - Window::Control::Maximize, - Window::Control::Close, + return Window::ControlsLayout{ + .right = { + Window::Control::Minimize, + Window::Control::Maximize, + Window::Control::Close, + } }; - - return controls; } } // namespace Platform