Bug 480864

Summary: Titlebar context menu of non-maximized Aurorae-decorated windows is misplaced on Wayland
Product: [Plasma] kwin Reporter: Ilya Bizyaev <bizyaev>
Component: auroraeAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: akselmo, benedict.hewson, darrenllr, dashonwwIII, djneba, galdralag, git, jbeard565, jeisom, leoperbo, nate, postix, rodolfosilva2, severin.hamader, srahman53171618, the_archer_xz, usr_40476, yunusaydin590
Priority: VHI Keywords: qt6
Version: 5.92.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-121987
Latest Commit: Version Fixed In: 6.1.0
Sentry Crash Report:

Description Ilya Bizyaev 2024-02-04 19:11:17 UTC
STEPS TO REPRODUCE
1. Apply the “Plastik” window decoration in System Settings.
2. Ensure that the System Settings window is non-maximized and placed somewhere around the center of the screen.
3. Right-click the empty space next to the window title.

OBSERVED RESULT
The context menu appears at the top of the screen (on a single-monitor setup).

EXPECTED RESULT
The context menu appears next to the click position on the window decoration.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240126
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.1
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Comment 1 Ilya Bizyaev 2024-02-04 19:12:53 UTC
(This does not happen with Breeze or Oxygen)
Comment 2 Akseli Lahtinen 2024-02-06 09:47:54 UTC
Can reproduce

Operating System: Fedora Linux 39
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.0
Kernel Version: 6.6.14-200.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 3 Vlad Zahorodnii 2024-02-06 10:15:28 UTC
https://invent.kde.org/plasma/kwin/-/blob/9c0947ae15ba2fb92299a35846d15291ca853952/src/effect/offscreenquickview.cpp#L275 it seems like the global position in me changes after creating cloneEvent. Weird, it seems like a horrible Qt bug. I'll file an upstream bug report.
Comment 4 Vlad Zahorodnii 2024-02-06 10:28:21 UTC
Filed upstream bug report https://bugreports.qt.io/browse/QTBUG-121987
Comment 5 Zamundaaa 2024-03-04 18:36:48 UTC
*** Bug 482221 has been marked as a duplicate of this bug. ***
Comment 6 Vlad Zahorodnii 2024-03-07 13:27:44 UTC
*** Bug 482455 has been marked as a duplicate of this bug. ***
Comment 7 Vlad Zahorodnii 2024-03-07 13:47:49 UTC
*** Bug 482689 has been marked as a duplicate of this bug. ***
Comment 8 the_archer_xz 2024-03-08 01:02:13 UTC
I think I figured it out. I think this is related to the window decoration I made. Any way to fix it to make it work better with Plasma 6? Here's the link: https://store.kde.org/p/1574340

But I think this may be an issue with a lot of custom themes that are not the default Breeze style. Because I tried the default Breeze style, and the context menus appear on the correct window
Comment 9 Vlad Zahorodnii 2024-03-08 08:28:13 UTC
> Any way to fix it to make it work better with Plasma 6?

QMouseEvent has regressed in a quite bad way in Qt 6 in comparison to Qt 5, see the upstream Qt bug report. I'm not sure what we can do about it at the moment to be honest.
Comment 10 rodolfosilva2 2024-03-13 07:12:52 UTC
happens to me too.
So this is related to upstream?
Comment 11 Zamundaaa 2024-03-18 19:55:59 UTC
*** Bug 483910 has been marked as a duplicate of this bug. ***
Comment 12 Zamundaaa 2024-03-21 14:48:54 UTC
*** Bug 478054 has been marked as a duplicate of this bug. ***
Comment 13 Nicolas Fella 2024-03-22 11:09:24 UTC
*** Bug 484212 has been marked as a duplicate of this bug. ***
Comment 14 Nicolas Fella 2024-03-24 11:05:24 UTC
*** Bug 484375 has been marked as a duplicate of this bug. ***
Comment 15 Shariar Rahman 2024-04-07 22:47:57 UTC
Applies to any window decoration that is not Breeze. Not limited to Aurorae.
Comment 16 Jeff Beardsley 2024-04-08 15:56:47 UTC
Note that this bug ALSO applies to X11, so not limited to Wayland or Aurorae
Comment 17 Nicolas Fella 2024-04-09 09:31:28 UTC
*** Bug 484980 has been marked as a duplicate of this bug. ***
Comment 18 Nate Graham 2024-05-22 19:11:43 UTC
*** Bug 487328 has been marked as a duplicate of this bug. ***
Comment 19 Bug Janitor Service 2024-05-24 15:39:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5767
Comment 20 Bug Janitor Service 2024-05-25 05:57:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5773
Comment 21 Vlad Zahorodnii 2024-05-27 09:09:04 UTC
Git commit 862dae455a7d3fa8cfc82e37563b1e1920751cd4 by Vlad Zahorodnii, on behalf of David Edmundson.
Committed on 27/05/2024 at 08:55.
Pushed by vladz into branch 'master'.

