Enable screen sharing on Linux.

This commit is contained in:
John Preston 2021-05-10 16:20:13 +04:00
parent 9ca6d0d893
commit 6b10045b7b
2 changed files with 5 additions and 8 deletions

View file

@ -750,9 +750,7 @@ void Panel::refreshLeftButton() {
_screenShare.create(widget(), st::groupCallScreenShareSmall); _screenShare.create(widget(), st::groupCallScreenShareSmall);
_screenShare->show(); _screenShare->show();
_screenShare->setClickedCallback([=] { _screenShare->setClickedCallback([=] {
#ifndef Q_OS_LINUX
Ui::DesktopCapture::ChooseSource(this); Ui::DesktopCapture::ChooseSource(this);
#endif // Q_OS_LINUX
}); });
_screenShare->setText(tr::lng_group_call_screen_share()); _screenShare->setText(tr::lng_group_call_screen_share());
_screenShare->setColorOverrides( _screenShare->setColorOverrides(

View file

@ -296,8 +296,11 @@ void ChooseSourceProcess::activate() {
} }
void ChooseSourceProcess::setupPanel() { void ChooseSourceProcess::setupPanel() {
#ifndef Q_OS_LINUX
_window->setAttribute(Qt::WA_OpaquePaintEvent); _window->setAttribute(Qt::WA_OpaquePaintEvent);
#endif // Q_OS_LINUX
_window->setAttribute(Qt::WA_NoSystemBackground); _window->setAttribute(Qt::WA_NoSystemBackground);
_window->setWindowIcon(QIcon( _window->setWindowIcon(QIcon(
QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly))); QPixmap::fromImage(Image::Empty()->original(), Qt::ColorOnly)));
_window->setTitleStyle(st::desktopCaptureSourceTitle); _window->setTitleStyle(st::desktopCaptureSourceTitle);
@ -318,7 +321,7 @@ void ChooseSourceProcess::setupPanel() {
+ (st::desktopCaptureSourceSize.height() / 2) + (st::desktopCaptureSourceSize.height() / 2)
+ bottomHeight; + bottomHeight;
_window->setFixedSize({ width, height }); _window->setFixedSize({ width, height });
_window->setWindowFlags(Qt::WindowStaysOnTopHint); _window->setWindowFlag(Qt::WindowStaysOnTopHint);
_window->body()->paintRequest( _window->body()->paintRequest(
) | rpl::start_with_next([=](QRect clip) { ) | rpl::start_with_next([=](QRect clip) {
@ -530,11 +533,7 @@ void ChooseSourceProcess::setupSourcesGeometry() {
void ChooseSourceProcess::setupGeometryWithParent( void ChooseSourceProcess::setupGeometryWithParent(
not_null<QWidget*> parent) { not_null<QWidget*> parent) {
if (const auto handle = parent->windowHandle()) { if (const auto handle = parent->windowHandle()) {
if (::Platform::IsLinux()) { _window->createWinId();
_window->windowHandle()->setTransientParent(
parent->windowHandle());
_window->setWindowModality(Qt::WindowModal);
}
const auto parentScreen = handle->screen(); const auto parentScreen = handle->screen();
const auto myScreen = _window->windowHandle()->screen(); const auto myScreen = _window->windowHandle()->screen();
if (parentScreen && myScreen != parentScreen) { if (parentScreen && myScreen != parentScreen) {