Bug 440534 - On Wayland, dragging items over windows immediately makes those windows focused
Summary: On Wayland, dragging items over windows immediately makes those windows focused
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.22.4
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-02 23:19 UTC by Jacob White
Modified: 2024-01-29 23:49 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
Demo of the window raising issue during drag-n-drop on Wayland (634.19 KB, video/webm)
2024-01-27 01:40 UTC, Yevhen Popok
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jacob White 2021-08-02 23:19:25 UTC
SUMMARY
Dragging items such as files, folders, etc. over windows will immediately focus those windows on Wayland. This is extremely annoying with large or fullscreen windows. Dragging items from one place to another is impossible if the destination is not next to the source and is also not next to its entry in the task manager bar. On X11, dragging over windows doesn't focus them, so this problem is avoided.

This looks like the right category for this issue. My apologies if it isn't.

STEPS TO REPRODUCE
1. Open a window (for example, Firefox) in fullscreen.
2. Open two Dolphin windows, and move them to the top left and top right corners of the screen, leaving a gap between them.
3. Attempt to drag a file or folder from one Dolphin window to the other.

OBSERVED RESULT
The moment the cursor is over the Firefox window, Firefox becomes focused, hiding the destination Dolphin window.

EXPECTED RESULT
The Firefox window should not become focused in this case, or should at least not become focused immediately.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 34
(available in About System)
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Kernel Version: 5.13.6-200.fc34.x86_64
Graphics Processor: Mesa Intel UHD Graphics 630
Comment 1 Nate Graham 2021-08-03 22:26:51 UTC
For me it's not *immediate* but it does happen after just like half a second. Is that what you're seeing, or is it truly immediate for you?
Comment 2 Jacob White 2021-08-03 22:35:03 UTC
It's truly immediate for me. I don't think the screen is rendered once before the focus switch happens.

My monitor is running at 144hz, but I also tested at 60hz and experienced the same behavior.
Comment 3 Nate Graham 2021-08-04 15:37:12 UTC
Interesting, thanks for the data.
Comment 4 Bug Janitor Service 2021-08-29 17:11:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1334
Comment 5 Zamundaaa 2021-08-30 14:42:15 UTC
Git commit 42b516b56777bb7b87fa97534a2e9d0b84cbdc18 by Xaver Hugl.
Committed on 30/08/2021 at 14:31.
Pushed by zamundaaa into branch 'master'.

fix drag and drop raise with Xwayland windows

They shouldn't be raised immediately. The same strategy as with
Wayland native clients should be used.

M  +15   -9    src/input.cpp
M  +0    -1    src/xwl/drag_wl.cpp
M  +0    -6    src/xwl/drag_x.cpp

https://invent.kde.org/plasma/kwin/commit/42b516b56777bb7b87fa97534a2e9d0b84cbdc18
Comment 6 Zamundaaa 2021-08-30 16:49:27 UTC
Git commit 37c9d43b93b299fc20b57fb1717805aaa65a572e by Xaver Hugl.
Committed on 30/08/2021 at 16:49.
Pushed by zamundaaa into branch 'Plasma/5.22'.

fix drag and drop raise with Xwayland windows

They shouldn't be raised immediately. The same strategy as with
Wayland native clients should be used.


(cherry picked from commit 42b516b56777bb7b87fa97534a2e9d0b84cbdc18)

M  +15   -9    src/input.cpp
M  +0    -1    src/xwl/drag_wl.cpp
M  +0    -6    src/xwl/drag_x.cpp

https://invent.kde.org/plasma/kwin/commit/37c9d43b93b299fc20b57fb1717805aaa65a572e
Comment 7 Yevhen Popok 2024-01-27 01:40:24 UTC
Created attachment 165263 [details]
Demo of the window raising issue during drag-n-drop on Wayland

> STEPS TO REPRODUCE
> 1. Open a window (for example, Firefox) in fullscreen.
> 2. Open two Dolphin windows, and move them to the top left and top right
> corners of the screen, leaving a gap between them.
> 3. Attempt to drag a file or folder from one Dolphin window to the other.

I still have it on a Wayland session. With the steps above, it's easily reproducible on different KDE Plasma versions (6.0 RC1, 5.27 and even 5.24).
Please see my video that shows difference in drag-and-drop behavior on X11 and Wayland sessions. It's available in attachment and also on https://youtu.be/jMoGk-C8L_Q
Comment 8 Nate Graham 2024-01-29 17:09:15 UTC
I can kind of reproduce the issue, as it's a little bit different from the original bug report now. I can see that windows immediately become *focused* when something is dragged over them, but they don't also become *raised* until the drag ends or the drag stops moving. When I stop moving, the raising is very fast though; ti feels like there needs to be a much higher delay.

Can you submit a new bug report for this, since it's technically a new issue? Once you do, you can add its bug number to the "See also" field of this bug report. Thanks!