mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
Revert "fix: 任务栏在仅主屏显示模式下切换主屏让其跟随主屏显示"
This reverts commit be1f9b2be9c20f80ea6b3a6337ea7faa89703857. Change-Id: I2d21ad73fcb69aaa590753d92cf2bf8098ca564d
This commit is contained in:
parent
b92749ac63
commit
1407364107
@ -138,11 +138,6 @@ bool DisplayManager::isCopyMode()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DisplayManager::onlyInPrimary()
|
||||
{
|
||||
return m_onlyInPrimary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DisplayManager::updateScreenDockInfo
|
||||
* 更新屏幕停靠信息
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
int screenRawHeight() const;
|
||||
bool canDock(QScreen *s, Position pos) const;
|
||||
bool isCopyMode();
|
||||
bool onlyInPrimary();
|
||||
|
||||
private:
|
||||
void updateScreenDockInfo();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2018 ~ 2020 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: fanpengcheng <fanpengcheng_cm@deepin.com>
|
||||
@ -55,7 +55,6 @@ MultiScreenWorker::MultiScreenWorker(QWidget *parent, DWindowManagerHelper *help
|
||||
, m_delayWakeTimer(new QTimer(this))
|
||||
, m_ds(DIS_INS->primary())
|
||||
, m_state(AutoHide)
|
||||
, m_lastRect(QRect())
|
||||
{
|
||||
qInfo() << "init dock screen: " << m_ds.current();
|
||||
|
||||
@ -208,13 +207,6 @@ void MultiScreenWorker::onRegionMonitorChanged(int x, int y, const QString &key)
|
||||
tryToShowDock(x, y);
|
||||
}
|
||||
|
||||
bool MultiScreenWorker::mouseInCurrentScreen()
|
||||
{
|
||||
QScreen *currentScreen = DIS_INS->screen(m_ds.current());
|
||||
QScreen *mouseScreen = DIS_INS->screen(getValidScreen(position()));
|
||||
return (currentScreen == mouseScreen);
|
||||
}
|
||||
|
||||
// 鼠标在任务栏之外移动时,任务栏该响应隐藏时需要隐藏
|
||||
void MultiScreenWorker::onExtralRegionMonitorChanged(int x, int y, const QString &key)
|
||||
{
|
||||
@ -223,19 +215,6 @@ void MultiScreenWorker::onExtralRegionMonitorChanged(int x, int y, const QString
|
||||
if (m_extralRegisterKey != key || testState(MousePress))
|
||||
return;
|
||||
|
||||
// 如果当前正在移动鼠标,无需检测
|
||||
if (testState(ChangePositionAnimationStart)
|
||||
|| testState(HideAnimationStart)
|
||||
|| testState(ShowAnimationStart)
|
||||
|| testState(DockIsShowing)
|
||||
|| testState(PrimaryScreenChangedForShowing))
|
||||
return;
|
||||
|
||||
// 当双屏幕为扩展模式的时候,屏幕模式设置为一直显示,此时调整主屏,如果鼠标不在调整后的主屏上的时候,这个函数会触发一次(具体原因待查)
|
||||
// 因此,需要在此处判断当前鼠标的位置是否在主屏,否则就会出现任务栏在调整前的屏幕上闪一下又回到调整后的主屏幕的bug
|
||||
if (!mouseInCurrentScreen())
|
||||
return;
|
||||
|
||||
// FIXME:每次都要重置一下,是因为qt中的QScreen类缺少nameChanged信号,后面会给上游提交patch修复
|
||||
m_ds.updateDockedScreen(getValidScreen(position()));
|
||||
|
||||
@ -323,24 +302,7 @@ void MultiScreenWorker::primaryScreenChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果当前任务栏是跟随主屏的模式,则先更新任务栏的所在的屏幕
|
||||
if (DIS_INS->onlyInPrimary()) {
|
||||
QTimer::singleShot(100, [ = ] {
|
||||
resetDockScreen();
|
||||
|
||||
setStates(PrimaryScreenChangedForShowing);
|
||||
// 通知后端
|
||||
onRequestUpdateFrontendGeometry();
|
||||
// 通知窗管
|
||||
updateDockScreen();
|
||||
// 更新当前屏幕
|
||||
m_ds.updateDockedScreen(m_ds.primary());
|
||||
// 更新主屏幕的锁定状态
|
||||
updatePrimaryScreenDockStatus();
|
||||
});
|
||||
} else {
|
||||
m_monitorUpdateTimer->start();
|
||||
}
|
||||
m_monitorUpdateTimer->start();
|
||||
}
|
||||
|
||||
void MultiScreenWorker::updateParentGeometry(const QVariant &value, const Position &pos)
|
||||
@ -743,9 +705,13 @@ bool MultiScreenWorker::isCopyMode()
|
||||
*/
|
||||
void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
{
|
||||
static QRect lastRect = QRect();
|
||||
static int lastScreenWidth = 0;
|
||||
static int lastScreenHeight = 0;
|
||||
|
||||
/* 在非主屏或非一直显示状态时,清除任务栏区域,不挤占应用 */
|
||||
if ((!DIS_INS->isCopyMode() && m_ds.current() != m_ds.primary()) || m_hideMode != HideMode::KeepShowing) {
|
||||
m_lastRect = QRect();
|
||||
lastRect = QRect();
|
||||
|
||||
const auto display = QX11Info::display();
|
||||
if (!display) {
|
||||
@ -757,22 +723,14 @@ void MultiScreenWorker::onRequestNotifyWindowManager()
|
||||
return;
|
||||
}
|
||||
|
||||
updateDockScreen();
|
||||
}
|
||||
|
||||
void MultiScreenWorker::updateDockScreen()
|
||||
{
|
||||
static int lastScreenWidth = 0;
|
||||
static int lastScreenHeight = 0;
|
||||
|
||||
QRect dockGeometry = getDockShowGeometry(m_ds.current(), m_position, m_displayMode, true);
|
||||
if (m_lastRect == dockGeometry
|
||||
if (lastRect == dockGeometry
|
||||
&& lastScreenWidth == DIS_INS->screenRawWidth()
|
||||
&& lastScreenHeight == DIS_INS->screenRawHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_lastRect = dockGeometry;
|
||||
lastRect = dockGeometry;
|
||||
lastScreenWidth = DIS_INS->screenRawWidth();
|
||||
lastScreenHeight = DIS_INS->screenRawHeight();
|
||||
qDebug() << "dock real geometry:" << dockGeometry;
|
||||
@ -826,26 +784,6 @@ void MultiScreenWorker::updateDockScreen()
|
||||
static_cast<uint>(strutEnd)); // 设置任务栏终点坐标(上下为x,左右为y)
|
||||
}
|
||||
|
||||
void MultiScreenWorker::updatePrimaryScreenDockStatus()
|
||||
{
|
||||
const Dock::HideState state = Dock::HideState(m_dockInter->hideState());
|
||||
|
||||
if (state == Dock::Unknown)
|
||||
return;
|
||||
|
||||
if (m_hideMode == HideMode::KeepShowing
|
||||
|| ((m_hideMode == HideMode::KeepHidden || m_hideMode == HideMode::SmartHide) && m_hideState == HideState::Show)) {
|
||||
displayAnimation(m_ds.primary(), AniAction::Show);
|
||||
} else if ((m_hideMode == HideMode::KeepHidden || m_hideMode == HideMode::SmartHide) && m_hideState == HideState::Hide) {
|
||||
if (getDockShowGeometry(m_ds.primary(), m_position, m_displayMode).contains(QCursor::pos()))
|
||||
return;
|
||||
|
||||
displayAnimation(m_ds.primary(), AniAction::Hide);
|
||||
} else {
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiScreenWorker::onRequestUpdatePosition(const Position &fromPos, const Position &toPos)
|
||||
{
|
||||
qInfo() << "request change pos from: " << fromPos << " to: " << toPos;
|
||||
@ -1043,7 +981,6 @@ void MultiScreenWorker::displayAnimation(const QString &screen, const Position &
|
||||
* 也就是在实际值基础上下浮动1像素的误差范围
|
||||
* 正常屏幕情况下是没有这个问题的
|
||||
*/
|
||||
|
||||
switch (act) {
|
||||
case AniAction::Show:
|
||||
if (pos == Position::Top || pos == Position::Bottom) {
|
||||
@ -1113,12 +1050,6 @@ void MultiScreenWorker::displayAnimation(const QString &screen, const Position &
|
||||
setStates(ShowAnimationStart, false);
|
||||
else // 如果不是一直显示的状态,则让其延时修改状态,防止在resetDock的时候重复改变其高度引起任务栏闪烁导致无法唤醒
|
||||
QTimer::singleShot(ANIMATIONTIME, [ = ] { setStates(DockIsShowing, false); });
|
||||
|
||||
QTimer::singleShot(ANIMATIONTIME, [ = ] {
|
||||
// 如果当前是切换屏幕后,任务栏显示结束,则让这个标记移除
|
||||
if (testState(PrimaryScreenChangedForShowing))
|
||||
setStates(PrimaryScreenChangedForShowing, false);
|
||||
});
|
||||
}
|
||||
break;
|
||||
case AniAction::Hide:
|
||||
@ -1296,8 +1227,7 @@ void MultiScreenWorker::resetDockScreen()
|
||||
if (testState(ChangePositionAnimationStart)
|
||||
|| testState(HideAnimationStart)
|
||||
|| testState(ShowAnimationStart)
|
||||
|| testState(DockIsShowing)
|
||||
|| testState(PrimaryScreenChangedForShowing))
|
||||
|| testState(DockIsShowing))
|
||||
return;
|
||||
|
||||
m_ds.updateDockedScreen(getValidScreen(position()));
|
||||
|
@ -124,7 +124,6 @@ public:
|
||||
TouchPress = 0x20, // 当前触摸屏下是否按下
|
||||
LauncherDisplay = 0x40, // 启动器是否显示
|
||||
DockIsShowing = 0x80, // 任务栏正在显示
|
||||
PrimaryScreenChangedForShowing = 0x100, // 切换了主屏幕
|
||||
|
||||
// 如果要添加新的状态,可以在上面添加
|
||||
RunState_Mask = 0xffffffff,
|
||||
@ -246,10 +245,6 @@ private:
|
||||
const QPoint rawXPosition(const QPoint &scaledPos);
|
||||
static bool isCopyMode();
|
||||
|
||||
void updateDockScreen();
|
||||
void updatePrimaryScreenDockStatus();
|
||||
bool mouseInCurrentScreen();
|
||||
|
||||
private:
|
||||
QWidget *m_parent;
|
||||
DWindowManagerHelper *m_wmHelper;
|
||||
@ -287,7 +282,6 @@ private:
|
||||
QString m_delayScreen; // 任务栏将要切换到的屏幕名
|
||||
RunStates m_state;
|
||||
/*****************************************************************/
|
||||
QRect m_lastRect;
|
||||
};
|
||||
|
||||
#endif // MULTISCREENWORKER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user