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) Panel::Panel(not_null<Call*> call)
: RpWidget(App::wnd()) : RpWidget(Core::App().getModalParent())
, _call(call) , _call(call)
, _user(call->user()) , _user(call->user())
, _answerHangupRedial(this, st::callAnswer, &st::callHangup) , _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() { void Application::checkMediaViewActivation() {
if (_mediaView && !_mediaView->isHidden()) { if (_mediaView && !_mediaView->isHidden()) {
_mediaView->activateWindow(); _mediaView->activateWindow();

View File

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

View File

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

View File

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