Bug 359158

Summary: Position of added applet offset by top panel height
Product: [Plasma] plasmashell Reporter: Kai Uwe Broulik <kde>
Component: ContainmentAssignee: Sebastian Kügler <sebas>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kai Uwe Broulik 2016-02-08 23:07:16 UTC
When I drag an applet or file from somewhere over my desktop, I can see the highlight indicator centered around my mouse. When I then drop the applet or file, it is placed vertically offset by the height of the panel. It seems like the available screen geometry is taken into account twice resulting in the applet being positioned *above* the cursor depending on the top panel height

Reproducible: Always

Steps to Reproduce:
1. Add a new panel
2. Move it to the top
3. Resize it thicker (to make this effect more visible, it also happens with the default panel size)
4. Open Widget Explorer
5. Drag and drop widget (also works with files that result in an applet)

Actual Results:  
The widget is placed vertically offset from the cursor

Expected Results:  
The widget is placed centered around the cursor
Comment 1 Kai Uwe Broulik 2016-02-08 23:09:04 UTC
This code is to blame:

            // On applet undo or via scripting, the applet position will be saved
            // in applet's scene coordinates so remap it to resultsflow's coordinates.
            var pos = root.parent.mapToItem(resultsFlow, x, y);

While it fixes the undo position, it broke the add applet position. If I remove this, the drop position is correct but undoing the deletion places it wrong.
Comment 2 David Rosca 2016-03-09 14:54:05 UTC
Git commit f3f6867da8859a57385805ba46ff7cbfd98b4fef by David Rosca.
Committed on 09/03/2016 at 14:46.
Pushed by drosca into branch 'Plasma/5.6'.

Fix position of new applets added with drag and drop

The position of applet is still a little off, probably because the code
that actually adds the applet is also computing with applet margins,
but we don't have applet at this point yet.

Differential Revision: https://phabricator.kde.org/D941

M  +2    -1    containments/desktop/package/contents/ui/main.qml

http://commits.kde.org/plasma-desktop/f3f6867da8859a57385805ba46ff7cbfd98b4fef