-
Notifications
You must be signed in to change notification settings - Fork 58
fix: prevent dock screen switch if any popup is showing #1423
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
41dd695 to
c902e01
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
38f7150 to
0f7ca3d
Compare
include minisize luancher, tray plugin popup and tray menu fix: prevent dock screen switch if any popup is showing Pms: BUG-288701
0f7ca3d to
7ec31a9
Compare
deepin pr auto review这段代码的修改旨在防止在存在弹窗或瞬时子窗口时切换屏幕,这是一个合理的需求。以下是对这段代码的详细审查,包括语法逻辑、代码质量、代码性能和代码安全方面的改进意见: 1. 语法逻辑问题:
改进建议: for (auto isShowing : m_transientChildShows) {
if (isShowing) {
parent()->setHideState(Show);
return;
}
}或者更明确地: for (const auto& isShowing : m_transientChildShows) {
if (isShowing) {
parent()->setHideState(Show);
return;
}
}2. 代码质量问题:
改进建议: // Do not switch screen if any popup/transient child window is showing
// to avoid unexpected behavior or loss of focus
for (const auto& isShowing : m_transientChildShows) {
if (isShowing) {
if (auto dockParent = parent()) {
dockParent->setHideState(Show);
}
return;
}
}3. 代码性能问题:
改进建议:
4. 代码安全问题:
改进建议: // Assuming m_transientChildShows is accessed only from the main thread
// If not, add appropriate synchronization
for (const auto& isShowing : m_transientChildShows) {
if (isShowing) {
if (auto dockParent = parent()) {
dockParent->setHideState(Show);
}
return;
}
}综合改进后的代码:void DockHelper::enterScreen(QScreen *screen)
{
if (!screen) {
return;
}
// Do not switch screen if any popup/transient child window is showing
// to avoid unexpected behavior or loss of focus
for (const auto& isShowing : m_transientChildShows) {
if (isShowing) {
if (auto dockParent = parent()) {
dockParent->setHideState(Show);
}
return;
}
}
QTimer::singleShot(200, [this, screen]() {
if (auto dockParent = parent()) {
dockParent->setDockScreen(screen);
dockParent->setHideState(Show);
}
});
}总结
这些改进将使代码更健壮、可读性更好,并减少潜在的错误。 |
include minisize luancher, tray plugin popup and tray menu
fix: prevent dock screen switch if any popup is showing
Pms: BUG-288701