mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix window position error when multi screen
https://bugzilla.deepin.io/show_bug.cgi?id=9080 Change-Id: I74a1f267c2347c9927175c89c6c29a919281bc5a
This commit is contained in:
parent
416fec0503
commit
d40ecbb5b9
Notes:
Deepin Code Review
2016-08-30 06:38:21 +00:00
Verified+1: Anonymous Coward #1000004 Verified+1: <zhaofangfang@linuxdeepin.com> Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 30 Aug 2016 06:38:21 +0000 Reviewed-on: https://cr.deepin.io/15666 Project: dde/dde-dock Branch: refs/heads/master
@ -171,17 +171,17 @@ const QRect DockSettings::windowRect(const Position position) const
|
||||
switch (position)
|
||||
{
|
||||
case Top:
|
||||
p = QPoint(primaryRect.topLeft().x() + offsetX, 0); break;
|
||||
p = QPoint(offsetX, 0); break;
|
||||
case Left:
|
||||
p = QPoint(primaryRect.topLeft().x(), offsetY); break;
|
||||
p = QPoint(0, offsetY); break;
|
||||
case Right:
|
||||
p = QPoint(primaryRect.right() - size.width() + 1, offsetY); break;
|
||||
p = QPoint(primaryRect.width() - size.width(), offsetY); break;
|
||||
case Bottom:
|
||||
p = QPoint(offsetX, primaryRect.bottom() - size.height() + 1); break;
|
||||
p = QPoint(offsetX, primaryRect.height() - size.height()); break;
|
||||
default:Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
return QRect(p, size);
|
||||
return QRect(primaryRect.topLeft() + p, size);
|
||||
}
|
||||
|
||||
void DockSettings::showDockSettingsMenu()
|
||||
|
@ -225,23 +225,25 @@ void MainWindow::updateGeometry()
|
||||
setFixedSize(size);
|
||||
}
|
||||
|
||||
const QRect primaryRect = m_settings->primaryRect();
|
||||
const int offsetX = (primaryRect.width() - size.width()) / 2;
|
||||
const int offsetY = (primaryRect.height() - size.height()) / 2;
|
||||
// const QRect primaryRect = m_settings->primaryRect();
|
||||
// const int offsetX = (primaryRect.width() - size.width()) / 2;
|
||||
// const int offsetY = (primaryRect.height() - size.height()) / 2;
|
||||
|
||||
switch (position)
|
||||
{
|
||||
case Top:
|
||||
move(primaryRect.topLeft().x() + offsetX, primaryRect.y()); break;
|
||||
case Left:
|
||||
move(primaryRect.topLeft().x(), primaryRect.y() + offsetY); break;
|
||||
case Right:
|
||||
move(primaryRect.right() - size.width() + 1, primaryRect.y() + offsetY); break;
|
||||
case Bottom:
|
||||
move(primaryRect.x() + offsetX, primaryRect.bottom() - size.height() + 1); break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
// switch (position)
|
||||
// {
|
||||
// case Top:
|
||||
// move(primaryRect.topLeft().x() + offsetX, primaryRect.y()); break;
|
||||
// case Left:
|
||||
// move(primaryRect.topLeft().x(), primaryRect.y() + offsetY); break;
|
||||
// case Right:
|
||||
// move(primaryRect.right() - size.width() + 1, primaryRect.y() + offsetY); break;
|
||||
// case Bottom:
|
||||
// move(primaryRect.x() + offsetX, primaryRect.bottom() - size.height() + 1); break;
|
||||
// default:
|
||||
// Q_ASSERT(false);
|
||||
// }
|
||||
const QRect windowRect = m_settings->windowRect(position);
|
||||
move(windowRect.x(), windowRect.y());
|
||||
|
||||
m_mainPanel->update();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user