diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index df14ab0be..9150b9708 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -33,6 +33,7 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent) centralLayout->setMargin(0); setLayout(centralLayout); + setAcceptDrops(true); connect(m_closeBtn, &DImageButton::clicked, this, &AppSnapshot::closeWindow, Qt::QueuedConnection); connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &AppSnapshot::compositeChanged, Qt::QueuedConnection); @@ -72,6 +73,14 @@ void AppSnapshot::setWindowTitle(const QString &title) m_title->setText(title); } +void AppSnapshot::dragEnterEvent(QDragEnterEvent *e) +{ + QWidget::dragEnterEvent(e); + + if (m_wmHelper->hasComposite()) + emit entered(m_wid); +} + void AppSnapshot::fetchSnapshot() { if (!m_wmHelper->hasComposite()) diff --git a/frame/item/components/appsnapshot.h b/frame/item/components/appsnapshot.h index 14fd73458..96adb92fd 100644 --- a/frame/item/components/appsnapshot.h +++ b/frame/item/components/appsnapshot.h @@ -34,6 +34,7 @@ public slots: void setWindowTitle(const QString &title); private: + void dragEnterEvent(QDragEnterEvent *e); void enterEvent(QEvent *e); void leaveEvent(QEvent *e); void paintEvent(QPaintEvent *e); diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index bc9dca18e..4a8742b94 100644 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -32,6 +32,7 @@ MainWindow::MainWindow(QWidget *parent) setAccessibleName("dock-mainwindow"); setWindowFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setAttribute(Qt::WA_TranslucentBackground); + setAcceptDrops(true); m_platformWindowHandle.setEnableBlurWindow(false); m_platformWindowHandle.setTranslucentBackground(true); @@ -111,6 +112,14 @@ void MainWindow::leaveEvent(QEvent *e) updatePanelVisible(); } +void MainWindow::dragEnterEvent(QDragEnterEvent *e) +{ + QWidget::dragEnterEvent(e); + + if (m_settings->hideState() != Show) + m_expandDelayTimer->start(); +} + void MainWindow::setFixedSize(const QSize &size) { const QPropertyAnimation::State state = m_sizeChangeAni->state(); diff --git a/frame/window/mainwindow.h b/frame/window/mainwindow.h index f11d9dda7..2ec9d9e19 100644 --- a/frame/window/mainwindow.h +++ b/frame/window/mainwindow.h @@ -30,6 +30,7 @@ private: void keyPressEvent(QKeyEvent *e); void enterEvent(QEvent *e); void leaveEvent(QEvent *e); + void dragEnterEvent(QDragEnterEvent *e); void setFixedSize(const QSize &size); void move(int x, int y);