fix(frame): 多屏对角拼接时任务栏消失

在对角位错位时原有代码判断失效,现加上判断对角情况,另修改上下判断出错问题

Log: 修复多屏条件下两个显示器成对角拼接时,调整任务栏为最左或最右后,任务栏消失问题
Bug: https://pms.uniontech.com/zentao/bug-view-27364.html
This commit is contained in:
zhaolong 2020-05-21 17:20:39 +08:00
parent 9dec7f3ebe
commit fd823f5383
2 changed files with 49 additions and 46 deletions

View File

@ -803,6 +803,7 @@ void DockSettings::calculateRelativePos(Monitor *s1, Monitor *s2)
// 对齐
bool isAligment = false;
// 左右拼
if (s1->bottom() > s2->top() && s1->top() < s2->bottom()) {
// s1左 s2右
if (s1->right() == s2->left() ) {
isAligment = (s1->topRight() == s2->topLeft())
@ -831,9 +832,11 @@ void DockSettings::calculateRelativePos(Monitor *s1, Monitor *s2)
s2->dockPosition().rightDock = false;
}
}
}
// 上下拼
if (s1->right() > s2->left() && s1->left() < s2->right()) {
// s1上 s2下
if (s1->top() == s2->bottom()) {
if (s1->bottom() == s2->top()) {
isAligment = (s1->bottomLeft() == s2->topLeft())
&& (s1->bottomRight() == s2->topRight());
if (isAligment) {
@ -847,7 +850,7 @@ void DockSettings::calculateRelativePos(Monitor *s1, Monitor *s2)
}
}
// s1下 s2上
if (s1->bottom() == s2->top()) {
if (s1->top() == s2->bottom()) {
isAligment = (s1->topLeft() == s2->bottomLeft())
&& (s1->topRight() == s2->bottomRight());
if (isAligment) {
@ -860,7 +863,7 @@ void DockSettings::calculateRelativePos(Monitor *s1, Monitor *s2)
s2->dockPosition().bottomDock = false;
}
}
}
// 对角拼
bool isDiagonal = (s1->topLeft() == s2->bottomRight())
|| (s1->topRight() == s2->bottomLeft())
@ -868,9 +871,9 @@ void DockSettings::calculateRelativePos(Monitor *s1, Monitor *s2)
|| (s1->bottomRight() == s2->topLeft());
if (isDiagonal) {
auto position = Monitor::DockPosition(false, false, false, false);
if (!s1->isPrimary())
if (s1->isPrimary())
s2->setDockPosition(position);
if (!s2->isPrimary())
if (s2->isPrimary())
s1->setDockPosition(position);
switch (m_position) {

View File

@ -721,7 +721,7 @@ void MainWindow::setStrutPartial()
// pass if strut area is intersect with other screen
//优化了文件管理的代码 会导致bug 15351 需要注释一下代码
// int count = 0;
// const QRect pr = m_settings->primaryRect();
// const QRect pr = m_settings->currentRawRect();
// for (auto *screen : qApp->screens()) {
// const QRect sr = screen->geometry();
// if (sr == pr)