mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
change frontwindow interface
Change-Id: Id79372ae63df249e131a986009f9ff4732fb6c00
This commit is contained in:
parent
d65e274e25
commit
4ab6caff79
@ -120,11 +120,11 @@ public Q_SLOTS: // METHODS
|
||||
return asyncCallWithArgumentList(QStringLiteral("MoveEntry"), args);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetFrontendWindow(uint in0)
|
||||
inline QDBusPendingReply<> SetFrontendWindowRect(const int x, const int y, const quint32 width, const quint32 height)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetFrontendWindow"), argumentList);
|
||||
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(width) << QVariant::fromValue(height);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetFrontendWindowRect"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
|
@ -31,7 +31,7 @@ DockSettings::DockSettings(QWidget *parent)
|
||||
m_dockInter(new DBusDock(this)),
|
||||
m_itemController(DockItemController::instance(this))
|
||||
{
|
||||
resetFrontendWinId();
|
||||
resetFrontendGeometry();
|
||||
m_primaryRect = m_displayInter->primaryRect();
|
||||
m_position = Dock::Position(m_dockInter->position());
|
||||
m_displayMode = Dock::DisplayMode(m_dockInter->displayMode());
|
||||
@ -96,7 +96,7 @@ DockSettings::DockSettings(QWidget *parent)
|
||||
connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &DockSettings::displayModeChanged);
|
||||
connect(m_dockInter, &DBusDock::HideModeChanged, this, &DockSettings::hideModeChanged);
|
||||
connect(m_dockInter, &DBusDock::HideStateChanged, this, &DockSettings::hideStateChanegd);
|
||||
connect(m_dockInter, &DBusDock::ServiceRestarted, this, &DockSettings::resetFrontendWinId);
|
||||
connect(m_dockInter, &DBusDock::ServiceRestarted, this, &DockSettings::resetFrontendGeometry);
|
||||
|
||||
connect(m_itemController, &DockItemController::itemInserted, this, &DockSettings::dockItemCountChanged, Qt::QueuedConnection);
|
||||
connect(m_itemController, &DockItemController::itemRemoved, this, &DockSettings::dockItemCountChanged, Qt::QueuedConnection);
|
||||
@ -280,9 +280,27 @@ void DockSettings::primaryScreenChanged()
|
||||
emit dataChanged();
|
||||
}
|
||||
|
||||
void DockSettings::resetFrontendWinId()
|
||||
void DockSettings::resetFrontendGeometry()
|
||||
{
|
||||
m_dockInter->SetFrontendWindow(static_cast<QWidget *>(parent())->winId());
|
||||
const QSize size = m_mainWindowSize;
|
||||
const QRect primaryRect = m_primaryRect;
|
||||
const int offsetX = (primaryRect.width() - size.width()) / 2;
|
||||
const int offsetY = (primaryRect.height() - size.height()) / 2;
|
||||
|
||||
QPoint p(0, 0);
|
||||
switch (m_position)
|
||||
{
|
||||
case Top:
|
||||
p = QPoint(primaryRect.topLeft().x() + offsetX, 0); break;
|
||||
case Left:
|
||||
p = QPoint(primaryRect.topLeft().x(), offsetY); break;
|
||||
case Right:
|
||||
p = QPoint(primaryRect.right() - size.width() + 1, offsetY); break;
|
||||
case Bottom:
|
||||
p = QPoint(offsetX, primaryRect.bottom() - size.height() + 1); break;
|
||||
}
|
||||
|
||||
m_dockInter->SetFrontendWindowRect(p.x(), p.y(), size.width(), size.height());
|
||||
}
|
||||
|
||||
void DockSettings::calculateWindowConfig()
|
||||
@ -367,4 +385,6 @@ void DockSettings::calculateWindowConfig()
|
||||
} else {
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
resetFrontendGeometry();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ private slots:
|
||||
void dockItemCountChanged();
|
||||
void primaryScreenChanged();
|
||||
|
||||
void resetFrontendWinId();
|
||||
void resetFrontendGeometry();
|
||||
|
||||
private:
|
||||
void calculateWindowConfig();
|
||||
|
Loading…
x
Reference in New Issue
Block a user