2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25: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

@@ -455,7 +455,7 @@ void MainWindow::LibsLoaded() {
}
}
void MainWindow::psFirstShow() {
void MainWindow::initTrayMenuHook() {
const auto trayAvailable = IsSNIAvailable()
|| QSystemTrayIcon::isSystemTrayAvailable();
@@ -490,30 +490,6 @@ void MainWindow::psFirstShow() {
LOG(("Not using Unity Launcher count."));
}
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
show();
if (cWindowPos().maximized) {
DEBUG_LOG(("Window Pos: First show, setting maximized."));
setWindowState(Qt::WindowMaximized);
}
if ((cLaunchMode() == LaunchModeAutoStart && cStartMinimized())
|| cStartInTray()) {
// If I call hide() synchronously here after show() then on Ubuntu 14.04
// it will show a window frame with transparent window body, without content.
// And to be able to "Show from tray" one more hide() will be required.
crl::on_main(this, [=] {
setWindowState(Qt::WindowMinimized);
if (Global::WorkMode().value() == dbiwmTrayOnly
|| Global::WorkMode().value() == dbiwmWindowAndTray) {
hide();
} else {
show();
}
});
}
setPositionInited();
}
MainWindow::~MainWindow() {

View File

@@ -24,8 +24,6 @@ class MainWindow : public Window::MainWindow {
public:
explicit MainWindow(not_null<Window::Controller*> controller);
void psFirstShow();
virtual QImage iconWithCounter(
int size,
int count,
@@ -43,6 +41,7 @@ public slots:
protected:
void unreadCounterChangedHook() override;
void initTrayMenuHook() override;
bool hasTrayIcon() const override;
void workmodeUpdated(DBIWorkMode mode) override;