Bug 517573 - Text selection breaks for Gtk4 apps
Summary: Text selection breaks for Gtk4 apps
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.5.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2026-03-14 18:49 UTC by postix
Modified: 2026-06-11 16:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.7.0
Sentry Crash Report:


Attachments
Screen recording (1.65 MB, video/webm)
2026-03-14 18:49 UTC, postix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2026-03-14 18:49:25 UTC
Created attachment 190667 [details]
Screen recording

SUMMARY

Selecting text in Gtk4 applications has stopped working reliably for me since more than two months on two KDE Plasma machines, one running Fedora 43 and the other Tumbleweed.

DISCLAIMER

I've assumed  it to be a Gtk4 issue and had reported it on the GNOME bugtracker but got no response within a month.

However, when testing it with an older version (4.18.x) today, where it definitely has used to work I could still reproduce it. Same with the latest version Gtk 4.22.1. Both compiled by source and ensured gtk4-demo picks the right version.

Thus, I've decided to report it now against KDE Plasma. If you doubt it's a Plasma (Wayland) issue, feel free t o close it, but I'd be happy if I could get some pointer how to debug it further. :)

STEPS TO REPRODUCE
 1. Open the gtk4-demo application
 2. Place the cursor in the "info-textview"
 3. Hold down the left mouse button and move it in order to select a range of text
or 
4. Press Ctrl+a to select everything

OBSERVED RESULT
Initial text selection works, but then it stops:

text seems to become deselected, whereby it looks like the start of the selection jumps to the new cursor position, i.e. you can see a short blue-ish (accent color) flash at the current cursor position.

EXPECTED RESULT
The text gets selected as expected.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20260312
KDE Plasma Version: 6.6.2
KDE Frameworks Version: 6.23.0
Qt Version: 6.10.2
Kernel Version: 6.19.6-2-default (64-bit)
Graphics Platform: Wayland

and also

- Gtk 4.20.3
- Fedora 43 (and openSUSE Tumbleweed) with Plasma 6.5.5 Wayland
- GLib Version: 2.86.3
- Pango Version: 1.57.0
- Cairo Version: 1.18.4
- GL-Renderer: AMD Radeon Graphics (radeonsi, renoir, ACO, DRM 3.64, 6.18.9-200.fc43.x86_64)
- GSK-Renderer: Vulkan
- Input method: gtk-im-context-simple


## Additional information
Not reproducible with the gtk3-demo application or in any Qt application.
Comment 1 postix 2026-03-14 18:51:40 UTC
For reference, the original issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/8028
Comment 2 postix 2026-04-01 11:47:08 UTC
Cannot reproduce on X11 or when running the gtk4 application as an XWayland app, e.g. `GDK_BACKEND=x11 gtk4-demo`.
Comment 3 Bug Janitor Service 2026-06-03 12:48:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/6672
Comment 4 Bug Janitor Service 2026-06-03 12:48:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/9326
Comment 5 David Edmundson 2026-06-05 07:47:50 UTC
Git commit 5bb4c763e49d1799791780815de5ab0dc8f07275 by David Edmundson, on behalf of Vlad Zahorodnii.
Committed on 05/06/2026 at 07:18.
Pushed by vladz into branch 'master'.

klipper: Permit valid empty selections on Wayland

GTK applications tend to set valid empty selections sometimes. With the
current logic, the selection is overwritten by klipper, which in its
turn breaks the GTK apps.

M  +12   -6    klipper/systemclipboard.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/5bb4c763e49d1799791780815de5ab0dc8f07275
Comment 6 Vlad Zahorodnii 2026-06-05 07:53:56 UTC
Git commit f77bcb60509321197f127a89f946825a08247815 by Vlad Zahorodnii.
Committed on 05/06/2026 at 07:28.
Pushed by vladz into branch 'master'.

Prevent klipper from overwriting valid empty selections

GTK applications tend to set valid empty selections sometimes. With the
current logic, the selection is overwritten by klipper, which in its
turn breaks the GTK apps.

In order to work reliably, this depends on an upstream patch to make
selection updates in GTK less racy. See
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/10006.

M  +2    -2    src/wayland/seat.cpp

https://invent.kde.org/plasma/kwin/-/commit/f77bcb60509321197f127a89f946825a08247815
Comment 7 Bug Janitor Service 2026-06-05 09:03:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/6682
Comment 8 Vlad Zahorodnii 2026-06-05 09:58:15 UTC
Git commit 914a5004f5bec4991ec60873dbabf922a2fe467c by Vlad Zahorodnii.
Committed on 05/06/2026 at 09:19.
Pushed by vladz into branch 'Plasma/6.7'.

klipper: Permit valid empty selections on Wayland

GTK applications tend to set valid empty selections sometimes. With the
current logic, the selection is overwritten by klipper, which in its
turn breaks the GTK apps.


(cherry picked from commit 5bb4c763e49d1799791780815de5ab0dc8f07275)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +12   -6    klipper/systemclipboard.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/914a5004f5bec4991ec60873dbabf922a2fe467c
Comment 9 Vlad Zahorodnii 2026-06-05 10:17:37 UTC
Git commit 46ac1e7679df4008c0e3c120906dfdf7193de2e2 by Vlad Zahorodnii.
Committed on 05/06/2026 at 09:03.
Pushed by vladz into branch 'Plasma/6.7'.

Prevent klipper from overwriting valid empty selections

GTK applications tend to set valid empty selections sometimes. With the
current logic, the selection is overwritten by klipper, which in its
turn breaks the GTK apps.

In order to work reliably, this depends on an upstream patch to make
selection updates in GTK less racy. See
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/10006.


(cherry picked from commit f77bcb60509321197f127a89f946825a08247815)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +2    -2    src/wayland/seat.cpp

https://invent.kde.org/plasma/kwin/-/commit/46ac1e7679df4008c0e3c120906dfdf7193de2e2