Bug 489806 - Make it possible so that background window does not raise when starting a drag (mouse down), but does on click
Summary: Make it possible so that background window does not raise when starting a dra...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: master
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL: https://mstdn.io/deck/@scottjenson@so...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-05 23:29 UTC by Jure Repinc
Modified: 2024-10-26 00:50 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jure Repinc 2024-07-05 23:29:20 UTC
Expected behaviour
1. Single click on background window: raise it
2. Drag on icon in background window: just highlight icon and start dragging, no raise

Actual behaviour:
There are settings in System Settings → Window Management → Window Actions. There you can set the left click from "Activate, raise and forward click" to "Activate and forward click" and some others but none of them satisfies both expected cases at the same time, because the entire click (mouse down + mouse up) is considered. With the default "Activate, raise and forward click" when you start dragging the item in the background window the background window raises and if it covers the entire previously foreground window we lose the drag target window from sight since it goes into background. If "Activate and forward click" setting (without raise) is selected then if you only click on the window in the background it does not raise and you have to click the second time to raise it.
Comment 1 Scott Jenson 2024-07-05 23:58:39 UTC
This is actually a well known (and very old) pattern that is used on both Macs and Win machines. My understanding is that there is a setting to control this behavior but there are two issues:
1. It's off by default
2. Even on, it's not quite implemented right

If fixed, having this on has zero negative effects so I'd argue, it should be on by default

As it's currently implemented, turning this on requires 2 clicks to raise the background window which is a missed opportunity as it's not required. A much simpler flow is:
1. There are two windows, a background SOURCE window and a foreground TARGET window
2. MouseDown in SOURCE highlights the icon and starts a drag, SOURCE is NOT raised.
3. If the user does a MouseUp at this point, SOURCE raises (and the icon is still selected)
4. If instead the user starts to drag to TARGET and release, SOURCE still does not raise

This handles all cases of raising: click still raises a window but dragging a background window is still possible without raising. Better UX overall and no setting needed.
Comment 2 Zamundaaa 2024-10-02 14:22:02 UTC
https://invent.kde.org/plasma/kwin/-/merge_requests/6555 implements this
Comment 3 Zamundaaa 2024-10-25 13:49:25 UTC
Git commit 5f85280563cc44988c083737acfd7fdc0d607721 by Xaver Hugl.
Committed on 25/10/2024 at 13:35.
Pushed by zamundaaa into branch 'master'.

window: add new inactive mouse action, and make it the default

This new option
- activates on click
- passes clicks
- raises only on release

This way, if a user starts a drag on a window lower in the stacking order, it does
not get raised above other windows immediately, which makes drag and drop less
annoying to deal with

M  +1    -0    autotests/integration/CMakeLists.txt
A  +126  -0    autotests/integration/mouseactions_test.cpp     [License: GPL(v2.0+)]
M  +6    -6    autotests/integration/x11_window_test.cpp
M  +4    -4    autotests/integration/xdgshellwindow_test.cpp
M  +6    -6    src/events.cpp
M  +46   -20   src/input.cpp
M  +5    -0    src/kcms/options/actions.ui
M  +2    -1    src/kcms/options/kwinoptions_settings.kcfg
M  +2    -2    src/kwin.kcfg
M  +4    -1    src/options.cpp
M  +3    -2    src/options.h
M  +6    -6    src/useractions.cpp
M  +38   -5    src/window.cpp
M  +4    -2    src/window.h
M  +2    -2    src/xdgshellwindow.cpp

https://invent.kde.org/plasma/kwin/-/commit/5f85280563cc44988c083737acfd7fdc0d607721