From 508fa1438514bb234204322bb069adac23ca7926 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 16 Oct 2017 17:16:01 +0300 Subject: [PATCH] Workaround render glitches on new MacBooks. For unknown reason large windows have bad render glitches in High Sierra. Forcing of OpenGL composition (by adding a fake child QOpenGLWidget) fixes it. --- Telegram/SourceFiles/messenger.cpp | 1 - Telegram/SourceFiles/platform/mac/main_window_mac.mm | 2 ++ Telegram/SourceFiles/window/main_window.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/messenger.cpp b/Telegram/SourceFiles/messenger.cpp index 08489cfbce..ca9235facf 100644 --- a/Telegram/SourceFiles/messenger.cpp +++ b/Telegram/SourceFiles/messenger.cpp @@ -129,7 +129,6 @@ Messenger::Messenger() : QObject() QMimeDatabase().mimeTypeForName(qsl("text/plain")); _window = std::make_unique(); - _window->createWinId(); _window->init(); auto currentGeometry = _window->geometry(); diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index b433bcb641..83321ec4f8 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -216,6 +216,8 @@ MainWindow::Private::~Private() { MainWindow::MainWindow() : _private(std::make_unique(this)) { + auto forceOpenGL = std::make_unique(this); + trayImg = st::macTrayIcon.instance(QColor(0, 0, 0, 180), dbisOne); trayImgSel = st::macTrayIcon.instance(QColor(255, 255, 255), dbisOne); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 54a805fc95..1363865b59 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -135,6 +135,9 @@ void MainWindow::updateWindowIcon() { } void MainWindow::init() { + Expects(!windowHandle()); + createWinId(); + initHook(); updateWindowIcon();