Merge pull request #49 from JulienMaille/patch-1

simple fix without the 500ms lag
This commit is contained in:
Yuhang Zhao 2021-03-15 19:58:22 +08:00 committed by GitHub
commit a8228cf422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 8 deletions

View File

@ -51,14 +51,7 @@ void FramelessWindowsManager::addWindow(const QWindow *window)
// Work-around a Win32 multi-monitor bug. // Work-around a Win32 multi-monitor bug.
QObject::connect(win, &QWindow::screenChanged, [win](QScreen *screen){ QObject::connect(win, &QWindow::screenChanged, [win](QScreen *screen){
Q_UNUSED(screen); Q_UNUSED(screen);
const QSize originalSize = win->size(); win->resize(win->size());
// Don't make the tempSize too large/small otherwise the user will see the resize.
const QSize tempSize = originalSize + QSize{1, 1};
// Do a resize manually to forcely trigger the re-layout and re-paint of the window.
win->resize(tempSize);
// We need to let the OS have enough time to do the actual change.
QThread::msleep(500); // FIXME: is it enough?
win->resize(originalSize);
}); });
#else #else
framelessHelper()->removeWindowFrame(const_cast<QWindow *>(window)); framelessHelper()->removeWindowFrame(const_cast<QWindow *>(window));