mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 修复一处任务栏显示异常的问题
windowSizeFashion和windowSizeEfficient给出的值始终对应前端认为的界面高度或宽度.举例:当前缩放为2时,任务栏为高效模式,windowSizeEfficient对应值为50,那么任务栏显示的高度应该为50*2个像素 Log: 修复一处任务栏显示异常的问题 Task: https://pms.uniontech.com/zentao/task-view-36233.html Change-Id: I1986ca9d1b0d6fad67186c9bad210a54f153095b Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/3301 Reviewed-by: <mailman@uniontech.com> Reviewed-by: wangwei <wangwei@uniontech.com> Reviewed-by: niecheng <niecheng@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
f7d519824a
commit
883c74f479
@ -530,7 +530,8 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||
|
||||
const static int flags = Motion | Button | Key;
|
||||
const static int monitorHeight = 15;
|
||||
const int dockSize = int(m_displayMode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() + 2 * 10/*上下的边距各10像素*/ : m_dockInter->windowSizeEfficient());
|
||||
// 后端认为的任务栏大小(无缩放因素影响)
|
||||
const int realDockSize = int(m_displayMode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() + 2 * 10/*上下的边距各10像素*/ : m_dockInter->windowSizeEfficient());
|
||||
|
||||
// 任务栏唤起区域
|
||||
m_monitorRectList.clear();
|
||||
@ -589,7 +590,7 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||
switch (m_position) {
|
||||
case Top: {
|
||||
rect.x1 = inter->x();
|
||||
rect.y1 = inter->y() + dockSize;
|
||||
rect.y1 = inter->y() + realDockSize;
|
||||
rect.x2 = inter->x() + inter->w();
|
||||
rect.y2 = inter->y() + inter->h();
|
||||
}
|
||||
@ -598,11 +599,11 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||
rect.x1 = inter->x();
|
||||
rect.y1 = inter->y();
|
||||
rect.x2 = inter->x() + inter->w();
|
||||
rect.y2 = inter->y() + inter->h() - dockSize;
|
||||
rect.y2 = inter->y() + inter->h() - realDockSize;
|
||||
}
|
||||
break;
|
||||
case Left: {
|
||||
rect.x1 = inter->x() + dockSize;
|
||||
rect.x1 = inter->x() + realDockSize;
|
||||
rect.y1 = inter->y();
|
||||
rect.x2 = inter->x() + inter->w();
|
||||
rect.y2 = inter->y() + inter->h();
|
||||
@ -611,7 +612,7 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor()
|
||||
case Right: {
|
||||
rect.x1 = inter->x();
|
||||
rect.y1 = inter->y();
|
||||
rect.x2 = inter->x() + inter->w() - dockSize;
|
||||
rect.x2 = inter->x() + inter->w() - realDockSize;
|
||||
rect.y2 = inter->y() + inter->h();
|
||||
}
|
||||
break;
|
||||
@ -1289,7 +1290,8 @@ QRect MultiScreenWorker::getDockShowGeometry(const QString &screenName, const Po
|
||||
if (withoutScale) {//后端真实大小
|
||||
foreach (Monitor *inter, validMonitorList(m_monitorInfo)) {
|
||||
if (inter->name() == screenName) {
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient());
|
||||
// windowSizeFashion和windowSizeEfficient给出的值始终对应前端认为的界面高度或宽度(受缩放影响)
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient()) * scale;
|
||||
switch (static_cast<Position>(pos)) {
|
||||
case Top: {
|
||||
rect.setX(inter->x() + WINDOWMARGIN);
|
||||
@ -1325,8 +1327,8 @@ QRect MultiScreenWorker::getDockShowGeometry(const QString &screenName, const Po
|
||||
} else {//前端真实大小
|
||||
foreach (Monitor *inter, validMonitorList(m_monitorInfo)) {
|
||||
if (inter->name() == screenName) {
|
||||
// 注意这里的dockSize是除以缩放的
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient()) / scale;
|
||||
// windowSizeFashion和windowSizeEfficient给出的值始终对应前端认为的界面高度或宽度(受缩放影响)
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient());
|
||||
switch (static_cast<Position>(pos)) {
|
||||
case Top: {
|
||||
rect.setX(inter->x() + WINDOWMARGIN);
|
||||
|
@ -85,7 +85,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
, m_sniWatcher(new StatusNotifierWatcher(SNI_WATCHER_SERVICE, SNI_WATCHER_PATH, QDBusConnection::sessionBus(), this))
|
||||
, m_dragWidget(new DragWidget(this))
|
||||
, m_launched(false)
|
||||
, m_dockSize(0)
|
||||
{
|
||||
setAccessibleName("mainwindow");
|
||||
m_mainPanel->setAccessibleName("mainpanel");
|
||||
@ -347,6 +346,7 @@ bool MainWindow::appIsOnDock(const QString &appDesktop)
|
||||
|
||||
void MainWindow::resetDragWindow()
|
||||
{
|
||||
int dockSize = 0;
|
||||
switch (m_multiScreenWorker->position()) {
|
||||
case Dock::Top:
|
||||
m_dragWidget->setGeometry(0, height() - DRAG_AREA_SIZE, width(), DRAG_AREA_SIZE);
|
||||
@ -364,13 +364,13 @@ void MainWindow::resetDragWindow()
|
||||
|
||||
if (m_multiScreenWorker->position() == Position::Left
|
||||
|| m_multiScreenWorker->position() == Position::Right) {
|
||||
m_dockSize = this->width() * qApp->devicePixelRatio();
|
||||
dockSize = this->width();
|
||||
} else {
|
||||
m_dockSize = this->height() * qApp->devicePixelRatio();
|
||||
dockSize = this->height();
|
||||
}
|
||||
|
||||
// 通知窗管和后端更新数据
|
||||
m_multiScreenWorker->updateDaemonDockSize(m_dockSize); // 1.先更新任务栏高度
|
||||
m_multiScreenWorker->updateDaemonDockSize(dockSize); // 1.先更新任务栏高度
|
||||
m_multiScreenWorker->requestUpdateFrontendGeometry(); // 2.再更新任务栏位置,保证先1再2
|
||||
m_multiScreenWorker->requestNotifyWindowManager();
|
||||
|
||||
@ -387,34 +387,33 @@ void MainWindow::onMainWindowSizeChanged(QPoint offset)
|
||||
, m_multiScreenWorker->position()
|
||||
, HideMode::KeepShowing,
|
||||
m_multiScreenWorker->displayMode());
|
||||
const qreal scale = qApp->devicePixelRatio();
|
||||
QRect newRect;
|
||||
switch (m_multiScreenWorker->position()) {
|
||||
case Top: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(rect.width());
|
||||
newRect.setHeight(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() + offset.y(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setHeight(qBound(MAINWINDOW_MIN_SIZE, rect.height() + offset.y(), MAINWINDOW_MAX_SIZE));
|
||||
}
|
||||
break;
|
||||
case Bottom: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y() + rect.height() - qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() - offset.y(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setY(rect.y() + rect.height() - qBound(MAINWINDOW_MIN_SIZE, rect.height() - offset.y(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setWidth(rect.width());
|
||||
newRect.setHeight(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() - offset.y(), int(MAINWINDOW_MAX_SIZE / scale) ));
|
||||
newRect.setHeight(qBound(MAINWINDOW_MIN_SIZE, rect.height() - offset.y(), MAINWINDOW_MAX_SIZE ));
|
||||
}
|
||||
break;
|
||||
case Left: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() + offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setWidth(qBound(MAINWINDOW_MIN_SIZE, rect.width() + offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setHeight(rect.height());
|
||||
}
|
||||
break;
|
||||
case Right: {
|
||||
newRect.setX(rect.x() + rect.width() - qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() - offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setX(rect.x() + rect.width() - qBound(MAINWINDOW_MIN_SIZE, rect.width() - offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() - offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setWidth(qBound(MAINWINDOW_MIN_SIZE, rect.width() - offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setHeight(rect.height());
|
||||
}
|
||||
break;
|
||||
|
@ -178,7 +178,6 @@ private:
|
||||
QString m_sniHostService;
|
||||
|
||||
bool m_launched;
|
||||
int m_dockSize;
|
||||
QString m_registerKey;
|
||||
QStringList m_registerKeys;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user