Added "new-windows-size-as-first" option.

This commit is contained in:
23rd 2023-11-22 19:41:13 +03:00 committed by John Preston
parent 19ab740da2
commit 909f3bf011
3 changed files with 19 additions and 3 deletions

View File

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "media/player/media_player_instance.h"
#include "webview/webview_embed.h"
#include "window/main_window.h"
#include "window/window_peer_menu.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
@ -155,6 +156,7 @@ void SetupExperimental(
addToggle(Window::Notifications::kOptionGNotification);
addToggle(Core::kOptionFreeType);
addToggle(Data::kOptionExternalVideoPlayer);
addToggle(Window::kOptionNewWindowsSizeAsFirst);
}
} // namespace

View File

@ -72,7 +72,15 @@ using Core::WindowPosition;
return result;
}
} // namespace
base::options::toggle OptionNewWindowsSizeAsFirst({
.id = kOptionNewWindowsSizeAsFirst,
.name = "Adjust size of new chat windows.",
.description = "Open new windows with a size of the main window.",
});
} // namespace.
const char kOptionNewWindowsSizeAsFirst[] = "new-windows-size-as-first";
const QImage &Logo() {
static const auto result = QImage(u":/gui/art/logo_256.png"_q);
@ -616,8 +624,12 @@ WindowPosition MainWindow::nextInitialChildPosition(bool primary) {
const auto adjust = [&](int value) {
return primary ? value : (value * 3 / 4);
};
const auto width = adjust(st::windowDefaultWidth);
const auto height = adjust(st::windowDefaultHeight);
const auto width = OptionNewWindowsSizeAsFirst.value()
? Core::App().settings().windowPosition().w
: adjust(st::windowDefaultWidth);
const auto height = OptionNewWindowsSizeAsFirst.value()
? Core::App().settings().windowPosition().h
: adjust(st::windowDefaultHeight);
const auto skip = ChildSkip();
const auto delta = _lastChildIndex
? (_lastMyChildCreatePosition - position)

View File

@ -54,6 +54,8 @@ struct CounterLayerArgs {
required<style::color> fg;
};
extern const char kOptionNewWindowsSizeAsFirst[];
[[nodiscard]] QImage GenerateCounterLayer(CounterLayerArgs &&args);
[[nodiscard]] QImage WithSmallCounter(QImage image, CounterLayerArgs &&args);