2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Fix bad window rendering with maximize-on-launch.

I have no idea why MainWindow is ruined completely in case you call
MainWindow::show, MainWindow::setWindowState(maximized) and then
in the same context (without crl::on_main) create full screen viewer.
This commit is contained in:
John Preston
2020-02-12 12:09:17 +04:00
parent 1a2b2c15c5
commit a88423a33f
12 changed files with 81 additions and 89 deletions

View File

@@ -235,13 +235,16 @@ void Application::run() {
_window->setupIntro();
}
}
DEBUG_LOG(("Application Info: showing."));
_window->firstShow();
_window->widget()->show();
const auto currentGeometry = _window->widget()->geometry();
_mediaView = std::make_unique<Media::View::OverlayWidget>();
_window->widget()->setGeometry(currentGeometry);
DEBUG_LOG(("Application Info: showing."));
_window->finishFirstShow();
if (!locked() && cStartToSettings()) {
_window->showSettings();
}
@@ -274,6 +277,8 @@ void Application::showPhoto(not_null<const PhotoOpenClickHandler*> link) {
}
void Application::showPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
Expects(_mediaView != nullptr);
_mediaView->showPhoto(photo, item);
_mediaView->activateWindow();
_mediaView->setFocus();
@@ -282,12 +287,16 @@ void Application::showPhoto(not_null<PhotoData*> photo, HistoryItem *item) {
void Application::showPhoto(
not_null<PhotoData*> photo,
not_null<PeerData*> peer) {
Expects(_mediaView != nullptr);
_mediaView->showPhoto(photo, peer);
_mediaView->activateWindow();
_mediaView->setFocus();
}
void Application::showDocument(not_null<DocumentData*> document, HistoryItem *item) {
Expects(_mediaView != nullptr);
if (cUseExternalVideoPlayer()
&& document->isVideoFile()
&& document->loaded()) {
@@ -302,6 +311,8 @@ void Application::showDocument(not_null<DocumentData*> document, HistoryItem *it
void Application::showTheme(
not_null<DocumentData*> document,
const Data::CloudTheme &cloud) {
Expects(_mediaView != nullptr);
_mediaView->showTheme(document, cloud);
_mediaView->activateWindow();
_mediaView->setFocus();