diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index 31c9745ff..9a101a234 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -122,6 +122,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) connect(GSettingsByApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged); connect(GSettingsByDockApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged); + connect(GSettingsByActiveApp(), &QGSettings::changed, this, &AppItem::onGSettingsChanged); + connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &AppItem::onThemeTypeChanged); connect(m_refershIconTimer, &QTimer::timeout, this, [ = ]() { @@ -305,6 +307,11 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e) m_lastclickTimes = curTimestamp; + // 鼠标在图标外边松开时,没必要响应点击操作 + const QRect rect { QPoint(0, 0), size()}; + if (!rect.contains(mapFromGlobal(QCursor::pos()))) + return; + if (e->button() == Qt::MiddleButton) { m_itemEntryInter->NewInstance(QX11Info::getTimestamp()); diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 935ab509a..1771a5910 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -54,6 +54,12 @@ static QGSettings *GSettingsByLaunch() return &settings; } +static QGSettings *GSettingsByApp() +{ + static QGSettings settings("com.deepin.dde.dock.module.app"); + return &settings; +} + MainPanelControl::MainPanelControl(QWidget *parent) : QWidget(parent) , m_mainPanelLayout(new QBoxLayout(QBoxLayout::LeftToRight, this)) @@ -652,7 +658,8 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event) return false; } - startDrag(item); + if (!GSettingsByApp()->keys().contains("removeable") || GSettingsByApp()->get("removeable").toBool()) + startDrag(item); return QWidget::eventFilter(watched, event); } @@ -724,7 +731,7 @@ void MainPanelControl::startDrag(DockItem *item) static_cast(m_appDragWidget)->viewport()->installEventFilter(this); } else { appDrag->QDrag::setPixmap(dragPix); - } + } drag = appDrag; drag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF()); diff --git a/gschema/com.deepin.dde.dock.module.gschema.xml b/gschema/com.deepin.dde.dock.module.gschema.xml index ca02ac67d..8b5568288 100644 --- a/gschema/com.deepin.dde.dock.module.gschema.xml +++ b/gschema/com.deepin.dde.dock.module.gschema.xml @@ -14,6 +14,13 @@ Control Module Enable + + + true + App Removeable + + Control App Removeable +