mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix(frame): 多屏齐接时衔接处闪烁
dock做收缩动画时求取dock的位置非当前屏,而是计算后可停靠dock的屏 Log: 修复多屏对齐拼接条件下,调整dock位置时会在衔接处闪烁的问题 Bug: https://pms.uniontech.com/zentao/bug-view-29144.html
This commit is contained in:
parent
107220de8f
commit
fbd08071a4
@ -209,34 +209,40 @@ const QRect DockSettings::primaryRect() const
|
||||
return rect;
|
||||
}
|
||||
|
||||
const QRect DockSettings::currentRect()
|
||||
const QRect DockSettings::currentRect(const bool beNarrow)
|
||||
{
|
||||
QRect rect;
|
||||
QString currentScrName;
|
||||
if (m_isMouseMoveCause) {
|
||||
rect = m_mouseCauseDockScreen->rect();
|
||||
currentScrName = m_mouseCauseDockScreen->name();
|
||||
} else {
|
||||
bool positionAllowed = false;
|
||||
QList<Monitor*> monitors = m_monitors.keys();
|
||||
for (Monitor *monitor : monitors) {
|
||||
switch (m_position) {
|
||||
case Top: positionAllowed = monitor->dockPosition().topDock; break;
|
||||
case Right: positionAllowed = monitor->dockPosition().rightDock; break;
|
||||
case Bottom: positionAllowed = monitor->dockPosition().bottomDock; break;
|
||||
case Left: positionAllowed = monitor->dockPosition().leftDock; break;
|
||||
}
|
||||
if (positionAllowed) {
|
||||
rect = monitor->rect();
|
||||
currentScrName = monitor->name();
|
||||
if (monitor->isPrimary())
|
||||
break;
|
||||
if (!beNarrow) {
|
||||
if (m_isMouseMoveCause) {
|
||||
rect = m_mouseCauseDockScreen->rect();
|
||||
currentScrName = m_mouseCauseDockScreen->name();
|
||||
} else {
|
||||
bool positionAllowed = false;
|
||||
QList<Monitor*> monitors = m_monitors.keys();
|
||||
for (Monitor *monitor : monitors) {
|
||||
switch (m_position) {
|
||||
case Top: positionAllowed = monitor->dockPosition().topDock; break;
|
||||
case Right: positionAllowed = monitor->dockPosition().rightDock; break;
|
||||
case Bottom: positionAllowed = monitor->dockPosition().bottomDock; break;
|
||||
case Left: positionAllowed = monitor->dockPosition().leftDock; break;
|
||||
}
|
||||
if (positionAllowed) {
|
||||
rect = monitor->rect();
|
||||
currentScrName = monitor->name();
|
||||
if (monitor->isPrimary())
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_currentScreen = currentScrName;
|
||||
m_currentRawRect = rect;
|
||||
|
||||
} else {
|
||||
rect = m_currentRawRect;
|
||||
}
|
||||
|
||||
m_currentScreen = currentScrName;
|
||||
m_currentRawRect = rect;
|
||||
qreal scale = qApp->primaryScreen()->devicePixelRatio();
|
||||
rect.setWidth(std::round(qreal(rect.width()) / scale));
|
||||
rect.setHeight(std::round(qreal(rect.height()) / scale));
|
||||
@ -256,7 +262,7 @@ const int DockSettings::dockMargin() const
|
||||
// return m_mainWindowSize;
|
||||
//}
|
||||
|
||||
const QRect DockSettings::windowRect(const Position position, const bool hide)
|
||||
const QRect DockSettings::windowRect(const Position position, const bool hide, const bool beNarrow)
|
||||
{
|
||||
QSize size = m_mainWindowSize;
|
||||
if (hide) {
|
||||
@ -268,7 +274,8 @@ const QRect DockSettings::windowRect(const Position position, const bool hide)
|
||||
}
|
||||
}
|
||||
|
||||
const QRect primaryRect = this->currentRect();
|
||||
|
||||
const QRect primaryRect = this->currentRect(beNarrow);
|
||||
const int offsetX = (primaryRect.width() - size.width()) / 2;
|
||||
const int offsetY = (primaryRect.height() - size.height()) / 2;
|
||||
int margin = hide ? 0 : this->dockMargin();
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
inline int narrowTimeout() const { return 100; }
|
||||
inline bool autoHide() const { return m_autoHide; }
|
||||
const QRect primaryRect() const;
|
||||
const QRect currentRect();
|
||||
const QRect currentRect(const bool beNarrow = false);
|
||||
const QList<QRect> monitorsRect() const;
|
||||
inline const QRect primaryRawRect() const { return m_primaryRawRect; }
|
||||
inline const QRect currentRawRect() const { return m_currentRawRect; }
|
||||
@ -67,7 +67,7 @@ public:
|
||||
const int dockMargin() const;
|
||||
|
||||
// const QSize panelSize() const;
|
||||
const QRect windowRect(const Position position, const bool hide = false);
|
||||
const QRect windowRect(const Position position, const bool hide = false, const bool beNarrow = false);
|
||||
qreal dockRatio() const;
|
||||
|
||||
void showDockSettingsMenu();
|
||||
|
@ -231,7 +231,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
// dock的宽度或高度
|
||||
int val = value.toInt();
|
||||
// dock隐藏后的rect
|
||||
const QRect windowRect = m_settings->windowRect(m_dockPosition, false);
|
||||
const QRect windowRect = m_settings->windowRect(m_dockPosition, false, true);
|
||||
const int margin = m_settings->dockMargin();
|
||||
|
||||
if (!m_mouseCauseDock) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user