Skip to content

Commit

Permalink
fix: 修复雷神窗口动画在切换屏幕中的异常表现
Browse files Browse the repository at this point in the history
Issue: linuxdeepin/developer-center#5926
Issue: linuxdeepin/developer-center#5927
Log: 修复雷神窗口动画在切换屏幕中的异常表现
Signed-off-by: Yutao Meng <[email protected]>
  • Loading branch information
ArchieMeng committed Oct 19, 2023
1 parent 28b21fd commit fb0fcba
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/windowsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit fb0fcba

Please sign in to comment.