Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复雷神窗口动画在切换屏幕中的异常表现 #309

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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