Skip to content

Commit 7bf3176

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: resolve focus loss when switching from fullscreen to windowed
1. Added new method setCurrentFrameToWindowedFrame() to handle focus loss issue 2. Implemented delayed frame switching with QTimer to prevent window flickering 3. Modified FullscreenFrame.qml to use new method instead of direct property change 4. The fix addresses a bug where launcher window wouldn't show after switching from fullscreen mode due to focus loss fix: 修复从全屏切换到窗口模式时的焦点丢失问题 1. 新增 setCurrentFrameToWindowedFrame() 方法处理焦点丢失问题 2. 使用 QTimer 实现延迟的框架切换,防止窗口闪烁 3. 修改 FullscreenFrame.qml 使用新方法替代直接属性修改 4. 该修复解决了从全屏模式切换后启动器窗口因焦点丢失无法显示的问题 Pms: BUG-310945
1 parent 9f6b256 commit 7bf3176

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

launchercontroller.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,13 @@ void LauncherController::showHelp()
202202
message << "dde" << helpTitle;
203203
QDBusConnection::sessionBus().asyncCall(message);
204204
}
205+
206+
//首次从全屏切换到窗口时候,会出现焦点丢失抖动问题,从而导致启动器窗口不显示,所以采用此方法处理。
207+
void LauncherController::setCurrentFrameToWindowedFrame()
208+
{
209+
setVisible(false);
210+
QTimer::singleShot(1, this, [this]() {
211+
setCurrentFrame("WindowedFrame");
212+
setVisible(true);
213+
});
214+
}

launchercontroller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class LauncherController : public QObject
5353

5454
Q_INVOKABLE void closeAllPopups();
5555
Q_INVOKABLE void showHelp();
56+
Q_INVOKABLE void setCurrentFrameToWindowedFrame();
5657

5758
signals:
5859
void currentFrameChanged();

qml/FullscreenFrame.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ InputEventItem {
264264
}
265265
onClicked: {
266266
searchEdit.text = ""
267-
LauncherController.currentFrame = "WindowedFrame"
267+
LauncherController.setCurrentFrameToWindowedFrame()
268268
}
269269
}
270270

0 commit comments

Comments
 (0)