Get rid of modal parent hack

It was introduced to workaround the absence of size hints propagating in Qt 5.12 Wayland backend, there's no need in it anymore
This commit is contained in:
Ilya Fedin 2021-04-02 15:29:47 +04:00 committed by John Preston
parent 0cd8cc67c5
commit 073b5b106c
8 changed files with 4 additions and 22 deletions

View file

@ -253,7 +253,6 @@ std::unique_ptr<PeerListRow> InviteContactsController::createRow(
Panel::Panel(not_null<GroupCall*> call)
: _call(call)
, _peer(call->peer())
, _window(std::make_unique<Ui::Window>(Core::App().getModalParent()))
, _layerBg(std::make_unique<Ui::LayerManager>(_window->body()))
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(

View file

@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/empty_userpic.h"
#include "ui/emoji_config.h"
#include "core/application.h"
#include "mainwindow.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "apiwrap.h"
@ -185,7 +184,6 @@ void Panel::Incoming::fillBottomShadow(QPainter &p) {
Panel::Panel(not_null<Call*> call)
: _call(call)
, _user(call->user())
, _window(std::make_unique<Ui::Window>(Core::App().getModalParent()))
#ifndef Q_OS_MAC
, _controls(std::make_unique<Ui::Platform::TitleControls>(
_window->body(),

View file

@ -23,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/ui_integration.h"
#include "chat_helpers/emoji_keywords.h"
#include "chat_helpers/stickers_emoji_image_loader.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/base_platform_last_input.h"
#include "platform/platform_specific.h"
#include "mainwindow.h"
@ -977,13 +976,6 @@ void Application::notifyFileDialogShown(bool shown) {
}
}
QWidget *Application::getModalParent() {
return (Platform::IsWayland() && activeWindow())
? activeWindow()->widget().get()
: nullptr;
}
void Application::checkMediaViewActivation() {
if (_mediaView && !_mediaView->isHidden()) {
_mediaView->activateWindow();

View file

@ -139,7 +139,6 @@ public:
bool minimizeActiveWindow();
[[nodiscard]] QWidget *getFileDialogParent();
void notifyFileDialogShown(bool shown);
[[nodiscard]] QWidget *getModalParent();
void checkSystemDarkMode();
// Media view interface.

View file

@ -373,8 +373,7 @@ QImage RotateFrameImage(QImage image, int rotation) {
PipPanel::PipPanel(
QWidget *parent,
Fn<void(QPainter&, FrameRequest)> paint)
: PipParent(Core::App().getModalParent())
, _parent(parent)
: _parent(parent)
, _paint(std::move(paint)) {
setWindowFlags(Qt::Tool
| Qt::WindowStaysOnTopHint

View file

@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_specific.h"
#include "platform/platform_notifications_manager.h"
#include "base/platform/base_platform_info.h"
#include "mainwindow.h"
#include "core/application.h"
#include "main/main_session.h"
#include "main/main_account.h"
@ -438,8 +437,7 @@ NotificationsCount::~NotificationsCount() {
NotificationsCount::SampleWidget::SampleWidget(
NotificationsCount *owner,
const QPixmap &cache)
: QWidget(Core::App().getModalParent())
, _owner(owner)
: _owner(owner)
, _cache(cache) {
const QSize size(
cache.width() / cache.devicePixelRatio(),

View file

@ -31,8 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Ui {
SeparatePanel::SeparatePanel()
: RpWidget(Core::App().getModalParent())
, _close(this, st::separatePanelClose)
: _close(this, st::separatePanelClose)
, _back(this, object_ptr<Ui::IconButton>(this, st::separatePanelBack))
, _body(this) {
setMouseTracking(true);

View file

@ -30,7 +30,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/call_delayed.h"
#include "facades.h"
#include "app.h"
#include "mainwindow.h"
#include "styles/style_dialogs.h"
#include "styles/style_layers.h"
#include "styles/style_window.h"
@ -422,8 +421,7 @@ Widget::Widget(
QPoint startPosition,
int shift,
Direction shiftDirection)
: RpWidget(Core::App().getModalParent())
, _manager(manager)
: _manager(manager)
, _startPosition(startPosition)
, _direction(shiftDirection)
, _shift(shift)