Skip to content

Commit

Permalink
fix: cannot hide the window after switching to windowed mode
Browse files Browse the repository at this point in the history
为了解决 https://github.com/linuxdeepin/developer-center/issues/6818,
设置了忽略切换模式后 1s 内的 activeChanged 事件。
导致切换到窗口模式后, 1s 内点击空白处,窗口无法再关闭

Issues: linuxdeepin/developer-center#8916
  • Loading branch information
zsien authored and xionglinlin committed Jun 27, 2024
1 parent 41787dc commit 6d7e942
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
6 changes: 0 additions & 6 deletions launchercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ void LauncherController::setCurrentFrame(const QString &frame)

m_currentFrame = frame;
qDebug() << "set current frame:" << m_currentFrame;
m_timer->start();
emit currentFrameChanged();
}

Expand All @@ -154,11 +153,6 @@ void LauncherController::hideWithTimer()
}
}

bool LauncherController::shouldAvoidHideOrActive()
{
return m_timer->isActive();
}

QFont LauncherController::adjustFontWeight(const QFont &f, QFont::Weight weight)
{
QFont font(f);
Expand Down
1 change: 0 additions & 1 deletion launchercontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class LauncherController : public QObject
void setCurrentFrame(const QString & frame);

Q_INVOKABLE void hideWithTimer();
Q_INVOKABLE bool shouldAvoidHideOrActive();
Q_INVOKABLE QFont adjustFontWeight(const QFont& f, QFont::Weight weight);

signals:
Expand Down
16 changes: 2 additions & 14 deletions qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,7 @@ QtObject {

onActiveChanged: {
if (!active && !DebugHelper.avoidHideWindow && (LauncherController.currentFrame === "WindowedFrame")) {
// When composting is disabled, switching mode from fullscreen to windowed mode will cause window
// activeChanged signal get emitted. We reused the delay timer here to avoid the window get hide
// caused by that.
// Issue: https://github.com/linuxdeepin/developer-center/issues/6818
if (!LauncherController.shouldAvoidHideOrActive()) {
LauncherController.hideWithTimer()
}
LauncherController.hideWithTimer()
}
}

Expand Down Expand Up @@ -300,13 +294,7 @@ QtObject {

onActiveChanged: {
if (!active && !DebugHelper.avoidHideWindow && (LauncherController.currentFrame === "FullscreenFrame")) {
// When composting is disabled, switching mode from fullscreen to windowed mode will cause window
// activeChanged signal get emitted. We reused the delay timer here to avoid the window get hide
// caused by that.
// Issue: https://github.com/linuxdeepin/developer-center/issues/6818
if (!LauncherController.shouldAvoidHideOrActive()) {
LauncherController.hideWithTimer()
}
LauncherController.hideWithTimer()
}
}

Expand Down

0 comments on commit 6d7e942

Please sign in to comment.