Skip to content

Commit

Permalink
fix: doesn't disable hover when dragging for tray
Browse files Browse the repository at this point in the history
  • Loading branch information
18202781743 committed Aug 27, 2024
1 parent 79543a7 commit 7e5a1cc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion panels/dock/tray/package/ActionLegacyTrayPluginDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ AppletItemButton {
padding: 0

visible: !Drag.active
hoverEnabled: inputEventsEnabled

function updatePluginMargins()
{
Expand Down Expand Up @@ -138,7 +139,7 @@ AppletItemButton {
}
}

D.ColorSelector.hovered: pluginItem.plugin && pluginItem.plugin.isItemActive || hoverHandler.hovered
D.ColorSelector.hovered: root.inputEventsEnabled && (pluginItem.plugin && pluginItem.plugin.isItemActive || hoverHandler.hovered)
D.ColorSelector.pressed: tapHandler.pressed

property Component overlayWindow: QuickDragWindow {
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/tray/package/ActionToggleCollapseDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ AppletItemButton {
id: root
property bool isHorizontal: false
property bool collapsed: DDT.TraySortOrderModel.collapsed
property bool inputEventsEnabled: true
hoverEnabled: inputEventsEnabled

z: 5

Expand Down Expand Up @@ -63,6 +65,7 @@ AppletItemButton {
}
HoverHandler {
id: hoverHandler
enabled: root.inputEventsEnabled
onHoveredChanged: {
if (hovered) {
toolTipShowTimer.start()
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/tray/package/TrayContainer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Item {
// visiualIndex default value is -1
property int dropHoverIndex: -1
required property var surfaceAcceptor
readonly property bool isDropping: dropArea.containsDrag

onIsDraggingChanged: {
animationEnable = !isDragging
Expand Down Expand Up @@ -127,6 +128,7 @@ Item {
collapsed: root.collapsed
itemPadding: root.itemPadding
surfaceAcceptor: root.surfaceAcceptor
disableInputEvents: root.isDropping
}

// debug
Expand All @@ -136,6 +138,7 @@ Item {
}

DropArea {
id: dropArea
anchors.fill: parent
keys: ["text/x-dde-shell-tray-dnd-surfaceId"]
onEntered: function (dragEvent) {
Expand Down
4 changes: 3 additions & 1 deletion panels/dock/tray/package/TrayItemDelegateChooser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LQM.DelegateChooser {
property bool collapsed: false
required property int itemPadding
required property var surfaceAcceptor
property bool disableInputEvents

role: "delegateType"
LQM.DelegateChoice {
Expand All @@ -34,7 +35,7 @@ LQM.DelegateChooser {
contentItem: ActionLegacyTrayPluginDelegate {
id: traySurfaceDelegate
objectName: "tray"
inputEventsEnabled: model.sectionType !== "collapsable" || !DDT.TraySortOrderModel.collapsed
inputEventsEnabled: !disableInputEvents && (model.sectionType !== "collapsable" || !DDT.TraySortOrderModel.collapsed)
itemVisible: traySurfacePositioner.itemVisible
dragable: model.sectionType !== "fixed"
isActive: surfacePopup.isOpened
Expand Down Expand Up @@ -63,6 +64,7 @@ LQM.DelegateChooser {
TrayItemPositioner {
contentItem: ActionToggleCollapseDelegate {
isHorizontal: root.isHorizontal
inputEventsEnabled: !disableInputEvents
}
}
}
Expand Down

0 comments on commit 7e5a1cc

Please sign in to comment.