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: use timer to avoid window hide caused by switching mode #58

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions launchercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
settings.setValue("current_frame", frame);

m_currentFrame = frame;
m_timer->start();
emit currentFrameChanged();
}

Expand All @@ -141,3 +142,8 @@
setVisible(false);
}
}

bool LauncherController::shouldAvoidHideOrActive()

Check warning on line 146 in launchercontroller.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'shouldAvoidHideOrActive' is never used.
{
return m_timer->isActive();
}
1 change: 1 addition & 0 deletions launchercontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class LauncherController : public QObject
void setCurrentFrame(const QString & frame);

Q_INVOKABLE void hideWithTimer();
Q_INVOKABLE bool shouldAvoidHideOrActive();

signals:
void currentFrameChanged();
Expand Down
8 changes: 7 additions & 1 deletion qml/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ QtObject {

onActiveChanged: {
if (!active && !DebugHelper.avoidHideWindow && (LauncherController.currentFrame === "WindowedFrame")) {
LauncherController.hideWithTimer()
// 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()
}
}
}

Expand Down
Loading