mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix dock is moved by wm
Change-Id: I6112984a4de68cb50771db66e33775c446e873a6
This commit is contained in:
parent
8207f2f01a
commit
69d0262fef
Notes:
Deepin Code Review
2017-12-12 15:07:52 +08:00
Verified+1: Anonymous Coward #1000517 Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 12 Dec 2017 15:07:52 +0800 Reviewed-on: https://cr.deepin.io/29287 Project: dde/dde-dock Branch: refs/heads/master
@ -23,6 +23,7 @@
|
||||
#include "panel/mainpanel.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QScreen>
|
||||
#include <QGuiApplication>
|
||||
@ -130,6 +131,20 @@ void MainWindow::launch()
|
||||
QTimer::singleShot(1, this, &MainWindow::show);
|
||||
}
|
||||
|
||||
bool MainWindow::event(QEvent *e)
|
||||
{
|
||||
switch (e->type())
|
||||
{
|
||||
case QEvent::Move:
|
||||
if (!e->spontaneous())
|
||||
QTimer::singleShot(1, this, &MainWindow::positionCheck);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
return QWidget::event(e);
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
QWidget::resizeEvent(e);
|
||||
@ -292,8 +307,8 @@ void MainWindow::internalMove(const QPoint &p)
|
||||
void MainWindow::initConnections()
|
||||
{
|
||||
connect(m_settings, &DockSettings::dataChanged, m_positionUpdateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
|
||||
connect(m_settings, &DockSettings::positionChanged, this, &MainWindow::positionChanged);
|
||||
connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::DirectConnection);
|
||||
connect(m_settings, &DockSettings::positionChanged, this, &MainWindow::positionChanged);
|
||||
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::setStrutPartial, Qt::QueuedConnection);
|
||||
connect(m_settings, &DockSettings::windowHideModeChanged, [this] { resetPanelEnvironment(true); });
|
||||
connect(m_settings, &DockSettings::windowVisibleChanged, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
||||
@ -430,6 +445,8 @@ void MainWindow::updateGeometry()
|
||||
}
|
||||
|
||||
const QRect windowRect = m_settings->windowRect(position, m_settings->hideState() == Hide);
|
||||
qDebug() << Q_FUNC_INFO << windowRect;
|
||||
|
||||
if (animation)
|
||||
internalAnimationMove(windowRect.x(), windowRect.y());
|
||||
else
|
||||
@ -706,3 +723,14 @@ void MainWindow::adjustShadowMask()
|
||||
m_platformWindowHandle.setClipPath(path);
|
||||
m_platformWindowHandle.setShadowRadius(60);
|
||||
}
|
||||
|
||||
void MainWindow::positionCheck()
|
||||
{
|
||||
if (m_posChangeAni->state() == QPropertyAnimation::Running)
|
||||
return;
|
||||
if (m_positionUpdateTimer->isActive())
|
||||
return;
|
||||
|
||||
qDebug() << "welcome to position check point!";
|
||||
qDebug() << pos() << m_settings->windowRect(m_settings->position(), false);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public slots:
|
||||
|
||||
private:
|
||||
using QWidget::show;
|
||||
bool event(QEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
@ -85,6 +86,7 @@ private slots:
|
||||
void updatePanelVisible();
|
||||
|
||||
void adjustShadowMask();
|
||||
void positionCheck();
|
||||
|
||||
private:
|
||||
bool m_launched;
|
||||
|
Loading…
x
Reference in New Issue
Block a user