Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions panels/dock/dockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ void DockHelper::checkNeedHideOrNot()
}
}

needHide &= !parent()->contextDragging();

// any enter will not make hide
for (auto enter : m_enters) {
needHide &= !enter;
Expand Down
2 changes: 1 addition & 1 deletion panels/dock/dockhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DockHelper : public QObject

void updateAllDockWakeArea();

private Q_SLOTS:
public Q_SLOTS:
void checkNeedHideOrNot();
void checkNeedShowOrNot();

Expand Down
16 changes: 16 additions & 0 deletions panels/dock/dockpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
, m_loadTrayPlugins(new LoadTrayPlugins(this))
, m_compositorReady(false)
, m_launcherShown(false)
, m_contextDragging(false)
{
connect(this, &DockPanel::compositorReadyChanged, this, [this] {
if (!m_compositorReady) return;
Expand Down Expand Up @@ -409,6 +410,21 @@

return false;
}

bool DockPanel::contextDragging() const
{
return m_contextDragging;
}

void DockPanel::setContextDragging(bool newContextDragging)
{
if (m_contextDragging == newContextDragging)
return;
m_contextDragging = newContextDragging;
if (!m_contextDragging)
m_helper->checkNeedHideOrNot();
emit contextDraggingChanged();
}
}

#include "dockpanel.moc"

Check warning on line 430 in panels/dock/dockpanel.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "dockpanel.moc" not found.
8 changes: 8 additions & 0 deletions panels/dock/dockpanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext

Q_PROPERTY(bool debugMode READ debugMode FINAL CONSTANT)

Q_PROPERTY(bool contextDragging READ contextDragging WRITE setContextDragging NOTIFY contextDraggingChanged FINAL)

public:
explicit DockPanel(QObject *parent = nullptr);

Expand Down Expand Up @@ -86,6 +88,9 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext

qreal devicePixelRatio() const;

bool contextDragging() const;
void setContextDragging(bool newContextDragging);

protected:
bool eventFilter(QObject *watched, QEvent *event) override;

Expand All @@ -112,6 +117,8 @@ private Q_SLOTS:
void requestClosePopup();
void devicePixelRatioChanged(qreal ratio);

void contextDraggingChanged();

private:
ColorTheme m_theme;
HideState m_hideState;
Expand All @@ -120,6 +127,7 @@ private Q_SLOTS:
LoadTrayPlugins *m_loadTrayPlugins;
bool m_compositorReady;
bool m_launcherShown;
bool m_contextDragging;
};

}
6 changes: 5 additions & 1 deletion panels/dock/taskmanager/package/AppItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,12 @@ Item {
acceptedButtons: Qt.LeftButton | Qt.RightButton
drag.target: root
drag.onActiveChanged: {
if (!drag.active)
if (!drag.active) {
Panel.contextDragging = false
root.dragFinished()
return
}
Panel.contextDragging = true
}

onPressed: function (mouse) {
Expand Down
1 change: 1 addition & 0 deletions panels/dock/taskmanager/package/TaskManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ ContainmentItem {
}

onDropped: function(drop) {
Panel.contextDragging = false
if (launcherDndDesktopId === "") return
let curX = taskmanager.useColumnLayout ? drop.y : drop.x
let cellWidth = visualModel.cellWidth
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,12 @@ AppletItemButton {
Drag.onActiveChanged: {
DDT.TraySortOrderModel.actionsAlwaysVisible = Drag.active
if (!Drag.active) {
Panel.contextDragging = false
// reset position on drop
Qt.callLater(() => { x = 0; y = 0; });
return
}
Panel.contextDragging = true
}

DragHandler {
Expand Down
4 changes: 4 additions & 0 deletions panels/dock/tray/package/DummyDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import QtQuick
import QtQuick.Controls
import org.deepin.ds.dock 1.0
import org.deepin.ds.dock.tray 1.0 as DDT

Button {
Expand All @@ -25,9 +26,12 @@ Button {
Drag.onActiveChanged: {
DDT.TraySortOrderModel.actionsAlwaysVisible = Drag.active
if (!Drag.active) {
Panel.contextDragging = false
// reset position on drop
Qt.callLater(() => { x = 0; y = 0; });
return
}
Panel.contextDragging = true
}
contentItem: Rectangle {
color: "grey"
Expand Down