Bug 488473 - [wayland] For Native Wayland Applications, Overview Effect with Screen Edge Preserves Focus but Overview Effect with Keyboard Shortcut Partially Does Not
Summary: [wayland] For Native Wayland Applications, Overview Effect with Screen Edge P...
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-overview (show other bugs)
Version: unspecified
Platform: Other Linux
: VLO minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-13 22:59 UTC by Eamonn Rea
Modified: 2024-06-17 22:16 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eamonn Rea 2024-06-13 22:59:39 UTC
SUMMARY
If you activate the Overview Effect using a Screen Edge, such as Top Left, the currently focused window will keep its focused state. If the Overview Effect is activated using a keyboard shortcut, such as Ctrl+W, all windows will partially lose focus. This only applies to native Wayland applications.

This can be observed in different ways depending on the application. With a standard KDE application like Dolphin running with Wayland, activating the Overview Effect with a Screen Edge won't change the titlebar / windowing focus colour shade. However if activating the Overview Effect with a keyboard shortcut (like Ctrl+W), the window decoration area will keep its focused colour, but the rest of the top part of the window will change to its unfocused colour.

When the Overview Effect is cancelled (such as with Ctrl+W again or Escape) then the window comes back into focus again and behaves as normal. 

Running Dolphin with `QT_QPA_PLATFORM=xcb dolphin` (and verifying that it is using X11 with `xeyes`) and activating the Overview effect with either a Screen Edge or a keyboard shortcut will preserve the window focus, at least visually.

I state that it "partially" loses focus because I am not sure internally if focus is being given/lost, this is based on visuals. I also say partially because Firefox, which dims the text in tabs when a window is unfocused, does not dim the tab text in either Overview Effect case, but web pages will act as though focus is lost - For example the Discord website version, which pauses gifs when focus is lost, and gifs are paused when the Overview Effect is activated with a keyboard shortcut but are NOT paused when the Overview Effect is activated with a Screen Edge.

Other Wayland GTK applications behave randomly. GTK applications seem to retain their titlebar focus colour, but window content (such as buttons with a tab highlight) will lose focus when the Overview Effect is activated with a keyboard shortcut but NOT when activated with a Screen Edge. Perhaps this is why Firefox window content behaves unfocused, but the tab text retains its focus, as other GTK applications retain the titlebar focus shade, and I believe Firefox is GTK-based.

I am unsure if this behaviour is a regression, but it is a minor inconsistency in behaviour.

STEPS TO REPRODUCE
Most Wayland Applications
1. Open a Wayland native application, such as KDE Dolphin and make sure it is focused
2. Activate the Overview Effect with a Screen Edge
3. Dolphin retains its "focused" visuals
4. Close Overview Effect (i.e. with Escape)
5. Activate the Overview Effect again but this time with a keyboard shortcut
6. Dolphin's window decorations retain the focused shade, but the other parts of the window (such as the toolbar just below the window decorations) gain their unfocused shade.

X11 Qt Applications
1. Open an X11 Qt application, such as KDE Dolphin but with `QT_QPA_PLATFORM=xcb dolphin` from the Terminal
    a. Optional: Verify that Dolphin is running under XWayland by using `xeyes` and hovering over the Dolphin window; the eyes will follow the cursor when it is over the X11 window, but not for the Wayland window.
2. Activate the Overview Effect with a Screen Edge
3. Dolphin retains its "focused" visuals
4. Close Overview Effect (i.e. with Escape)
5. Activate the Overview Effect again but this time with a keyboard shortcut
6. Dolphin still retains its "focused" visuals unlike when running with Wayland native

 Wayland GTK Applications
1. Open a Wayland native GTK application, such as Firefox
2. Activate the Overview Effect with a Screen Edge
3. Application retains its "focused" visuals entirely (any highlighted sections remain highlighted, titlebar does not change focus colour)
4. Close Overview Effect (i.e. with Escape)
5. Activate the Overview Effect again but this time with a keyboard shortcut
6. The window titlebar will still retain its "focused" visuals, but the window content will behave as thought is unfocused
    a. On Firefox for example, highlights around text areas (such as on this issue tracker) will disappear in this instance, but will remain highlighted when the Overview Effect is activated with a Screen Edge

OBSERVED RESULT
Wayland window focus behaviour appears to differ, at least visually, depending on whether the Overview Effect is activated using a Screen Edge or a keyboard shortcut. This behaviour does not apply to X11 applications.

EXPECTED RESULT
I am not sure whether the window should be focused or unfocused. Perhaps looking at the behaviour of other Desktop Environments / Operating Systems is a good reference here (or previous Plasma behaviour, if this is a regression).

Alternatively, if X11 applications' focusing behaviour is the expected behaviour, then this should be standard across Wayland applications as well.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.9.3 Linux Zen
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION
As far as I can tell, this doesn't really impact anything. This is not something that is affecting me in any way, but I noticed it all the same. Maybe it has implications for window behaviours/pausing (i.e. games) when focus is lost? I have not been able to test any native Wayland games to see which might have this sort of behaviour and if they are impacted.
Comment 1 Eamonn Rea 2024-06-15 17:29:08 UTC
I discovered today that if you activate the Overview Effect with a Screen Edge, which preserves the focus, and then type something in the Overview Effect Search bar (which hides the windows) and then remove that term (which brings the windows back), the focus behaviour will be the same as if the Overview Effect was activated with a keyboard shortcut - i.e. window has partially(?) lost focus, but deactivating the Overview Effect restores focus correctly.
Comment 2 Eamonn Rea 2024-06-15 17:50:49 UTC
There is some strange focusing behaviour with windows in the Overview Effect and the Application Dashboard/Launcher/Menu. This behaviour is noted on Bug 488546. I will copy and paste it here for transparency.

If you focus an element of window:
- Activating the Overview Effect with a Screen Edge preserves the focus (i.e. a focused YouTube search bar).
    - Activating the Dashboard/Launcher/Menu will un-focus the search bar on the spread windows (i.e. on YouTube, the search bar highlight will disappear and the suggested searches list will close as though you clicked off of the search bar). 
    - Deactivating the Dashboard/Launcher/Menu (i.e. by pressing the Meta key again) will resume the focus.
- Activating the Overview Effect with a Keyboard Shortcut partially unfocuses the window (i.e. on YouTube, a focused search bar will lose its focus if the Overview Effect is activated with a keyboard shortcut).
    - Activating the Dashboard/Launcher/Menu will at first have no effect, because the focus is lost when the effect is activated with a keyboard shortcut
    - Deactivating the Dashboard/Launcher/Menu (i.e. by pressing the Meta key again) will give the visual focus back, which it originally had when the effect was activated but which it *does not visually have* when the effect is activated with a keyboard shortcut
Comment 3 David Redondo 2024-06-17 07:35:29 UTC
Is that actually an issue except the visual? Does it have any functional defects?
Comment 4 Eamonn Rea 2024-06-17 22:16:52 UTC
I noted this at the bottom of the OP but there's a lot of text so perhaps it was missed :-)

> As far as I can tell, this doesn't really impact anything. This is not something that is affecting me in any way, but I noticed it all the same. Maybe it has implications for window behaviours/pausing (i.e. games) when focus is lost? I have not been able to test any native Wayland games to see which might have this sort of behaviour and if they are impacted.

It is a behavioral inconsistency though that is specific to Wayland applications.