mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Improve separate window support.
This commit is contained in:
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/application.h"
|
||||
|
||||
#include "data/data_abstract_structure.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_forum.h"
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_session.h"
|
||||
@@ -1377,8 +1378,9 @@ Window::Controller *Application::windowForShowingHistory(
|
||||
|
||||
Window::Controller *Application::windowForShowingForum(
|
||||
not_null<Data::Forum*> forum) const {
|
||||
const auto tabs = forum->channel()->useSubsectionTabs();
|
||||
const auto id = Window::SeparateId(
|
||||
Window::SeparateType::Forum,
|
||||
tabs ? Window::SeparateType::Chat : Window::SeparateType::Forum,
|
||||
forum->history());
|
||||
if (const auto separate = separateWindowFor(id)) {
|
||||
return separate;
|
||||
@@ -1386,9 +1388,15 @@ Window::Controller *Application::windowForShowingForum(
|
||||
auto result = (Window::Controller*)nullptr;
|
||||
enumerateWindows([&](not_null<Window::Controller*> window) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
const auto current = controller->shownForum().current();
|
||||
if (forum == current) {
|
||||
result = window;
|
||||
if (tabs) {
|
||||
if (controller->windowId() == id) {
|
||||
result = window;
|
||||
}
|
||||
} else {
|
||||
const auto current = controller->shownForum().current();
|
||||
if (forum == current) {
|
||||
result = window;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user