effects: Use unique device for replaying events to QQuickView

When a new mouse event is made it updates the global position of that
device. This causes issues if a mouse event is forwarded with an
adjusted position then used afterwards.

`QPointingDevice::primaryPointingDevice` creates a new pointer device
internally if the seat name does not exist. It is then shared between
future usages.

M  +5    -3    src/effect/offscreenquickview.cpp

https://invent.kde.org/plasma/kwin/-/commit/862dae455a7d3fa8cfc82e37563b1e1920751cd4
Comment 22 Vlad Zahorodnii 2024-05-27 10:05:33 UTC
Git commit 0ecc01d08a36ef976a007f8d970e6aa1f10115bb by Vlad Zahorodnii, on behalf of David Edmundson.
Committed on 27/05/2024 at 09:55.
Pushed by vladz into branch 'Plasma/6.1'.

effects: Use unique device for replaying events to QQuickView

When a new mouse event is made it updates the global position of that
device. This causes issues if a mouse event is forwarded with an
adjusted position then used afterwards.

`QPointingDevice::primaryPointingDevice` creates a new pointer device
internally if the seat name does not exist. It is then shared between
future usages.


(cherry picked from commit 862dae455a7d3fa8cfc82e37563b1e1920751cd4)

M  +5    -3    src/effect/offscreenquickview.cpp

https://invent.kde.org/plasma/kwin/-/commit/0ecc01d08a36ef976a007f8d970e6aa1f10115bb
Comment 23 Vlad Zahorodnii 2024-05-27 18:26:51 UTC
Git commit b0ccacc9833cd44ec1d7af041e830b998898f93d by Vlad Zahorodnii.
Committed on 27/05/2024 at 17:32.
Pushed by vladz into branch 'master'.

Avoid using QMouseEvent in processDecorationButtonPress()

M  +2    -12   src/events.cpp
M  +8    -6    src/input.cpp
M  +11   -11   src/window.cpp
M  +2    -2    src/window.h

https://invent.kde.org/plasma/kwin/-/commit/b0ccacc9833cd44ec1d7af041e830b998898f93d
Comment 24 Vlad Zahorodnii 2024-05-27 20:23:54 UTC
Git commit 3361d718ac186708a545ef38931d0e8cf1d1e72a by Vlad Zahorodnii.
Committed on 27/05/2024 at 20:13.
Pushed by vladz into branch 'Plasma/6.1'.

Avoid using QMouseEvent in processDecorationButtonPress()
(cherry picked from commit b0ccacc9833cd44ec1d7af041e830b998898f93d)

M  +2    -12   src/events.cpp
M  +8    -6    src/input.cpp
M  +11   -11   src/window.cpp
M  +2    -2    src/window.h

https://invent.kde.org/plasma/kwin/-/commit/3361d718ac186708a545ef38931d0e8cf1d1e72a
Comment 25 David Redondo 2024-06-14 08:27:32 UTC
*** Bug 488475 has been marked as a duplicate of this bug. ***
Comment 26 rodolfosilva2 2024-06-21 04:15:27 UTC
*** Bug 485000 has been marked as a duplicate of this bug. ***