From aa974a75e8e9833864d7b8f3617aaab2aa36c6b2 Mon Sep 17 00:00:00 2001 From: ArchieMeng Date: Fri, 20 Oct 2023 10:34:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=9B=B7=E7=A5=9E?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=8A=A8=E7=94=BB=E5=9C=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=B1=8F=E5=B9=95=E4=B8=AD=E7=9A=84=E5=BC=82=E5=B8=B8=E8=A1=A8?= =?UTF-8?q?=E7=8E=B0=20(#309)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅在雷神窗口未显示时调整位置和宽度。 Issue: https://github.com/linuxdeepin/developer-center/issues/5926 Issue: https://github.com/linuxdeepin/developer-center/issues/5927 Log: 修复雷神窗口动画在切换屏幕中的异常表现 Signed-off-by: Yutao Meng --- src/main/windowsmanager.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/windowsmanager.cpp b/src/main/windowsmanager.cpp index 6ac133551..3fb54abc6 100644 --- a/src/main/windowsmanager.cpp +++ b/src/main/windowsmanager.cpp @@ -21,8 +21,11 @@ WindowsManager *WindowsManager::instance() void WindowsManager::runQuakeWindow(TermProperties properties) { if (nullptr == m_quakeWindow) { + QPoint cursorPoint = QCursor::pos(); + const QScreen *cursorScreen = QGuiApplication::screenAt(cursorPoint); qInfo() << "runQuakeWindow :create"; m_quakeWindow = new QuakeWindow(properties); + m_quakeWindow->move(cursorScreen->geometry().topLeft()); //Add by ut001000 renfeixiang 2020-11-16 设置开始雷神动画效果标志 m_quakeWindow->setAnimationFlag(false); m_quakeWindow->show(); @@ -31,17 +34,21 @@ void WindowsManager::runQuakeWindow(TermProperties properties) m_quakeWindow->activateWindow(); return; } - // 雷神窗口移动到光标所在的屏幕 - QPoint cursorPoint = QCursor::pos(); - int windowWidth = QGuiApplication::screenAt(cursorPoint)->geometry().width(); - m_quakeWindow->move(QGuiApplication::screenAt(cursorPoint)->geometry().topLeft()); - m_quakeWindow->setFixedWidth(windowWidth); // Alt+F2的显隐功能实现点 quakeWindowShowOrHide(); } void WindowsManager::quakeWindowShowOrHide() { + QPoint cursorPoint = QCursor::pos(); + const QScreen *quakeScreen = QGuiApplication::screenAt(m_quakeWindow->pos()); + const QScreen *cursorScreen = QGuiApplication::screenAt(cursorPoint); + if (!m_quakeWindow->isVisible() && quakeScreen->serialNumber() != cursorScreen->serialNumber()) { + int windowWidth = cursorScreen->geometry().width(); + m_quakeWindow->move(cursorScreen->geometry().topLeft()); + m_quakeWindow->setFixedWidth(windowWidth); + } + //隐藏 则 显示终端 if (!m_quakeWindow->isVisible()) { m_quakeWindow->setAnimationFlag(false);