Skip to content

Fix clipboard history not updating on subsequent copies in Wayland#116648

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
gongpha:wayland-clipboard-fix
Mar 26, 2026
Merged

Fix clipboard history not updating on subsequent copies in Wayland#116648
akien-mga merged 1 commit into
godotengine:masterfrom
gongpha:wayland-clipboard-fix

Conversation

@gongpha
Copy link
Copy Markdown
Contributor

@gongpha gongpha commented Feb 23, 2026

Fixes #116522

When setting the clipboard, the data source was reused after the first copy and only the in-memory buffer was updated, so the compositor was never notified of subsequent clipboard changes.

The change makes it destroy and recreate the wl_data_source when setting the clipboard selection, so that wl_data_device_set_selection is called each time. Clipboard managers (e.g. KDE Klipper) detect new entries by receiving a new selection event from the compositor, which only fires when set_selection is called with a new data source.

This PR also applies the same fix to the primary clipboard.

@gongpha gongpha requested a review from a team as a code owner February 23, 2026 04:58
@Nintorch Nintorch added this to the 4.x milestone Feb 23, 2026
@deralmas deralmas self-requested a review February 23, 2026 06:48
Copy link
Copy Markdown
Member

@YeldhamDev YeldhamDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue, but someone needs to review the Wayland code itself.

Really hope this get merged though, such an annoying issue.

@YeldhamDev YeldhamDev modified the milestones: 4.x, 4.7 Mar 23, 2026
@YeldhamDev YeldhamDev added the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label Mar 23, 2026
Copy link
Copy Markdown
Member

@deralmas deralmas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

Could not see any obvious regressions on my usual test harness (KDE 6.5.4, GNOME 49.2.2, COSMIC 1.0.1), and my laptop (sway 1.11).

Comment thread platform/linuxbsd/wayland/wayland_thread.cpp
@akien-mga akien-mga merged commit 915f8dc into godotengine:master Mar 26, 2026
20 checks passed
@gongpha gongpha deleted the wayland-clipboard-fix branch March 26, 2026 15:56
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented May 14, 2026

Cherry-picked for 4.6.3.

@Repiteo Repiteo removed the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clipboard history only logs the first copy attempt from Godot in Wayland

7 participants