Bug 501922

Summary: Double-click on task manager button at the edge of screen initiates drag&drop
Product: [Plasma] plasmashell Reporter: equeim
Component: Task Manager and Icons-Only Task Manager widgetsAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kdedev, nate, qydwhotmail
Priority: NOR    
Version First Reported In: 6.3.3   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Video of the issue

Description equeim 2025-03-23 20:13:56 UTC
Created attachment 179678 [details]
Video of the issue

SUMMARY
Double-click on task manager button at the edge of screen initiates drag&drop. Video of the issue is attached.

STEPS TO REPRODUCE
1. Place cursor over window button on the panel at the right edge of screen
2. Double click on it

OBSERVED RESULT
Drag&drop is initiated and immediately cancelled, window is minimized/unminimized once

EXPECTED RESULT
Window is minimized and then unminimized (or other way around)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 20250319
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
I use Plasma Wayland, with 100% monitor scaling.

When clicking on window button *not* at the edge of the screen (i.e. in the middle of the button) the issue is not present and expected result is observed.
Comment 1 Nate Graham 2025-03-25 23:04:33 UTC
Cannot reproduce the issue on git master.

Does it happen in a new clean user account, with the default panel moved to that screen position?
Comment 2 TraceyC 2025-03-26 17:52:20 UTC
I see what's happening in the video. I also can't reproduce this on git-master
Comment 3 Nate Graham 2025-03-26 17:55:34 UTC
Ok, let's call it fixed in 6.4, then!
Comment 4 equeim 2025-03-26 18:01:51 UTC
(In reply to Nate Graham from comment #1)
> Cannot reproduce the issue on git master.
> 
> Does it happen in a new clean user account, with the default panel moved to
> that screen position?

Yes, though for some reason the issue only reproducible when panel is on top or to the left. With my current configuration it is present with all four panel positions.

BTW Plasma froze the first time I entered edit mode (I didn't see anything suspicious in logs though).
Comment 5 equeim 2025-06-21 22:56:29 UTC
I'm still seeing this issue on Plasma 6.4.0
Comment 6 TraceyC 2025-06-23 18:04:29 UTC
I tested with a top panel on git-master and I am able to reproduce it, exactly as in the video
Comment 7 Nate Graham 2025-06-25 21:23:07 UTC
Hmm, I still can't reproduce this, even with a top panel. Notably, my scale factor is 175%. What settings let you reproduce it, Tracey?
Comment 8 TraceyC 2025-06-26 01:12:45 UTC
(In reply to Nate Graham from comment #7)
> Hmm, I still can't reproduce this, even with a top panel. Notably, my scale
> factor is 175%. What settings let you reproduce it, Tracey?

I can reproduce with the icons only task manager on a Lenovo Flex, native resolution of 1920 x 1080 (16:9) @ 100%
Panel is set to top, center, fill width, always visible, not floating

Also reproduced on a Dell XPS 17 with icons-and-text task manager on an external monitor, native resolution of 3440 x 1440 (21:9) @ 100% and at 125%
Panel is set to top, center, custom width, always visible, not floating
Comment 9 Nate Graham 2025-06-26 15:29:12 UTC
How odd; still can't reproduce the issue with settings as close to those as possible. I wonder if this is a variant of Bug 500293, which I'll notice just got fixed upstream in Qt.
Comment 10 equeim 2025-12-17 00:26:14 UTC
Ok I think I found the cause after a couple of hours of debugging.

This piece of code: https://invent.kde.org/plasma/plasma-workspace/-/blob/v6.5.4/shell/panelview.cpp?ref_type=tags#L1246

should also run for QEvent::MouseButtonDblClick. The reason is that when it adjusts event position for MouseButtonPress, but not for follow-up MouseButtonDblClick, Qt sees the delta between two events and triggers drag. Specifically, it happens here: https://github.com/qt/qtdeclarative/blob/22fb5e739a2ea700448b22d34ade0d5c1927cb48/src/quick/handlers/qquickdraghandler.cpp#L243. On my system accumulatedDragDelta's y ends up being 12 (because m_topPadding in PanelView is 12), even though I didn't move the mouse. This is greater than the threshold which is 10.
Comment 11 Nate Graham 2025-12-19 19:01:11 UTC
Nice, would you like to submit a patch to fix it?
Comment 12 Bug Janitor Service 2025-12-19 23:00:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/6113
Comment 13 Bug Janitor Service 2025-12-19 23:00:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/6113
Comment 14 equeim 2025-12-19 23:45:22 UTC
Git commit eebc758c28189a791c396b996017ae62010f0d36 by Alexey Rochev.
Committed on 19/12/2025 at 22:50.
Pushed by davidedmundson into branch 'master'.

Fix drag being initiated by double click on a panel item when cursor is on the edge of a screen

We need to adjust the position of QEvent::MouseButtonDblClick too.
QGuiApplication synthetizes QEvent::MouseButtonDblClick after QEvent::MouseButtonPress which Qt Quick's DragHandler also receives.
If QEvent::MouseButtonDblClick's positions is not adjusted DragHandler will see the difference
between QEventPoint's scenePosition and scenePressPosition (which seems to be taken from previous QEvent::MouseButtonPress?),
and initiate drag.

M  +2    -1    shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/eebc758c28189a791c396b996017ae62010f0d36