Bug 436216 - Icons created on second monitor extending containment.
Summary: Icons created on second monitor extending containment.
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Folder (show other bugs)
Version: 5.21.4
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-26 13:53 UTC by Oleg Solovyov
Modified: 2021-04-28 16:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21.5
Sentry Crash Report:


Attachments
screenshot (397.73 KB, image/png)
2021-04-27 13:17 UTC, Oleg Solovyov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Solovyov 2021-04-26 13:53:58 UTC
SUMMARY
Using KDE Neon on a PC with two monitors connected.
Icons arrangement is set to "Columns"

STEPS TO REPRODUCE
1. Log in
2. Create a file on second monitor
3. Be shocked that file isn't created

OBSERVED RESULT
Notice the scrollbar below (see screenshot)

EXPECTED RESULT
The file is created in correct place.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.4.0
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
X11 is used
When arrangement is Rows, it works fine
When the file is created on first monitor, it works fine
Same with folder creation
Comment 1 Oleg Solovyov 2021-04-26 14:16:04 UTC
Probably breaks after 5.20 release
Comment 2 Oleg Solovyov 2021-04-26 15:07:04 UTC
It breaks after e8f0ded578183a375be205086f689455f52e54bf
Comment 3 Oleg Solovyov 2021-04-27 08:21:40 UTC
(In reply to Oleg Solovyov from comment #2)
> It breaks after e8f0ded578183a375be205086f689455f52e54bf
seems like there is something else, digging further
Comment 4 Oleg Solovyov 2021-04-27 12:59:12 UTC
(In reply to Oleg Solovyov from comment #3)
> (In reply to Oleg Solovyov from comment #2)
> > It breaks after e8f0ded578183a375be205086f689455f52e54bf
> seems like there is something else, digging further

QCursor::pos() is used for determining which place will be used for a new icon.
But if we have two 1920x1080 monitors, pos() will return something like QPoint(2673, 438). Hence the icon is created outside of the view.
Comment 5 Oleg Solovyov 2021-04-27 13:17:38 UTC
Created attachment 137956 [details]
screenshot
Comment 6 Nate Graham 2021-04-27 19:19:59 UTC
Hmm, seems like either a Qt bug, or we're using it wrong.
Comment 7 Oleg Solovyov 2021-04-28 06:43:18 UTC
(In reply to Nate Graham from comment #6)
> Hmm, seems like either a Qt bug, or we're using it wrong.

I think we're using it wrong.
Clicking the left-top corner of the second screen would return (1920,0) instead of correct (0,0)

QCursor::pos()
Returns the position of the cursor (hot spot) of the screen in global screen coordinates.

`---------------,---------------`
|               |               |
|               |               |
|               |   *(2400, 400)|
|               |               |
|               |               |
,---------------`---------------,
Comment 8 Bug Janitor Service 2021-04-28 08:43:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/444
Comment 9 Oleg Solovyov 2021-04-28 16:37:00 UTC
Git commit a13b176e673c6a3289bc7ff34b664c6138ce73eb by Oleg Solovyov.
Committed on 28/04/2021 at 08:38.
Pushed by ngraham into branch 'master'.

Calculate cursor position relative to top-left corner of current screen

QCursor::pos() returns an absolute position of cursor,
which is incorrect unless the screen's top-left corner is (0, 0).
This is used when calculating position of the icon created on
desktop.

M  +18   -1    containments/desktop/plugins/folder/foldermodel.cpp
M  +1    -0    containments/desktop/plugins/folder/foldermodel.h

https://invent.kde.org/plasma/plasma-desktop/commit/a13b176e673c6a3289bc7ff34b664c6138ce73eb
Comment 10 Nate Graham 2021-04-28 16:38:29 UTC
Git commit 2b7b0c5419455a16425fc06e25cce2cd1f434121 by Nate Graham, on behalf of Oleg Solovyov.
Committed on 28/04/2021 at 16:38.
Pushed by ngraham into branch 'Plasma/5.21'.

Calculate cursor position relative to top-left corner of current screen

QCursor::pos() returns an absolute position of cursor,
which is incorrect unless the screen's top-left corner is (0, 0).
This is used when calculating position of the icon created on
desktop.


(cherry picked from commit a13b176e673c6a3289bc7ff34b664c6138ce73eb)

M  +18   -1    containments/desktop/plugins/folder/foldermodel.cpp
M  +1    -0    containments/desktop/plugins/folder/foldermodel.h

https://invent.kde.org/plasma/plasma-desktop/commit/2b7b0c5419455a16425fc06e25cce2cd1f434121