mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复系统刚启动时插拔屏幕导致的任务栏不显示问题
插拔屏幕过程中,使用qt的方法获取的屏幕名与后端的display服务中获取的屏幕名不一致,导致异常 这里改成主屏幕名也使用后端的数据 Log: 修复系统刚启动时插拔屏幕导致的任务栏不显示问题 Change-Id: I80c3fb940f30b923294b92363aaccf9a3ce3183c Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/5562 Reviewed-by: <mailman@uniontech.com> Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
ff96316835
commit
ca88882ccb
@ -717,7 +717,7 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
XcbMisc::instance()->clear_strut_partial(xcb_window_t(parent()->winId()));
|
||||
|
||||
// 在副屏时,且为一直显示时,不要挤占应用,这是sp3的新需求
|
||||
if (m_ds.current() != qApp->primaryScreen()->name() && m_hideMode == HideMode::KeepShowing) {
|
||||
if (m_ds.current() != m_ds.primary() && m_hideMode == HideMode::KeepShowing) {
|
||||
qDebug() << "don`t set dock area";
|
||||
return;
|
||||
}
|
||||
@ -994,19 +994,18 @@ void MultiScreenWorker::initConnection()
|
||||
parent()->panel()->update();
|
||||
});
|
||||
|
||||
// 此时屏幕的显示器信息已经更新到m_mtrInfo中,需要根据这些信息顺序更新任务栏的以下信息:
|
||||
//1、屏幕停靠信息,
|
||||
//2、任务栏当前显示在哪个屏幕也需要更新
|
||||
//2、监视任务栏唤醒区域信息,
|
||||
//3、任务栏高度或宽度调整的拖拽区域,
|
||||
//4、通知窗管的任务栏显示区域信息,
|
||||
//5、通知后端的任务栏显示区域信息
|
||||
connect(m_monitorUpdateTimer, &QTimer::timeout, this, [ = ] {
|
||||
// 更新屏幕停靠信息
|
||||
updateMonitorDockedInfo();
|
||||
// 更新所在屏幕
|
||||
resetDockScreen();
|
||||
// 更新任务栏自身信息
|
||||
/**
|
||||
*注意这里要先对parent()进行setFixedSize,在分辨率切换过程中,setGeometry可能会导致其大小未改变
|
||||
*/
|
||||
parent()->setFixedSize(dockRect(m_ds.current()).size());
|
||||
parent()->setGeometry(dockRect(m_ds.current()));
|
||||
parent()->panel()->setFixedSize(dockRect(m_ds.current()).size());
|
||||
parent()->panel()->move(0, 0);
|
||||
// 通知后端
|
||||
emit requestUpdateFrontendGeometry();
|
||||
// 拖拽区域
|
||||
@ -1254,14 +1253,15 @@ QString MultiScreenWorker::getValidScreen(const Position &pos)
|
||||
// 查找主屏
|
||||
QString primaryName;
|
||||
foreach (auto monitor, monitorList) {
|
||||
if (monitor->name() == qApp->primaryScreen()->name()) {
|
||||
if (monitor->name() == m_ds.primary()) {
|
||||
primaryName = monitor->name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (primaryName.isEmpty()) {
|
||||
qDebug() << "cannnot find primary screen";
|
||||
qDebug() << "cannnot find primary screen, wait for 3s to update...";
|
||||
QTimer::singleShot(3000, this, &MultiScreenWorker::requestUpdateMonitorInfo);
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -1304,6 +1304,15 @@ void MultiScreenWorker::resetDockScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新任务栏自身信息
|
||||
/**
|
||||
*注意这里要先对parent()进行setFixedSize,在分辨率切换过程中,setGeometry可能会导致其大小未改变
|
||||
*/
|
||||
parent()->setFixedSize(dockRect(m_ds.current()).size());
|
||||
parent()->setGeometry(dockRect(m_ds.current()));
|
||||
parent()->panel()->setFixedSize(dockRect(m_ds.current()).size());
|
||||
parent()->panel()->move(0, 0);
|
||||
}
|
||||
|
||||
void MultiScreenWorker::checkDaemonDockService()
|
||||
@ -1620,16 +1629,6 @@ QScreen *MultiScreenWorker::screenByName(const QString &screenName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
qreal MultiScreenWorker::scaleByName(const QString &screenName)
|
||||
{
|
||||
foreach (auto screen, qApp->screens()) {
|
||||
if (screen->name() == screenName)
|
||||
return screen->devicePixelRatio();
|
||||
}
|
||||
|
||||
return qApp->devicePixelRatio();;
|
||||
}
|
||||
|
||||
bool MultiScreenWorker::onScreenEdge(const QString &screenName, const QPoint &point)
|
||||
{
|
||||
bool ret = false;
|
||||
@ -1690,16 +1689,6 @@ const QPoint MultiScreenWorker::rawXPosition(const QPoint &scaledPos)
|
||||
: scaledPos;
|
||||
}
|
||||
|
||||
const QPoint MultiScreenWorker::scaledPos(const QPoint &rawXPos)
|
||||
{
|
||||
QScreen const *screen = Utils::screenAt(rawXPos);
|
||||
|
||||
return screen
|
||||
? screen->geometry().topLeft() +
|
||||
(rawXPos - screen->geometry().topLeft()) / screen->devicePixelRatio()
|
||||
: rawXPos;
|
||||
}
|
||||
|
||||
void MultiScreenWorker::onTouchPress(int type, int x, int y, const QString &key)
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
|
@ -433,13 +433,11 @@ private:
|
||||
|
||||
Monitor *monitorByName(const QList<Monitor *> &list, const QString &screenName);
|
||||
QScreen *screenByName(const QString &screenName);
|
||||
qreal scaleByName(const QString &screenName);
|
||||
bool onScreenEdge(const QString &screenName, const QPoint &point);
|
||||
bool onScreenEdge(const QPoint &point);
|
||||
bool contains(const MonitRect &rect, const QPoint &pos);
|
||||
bool contains(const QList<MonitRect> &rectList, const QPoint &pos);
|
||||
const QPoint rawXPosition(const QPoint &scaledPos);
|
||||
const QPoint scaledPos(const QPoint &rawXPos);
|
||||
|
||||
private:
|
||||
QWidget *m_parent;
|
||||
|
@ -58,21 +58,6 @@ inline QScreen * screenAt(const QPoint &point) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// 判断坐标是否位于屏幕边缘
|
||||
//!!! 注意:这里传入的QPoint是未计算缩放的
|
||||
inline bool onScreenEdge(const QPoint &point) {
|
||||
for (QScreen *screen : qApp->screens()) {
|
||||
const QRect r { screen->geometry() };
|
||||
QRect rect { r.topLeft(), r.size() * screen->devicePixelRatio() };
|
||||
if ( point.y() == screen->geometry().y()+screen->geometry().height()
|
||||
|| point.x() == screen->geometry().x()+screen->geometry().width()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//!!! 注意:这里传入的QPoint是未计算缩放的
|
||||
inline QScreen * screenAtByScaled(const QPoint &point) {
|
||||
for (QScreen *screen : qApp->screens()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user