Synchronize capture source chooser's screen detection code with media viewer

This commit is contained in:
Ilya Fedin 2022-03-20 08:58:50 +04:00 committed by John Preston
parent 3967e5d4ff
commit 49e143f84e
1 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <tgcalls/desktop_capturer/DesktopCaptureSourceManager.h>
#include <tgcalls/desktop_capturer/DesktopCaptureSourceHelper.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
namespace Calls::Group::Ui::DesktopCapture {
@ -575,7 +576,15 @@ void ChooseSourceProcess::setupGeometryWithParent(
not_null<QWidget*> parent) {
if (const auto handle = parent->windowHandle()) {
_window->createWinId();
const auto parentScreen = handle->screen();
const auto parentScreen = [&] {
if (!::Platform::IsWayland()) {
if (const auto screen = QGuiApplication::screenAt(
parent->geometry().center())) {
return screen;
}
}
return handle->screen();
}();
const auto myScreen = _window->windowHandle()->screen();
if (parentScreen && myScreen != parentScreen) {
_window->windowHandle()->setScreen(parentScreen);