Set parent for dialogs only on Wayland

This commit is contained in:
Ilya Fedin 2020-05-27 09:50:07 +04:00 committed by John Preston
parent b7aa60bedf
commit be96bf2812
5 changed files with 11 additions and 3 deletions

View File

@ -301,7 +301,7 @@ QImage Panel::Button::prepareRippleMask() const {
}
Panel::Panel(not_null<Call*> call)
: RpWidget(App::wnd())
: RpWidget(Core::App().getModalParent())
, _call(call)
, _user(call->user())
, _answerHangupRedial(this, st::callAnswer, &st::callHangup)

View File

@ -767,6 +767,13 @@ void Application::notifyFileDialogShown(bool shown) {
}
}
QWidget *Application::getModalParent() {
return QGuiApplication::platformName().startsWith(qsl("wayland"), Qt::CaseInsensitive)
? App::wnd()
: nullptr;
}
void Application::checkMediaViewActivation() {
if (_mediaView && !_mediaView->isHidden()) {
_mediaView->activateWindow();

View File

@ -101,6 +101,7 @@ public:
bool minimizeActiveWindow();
QWidget *getFileDialogParent();
void notifyFileDialogShown(bool shown);
QWidget *getModalParent();
// Media view interface.
void checkMediaViewActivation();

View File

@ -431,7 +431,7 @@ NotificationsCount::~NotificationsCount() {
NotificationsCount::SampleWidget::SampleWidget(
NotificationsCount *owner,
const QPixmap &cache)
: QWidget(App::wnd())
: QWidget(Core::App().getModalParent())
, _owner(owner)
, _cache(cache) {
const QSize size(

View File

@ -375,7 +375,7 @@ Widget::Widget(
QPoint startPosition,
int shift,
Direction shiftDirection)
: TWidget(App::wnd())
: TWidget(Core::App().getModalParent())
, _manager(manager)
, _startPosition(startPosition)
, _direction(shiftDirection)